diff --git a/README.md b/README.md index 768c272c81..b8f642f48e 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,9 @@ Feel free to check out our [public roadmap](https://trello.com/b/CrUcz6Jy/wp-roc Visit [wp-media.me](https://wp-media.me/?utm_source=github&utm_medium=wp_rocket_profile). -We also make other plugins that help speed up and secure WordPress websites. Check out: +We also make other plugins that help speed up WordPress websites. Check out: * [Imagify](https://imagify.io): it's a great WordPress plugin to optimize your images and speed up your website. -* [SecuPress](https://secupress.me): get peace of mind by securing your WordPress website against various security threats. ## Special thanks diff --git a/composer.json b/composer.json new file mode 100644 index 0000000000..0ac98013b9 --- /dev/null +++ b/composer.json @@ -0,0 +1,41 @@ +{ + "name": "wp-media/wp-rocket", + "description": "Performance optimization plugin for WordPress", + "keywords": [ + "wordpress", + "cache", + "minification", + "lazyload" + ], + "homepage": "https://wp-rocket.me", + "license": "GPL-2.0+", + "authors": [ + { + "name": "WP Media", + "email": "contact@wp-media.me", + "homepage": "https://wp-media.me" + } + ], + "type": "wordpress-plugin", + "support": { + "issues": "https://github.com/wp-media/wp-rocket/issues", + "source": "https://github.com/wp-media/wp-rocket" + }, + "require": { + "matthiasmullie/minify": "1.3.*", + "jamesryanbell/cloudflare": "^1.11", + "a5hleyrich/wp-background-processing": "^1.0" + }, + "autoload": { + "classmap": [ + "inc/classes", + "inc/vendors/classes" + ] + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.1", + "wimg/php-compatibility": "^8.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "wp-coding-standards/wpcs": "^0.14.0" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000000..cae9c608fa --- /dev/null +++ b/composer.lock @@ -0,0 +1,416 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "9c5425cb6724e56c1e01188ca31b6f3e", + "packages": [ + { + "name": "a5hleyrich/wp-background-processing", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/A5hleyRich/wp-background-processing.git", + "reference": "15a8a79130a15366d9d550d078f14232ed83d3ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/A5hleyRich/wp-background-processing/zipball/15a8a79130a15366d9d550d078f14232ed83d3ba", + "reference": "15a8a79130a15366d9d550d078f14232ed83d3ba", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "classmap": [ + "classes/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPLv2+" + ], + "authors": [ + { + "name": "Ashley Rich", + "email": "hello@ashleyrich.com" + } + ], + "description": "WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.", + "time": "2016-08-07T10:26:07+00:00" + }, + { + "name": "jamesryanbell/cloudflare", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/jamesryanbell/cloudflare.git", + "reference": "75e93bb822619d8ddb8b1843588caa2fad739491" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jamesryanbell/cloudflare/zipball/75e93bb822619d8ddb8b1843588caa2fad739491", + "reference": "75e93bb822619d8ddb8b1843588caa2fad739491", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "< 6", + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cloudflare\\": "src/CloudFlare" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "James Bell", + "email": "james@james-bell.co.uk" + } + ], + "description": "CloudFlare API - PHP", + "keywords": [ + "api", + "cloudflare" + ], + "time": "2017-08-04T19:01:02+00:00" + }, + { + "name": "matthiasmullie/minify", + "version": "1.3.56", + "source": { + "type": "git", + "url": "https://github.com/matthiasmullie/minify.git", + "reference": "86e4a4e4e7eae2d0cd74871735f18bbb132da4b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/86e4a4e4e7eae2d0cd74871735f18bbb132da4b7", + "reference": "86e4a4e4e7eae2d0cd74871735f18bbb132da4b7", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "matthiasmullie/path-converter": "~1.1", + "php": ">=5.3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.0", + "matthiasmullie/scrapbook": "~1.0", + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "psr/cache-implementation": "Cache implementation to use with Minify::cache" + }, + "bin": [ + "bin/minifycss", + "bin/minifyjs" + ], + "type": "library", + "autoload": { + "psr-4": { + "MatthiasMullie\\Minify\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthias Mullie", + "email": "minify@mullie.eu", + "homepage": "http://www.mullie.eu", + "role": "Developer" + } + ], + "description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.", + "homepage": "http://www.minifier.org", + "keywords": [ + "JS", + "css", + "javascript", + "minifier", + "minify" + ], + "time": "2017-11-24T12:51:16+00:00" + }, + { + "name": "matthiasmullie/path-converter", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/matthiasmullie/path-converter.git", + "reference": "08551ec1b156e923c242a10ab484bd4d6ead6631" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/08551ec1b156e923c242a10ab484bd4d6ead6631", + "reference": "08551ec1b156e923c242a10ab484bd4d6ead6631", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "MatthiasMullie\\PathConverter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthias Mullie", + "email": "pathconverter@mullie.eu", + "homepage": "http://www.mullie.eu", + "role": "Developer" + } + ], + "description": "Relative path converter", + "homepage": "http://github.com/matthiasmullie/path-converter", + "keywords": [ + "converter", + "path", + "paths", + "relative" + ], + "time": "2017-01-26T08:54:49+00:00" + } + ], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.4.4", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08", + "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": "^5.3|^7", + "squizlabs/php_codesniffer": "*" + }, + "require-dev": { + "composer/composer": "*", + "wimg/php-compatibility": "^8.0" + }, + "suggest": { + "dealerdirect/qa-tools": "All the PHP QA tools you'll need" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "f.nijhof@dealerdirect.nl", + "homepage": "http://workingatdealerdirect.eu", + "role": "Developer" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://workingatdealerdirect.eu", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2017-12-06T16:27:17+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "d667e245d5dcd4d7bf80f26f2c947d476b66213e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d667e245d5dcd4d7bf80f26f2c947d476b66213e", + "reference": "d667e245d5dcd4d7bf80f26f2c947d476b66213e", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-10-16T22:40:25+00:00" + }, + { + "name": "wimg/php-compatibility", + "version": "8.0.1", + "source": { + "type": "git", + "url": "https://github.com/wimg/PHPCompatibility.git", + "reference": "4c4385fb891dff0501009670f988d4fe36785249" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4c4385fb891dff0501009670f988d4fe36785249", + "reference": "4c4385fb891dff0501009670f988d4fe36785249", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.2 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "PHPCompatibility\\": "PHPCompatibility/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "time": "2017-08-07T19:39:05+00:00" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "0.14.0", + "source": { + "type": "git", + "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", + "reference": "8cadf48fa1c70b2381988e0a79e029e011a8f41c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/8cadf48fa1c70b2381988e0a79e029e011a8f41c", + "reference": "8cadf48fa1c70b2381988e0a79e029e011a8f41c", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "wordpress" + ], + "time": "2017-11-01T15:10:46+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/inc/3rd-party/3rd-party.php b/inc/3rd-party/3rd-party.php index 109eac0cd5..a08bf4b9ce 100644 --- a/inc/3rd-party/3rd-party.php +++ b/inc/3rd-party/3rd-party.php @@ -1,10 +1,14 @@ =' ) ) { require( WP_ROCKET_3RD_PARTY_PATH . 'hosting/savvii.php' ); @@ -12,42 +16,59 @@ require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/geotargetingwp.php' ); } -require( WP_ROCKET_3RD_PARTY_PATH . 'slider/revslider.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'i18n/wpml.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'i18n/polylang.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/woocommerce.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/aelia-currencyswitcher.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/aelia-prices-by-country.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/aelia-tax-display-by-country.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/woocommerce-multilingual.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/woocommerce-currency-converter-widget.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'ecommerce/edd-software-licencing.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'age-verify.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'autoptimize.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'eu-cookie-law.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'weepie-cookie-allow.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'kk-star-ratings.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'wp-postratings.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'wp-print.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'buddypress.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'disqus.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'give.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'custom-login.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'mobile/amp.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'mobile/wp-appkit.php' ); -//require( WP_ROCKET_3RD_PARTY_PATH . 'jetpack.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'yoast-seo.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'all-in-one-seo-pack.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'wp-rest-api.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'page-builder/beaver-builder.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'page-builder/thrive-visual-editor.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'page-builder/visual-composer.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'security/secupress.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'simple-custom-css.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'wp-retina-2x.php' ); -require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/sf-move-login.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/slider/revslider.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/slider/layerslider.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/slider/meta-slider.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/slider/soliloquy.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/i18n/wpml.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/i18n/polylang.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/woocommerce.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/aelia-currencyswitcher.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/aelia-prices-by-country.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/aelia-tax-display-by-country.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/woocommerce-multilingual.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/woocommerce-currency-converter-widget.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/edd-software-licencing.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/easy-digital-downloads.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/ithemes-exchange.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/jigoshop.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/wpshop.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/ecommerce/give.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/age-verify.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/appbanners.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/autoptimize.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/envira-gallery.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/cookies/eu-cookie-law.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/cookies/weepie-cookie-allow.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/rating/kk-star-ratings.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/rating/wp-postratings.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/wp-print.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/buddypress.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/disqus.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/custom-login.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/mobile/amp.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/mobile/wp-appkit.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/mobile/wp-touch.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/seo/yoast-seo.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/seo/all-in-one-seo-pack.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/wp-rest-api.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/page-builder/beaver-builder.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/page-builder/thrive-visual-editor.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/page-builder/visual-composer.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/security/secupress.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/security/sf-move-login.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/security/wps-hide-login.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/simple-custom-css.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/wp-retina-2x.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/varnish-http-purge.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/thrive-leads.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/mailchimp.php' ); require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/advanced-custom-fields.php' ); require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/wp-offload-s3.php' ); require( WP_ROCKET_3RD_PARTY_PATH . 'plugins/wp-offload-s3-assets.php' ); require( WP_ROCKET_3RD_PARTY_PATH . 'themes/divi.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'themes/avada.php' ); +require( WP_ROCKET_3RD_PARTY_PATH . 'themes/studiopress.php' ); + +require( WP_ROCKET_3RD_PARTY_PATH . 'aqua-resizer.php' ); diff --git a/inc/3rd-party/aqua-resizer.php b/inc/3rd-party/aqua-resizer.php new file mode 100644 index 0000000000..cbccec41ed --- /dev/null +++ b/inc/3rd-party/aqua-resizer.php @@ -0,0 +1,16 @@ +HCSVarnishPurgeAll(); + } +} +add_action( 'after_rocket_clean_domain', 'rocket_clean_pagely' ); diff --git a/inc/3rd-party/hosting/pressidium.php b/inc/3rd-party/hosting/pressidium.php new file mode 100644 index 0000000000..020fe7e79f --- /dev/null +++ b/inc/3rd-party/hosting/pressidium.php @@ -0,0 +1,37 @@ +purgeAllCaches(); + } + add_action( 'after_rocket_clean_domain', 'rocket_clean_pressidium' ); +endif; diff --git a/inc/3rd-party/hosting/savvii.php b/inc/3rd-party/hosting/savvii.php index 86c9f64651..d07c5492fc 100644 --- a/inc/3rd-party/hosting/savvii.php +++ b/inc/3rd-party/hosting/savvii.php @@ -1,5 +1,5 @@ purge_cache(); + } +} +add_action( 'wp_ajax_sg-cachepress-purge' , 'rocket_clean_domain', 0 ); +add_action( 'admin_post_sg-cachepress-purge', 'rocket_clean_domain', 0 ); +add_action( 'after_rocket_clean_domain' , 'rocket_clean_supercacher' ); diff --git a/inc/3rd-party/hosting/varnish.php b/inc/3rd-party/hosting/varnish.php index a7182e0a3d..c775950515 100644 --- a/inc/3rd-party/hosting/varnish.php +++ b/inc/3rd-party/hosting/varnish.php @@ -1,5 +1,5 @@ is_dir( $cache_path ) ) { + rocket_mkdir_p( $cache_path ); + } + + if ( ! rocket_direct_filesystem()->exists( $css_path ) ) { + ob_start(); + mailchimpSF_main_css(); + $content = ob_get_contents(); + ob_end_clean(); + + rocket_put_content( $css_path, $content ); + } + + wp_deregister_style( 'mailchimpSF_main_css' ); + wp_register_style( 'mailchimpSF_main_css', $cache_url . 'mailchimpSF_main_css.css', null, MCSF_VER ); +} +add_action( 'init', 'rocket_fix_mailchimp_main_css', PHP_INT_MAX ); diff --git a/inc/3rd-party/mobile/amp.php b/inc/3rd-party/plugins/mobile/amp.php similarity index 84% rename from inc/3rd-party/mobile/amp.php rename to inc/3rd-party/plugins/mobile/amp.php index 82faeb4474..712ec7aae5 100644 --- a/inc/3rd-party/mobile/amp.php +++ b/inc/3rd-party/plugins/mobile/amp.php @@ -1,5 +1,5 @@ 'sitemap_preload', - 'type' => 'checkbox', - 'label' => __( 'All in One SEO XML sitemap', 'rocket' ), - 'label_for' => 'all_in_one_seo_xml_sitemap', - 'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'All in One SEO Pack' ), - 'default' => 0, - ); + 'parent' => 'sitemap_preload', + 'type' => 'checkbox', + 'label' => __( 'All in One SEO XML sitemap', 'rocket' ), + 'label_for' => 'all_in_one_seo_xml_sitemap', + // translators: %s is the name of the plugin used for sitemap. + 'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'All in One SEO Pack' ), + 'default' => 0, + ); $options[] = array( - 'parent' => 'sitemap_preload', - 'type' => 'helper_description', - 'name' => 'all_in_one_seo_xml_sitemap_desc', - 'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'All in One SEO Pack' ), + 'parent' => 'sitemap_preload', + 'type' => 'helper_description', + 'name' => 'all_in_one_seo_xml_sitemap_desc', + // translators: %s is the name of the plugin used for sitemap. + 'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'All in One SEO Pack' ), ); return $options; } diff --git a/inc/3rd-party/yoast-seo.php b/inc/3rd-party/plugins/seo/yoast-seo.php similarity index 73% rename from inc/3rd-party/yoast-seo.php rename to inc/3rd-party/plugins/seo/yoast-seo.php index ec1a69b6d0..315737f692 100644 --- a/inc/3rd-party/yoast-seo.php +++ b/inc/3rd-party/plugins/seo/yoast-seo.php @@ -1,5 +1,5 @@ 'sitemap_preload', - 'type' => 'checkbox', - 'label' => __( 'Yoast SEO XML sitemap', 'rocket' ), - 'label_for' => 'yoast_xml_sitemap', - 'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'Yoast SEO' ), - 'default' => 0, - ); + 'parent' => 'sitemap_preload', + 'type' => 'checkbox', + 'label' => __( 'Yoast SEO XML sitemap', 'rocket' ), + 'label_for' => 'yoast_xml_sitemap', + // translators: %s is the name of the plugin used for the sitemap. + 'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'Yoast SEO' ), + 'default' => 0, + ); $options[] = array( - 'parent' => 'sitemap_preload', - 'type' => 'helper_description', - 'name' => 'yoast_xml_sitemap_desc', - 'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'Yoast SEO' ), + 'parent' => 'sitemap_preload', + 'type' => 'helper_description', + 'name' => 'yoast_xml_sitemap_desc', + // translators: %s is the name of the plugin used for the sitemap. + 'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'Yoast SEO' ), ); return $options; } diff --git a/inc/3rd-party/simple-custom-css.php b/inc/3rd-party/plugins/simple-custom-css.php similarity index 94% rename from inc/3rd-party/simple-custom-css.php rename to inc/3rd-party/plugins/simple-custom-css.php index 20daaace5b..9b928e0ed8 100644 --- a/inc/3rd-party/simple-custom-css.php +++ b/inc/3rd-party/plugins/simple-custom-css.php @@ -1,5 +1,5 @@ ', $content ); - if ( ! is_dir( $cache_busting_path ) ) { + if ( ! rocket_direct_filesystem()->is_dir( $cache_busting_path ) ) { rocket_mkdir_p( $cache_busting_path ); } diff --git a/inc/3rd-party/plugins/slider/layerslider.php b/inc/3rd-party/plugins/slider/layerslider.php new file mode 100644 index 0000000000..938034fb64 --- /dev/null +++ b/inc/3rd-party/plugins/slider/layerslider.php @@ -0,0 +1,12 @@ + 0; +} +add_filter( 'rocket_override_donotcachepage', 'rocket_override_donotcachepage_on_thrive_leads' ); diff --git a/inc/3rd-party/plugins/varnish-http-purge.php b/inc/3rd-party/plugins/varnish-http-purge.php new file mode 100644 index 0000000000..e5ecf78bbf --- /dev/null +++ b/inc/3rd-party/plugins/varnish-http-purge.php @@ -0,0 +1,77 @@ + 'PURGE', + 'blocking' => false, + 'headers' => array( + 'host' => $p['host'], + 'X-Purge-Method' => 'regex', + ), + ) + ); + + do_action( 'after_purge_url', $url, $purgeme ); + } +} diff --git a/inc/3rd-party/plugins/wp-offload-s3-assets.php b/inc/3rd-party/plugins/wp-offload-s3-assets.php index 4b2e3099eb..5d0b9c57ed 100644 --- a/inc/3rd-party/plugins/wp-offload-s3-assets.php +++ b/inc/3rd-party/plugins/wp-offload-s3-assets.php @@ -8,7 +8,7 @@ /** * Compatibility with WP Offload S3 assets addon. - * + * * @since 2.10.7 * @author Remy Perona */ @@ -28,7 +28,7 @@ function rocket_as3cf_assets_compatibility() { * @author Remy Perona * * @param string $old_value Previous assets option value. - * @param string $value New assets option value. + * @param string $new_value New assets option value. */ function rocket_maybe_deactivate_cdn( $old_value, $new_value ) { if ( $old_value['enable-addon'] !== $new_value['enable-addon'] && 1 === (int) $new_value['enable-addon'] ) { diff --git a/inc/3rd-party/plugins/wp-offload-s3.php b/inc/3rd-party/plugins/wp-offload-s3.php index 538b7693f3..e5fadd5ef7 100644 --- a/inc/3rd-party/plugins/wp-offload-s3.php +++ b/inc/3rd-party/plugins/wp-offload-s3.php @@ -8,7 +8,7 @@ /** * Compatibility with WP Offload S3. - * + * * @since 2.10.7 * @author Remy Perona */ diff --git a/inc/3rd-party/wp-print.php b/inc/3rd-party/plugins/wp-print.php similarity index 88% rename from inc/3rd-party/wp-print.php rename to inc/3rd-party/plugins/wp-print.php index e82c15fe43..4f3770ef03 100644 --- a/inc/3rd-party/wp-print.php +++ b/inc/3rd-party/plugins/wp-print.php @@ -1,5 +1,5 @@ get( 'Name' ) ) { + // When Avada theme purge its own cache. + add_action( 'avada_clear_dynamic_css_cache', 'rocket_clean_domain' ); + + /** + * Conflict with Avada theme and WP Rocket CDN + * + * @since 2.6.1 + * + * @param array $vars An array of variables. + * @param string $handle Name of the avada resource. + * @return array updated array of variables + */ + function rocket_fix_cdn_for_avada_theme( $vars, $handle ) { + if ( 'avada-dynamic' === $handle && get_rocket_option( 'cdn' ) ) { + + $src = get_rocket_cdn_url( get_template_directory_uri() . '/assets/less/theme/dynamic.less' ); + $vars['template-directory'] = sprintf( '~"%s"', dirname( dirname( dirname( dirname( $src ) ) ) ) ); + $vars['lessurl'] = sprintf( '~"%s"', dirname( $src ) ); + } + return $vars; + } + add_filter( 'less_vars', 'rocket_fix_cdn_for_avada_theme', 11, 2 ); + + $avada_options = get_option( 'avada_theme_options' ); + + function rocket_exclude_avada_dynamic_css( $excluded_files ) { + $upload_dir = wp_upload_dir(); + + $excluded_files[] = rocket_clean_exclude_file( $upload_dir['baseurl'] . '/fusion-styles/(.*)' ); + + return $excluded_files; + } + add_filter( 'rocket_exclude_cache_busting', 'rocket_exclude_avada_dynamic_css' ); +} diff --git a/inc/3rd-party/themes/divi.php b/inc/3rd-party/themes/divi.php index 9fdb8344bb..2238bebb49 100644 --- a/inc/3rd-party/themes/divi.php +++ b/inc/3rd-party/themes/divi.php @@ -1,5 +1,5 @@ cache_flush_theme(); + } +} diff --git a/inc/admin/admin.php b/inc/admin/admin.php index 10c7b1eeb4..ee2ec1815e 100644 --- a/inc/admin/admin.php +++ b/inc/admin/admin.php @@ -1,5 +1,5 @@ 1, - ) ); + wp_send_json( + array( + 'error' => 1, + ) + ); } else { wp_nonce_ays( '' ); } @@ -149,9 +151,11 @@ function rocket_dismiss_boxes( $args ) { if ( 'admin-post.php' === $GLOBALS['pagenow'] ) { if ( defined( 'DOING_AJAX' ) ) { - wp_send_json( array( - 'error' => 0, - ) ); + wp_send_json( + array( + 'error' => 0, + ) + ); } else { wp_safe_redirect( wp_get_referer() ); die(); @@ -220,15 +224,15 @@ function rocket_white_label( $plugins ) { $white_label_description = get_rocket_option( 'wl_description' ); // We change the plugin's header. $plugins['wp-rocket/wp-rocket.php'] = array( - 'Name' => get_rocket_option( 'wl_plugin_name' ), - 'PluginURI' => get_rocket_option( 'wl_plugin_URI' ), - 'Version' => isset( $plugins['wp-rocket/wp-rocket.php']['Version'] ) ? $plugins['wp-rocket/wp-rocket.php']['Version'] : '', - 'Description' => reset( ( $white_label_description ) ), - 'Author' => get_rocket_option( 'wl_author' ), - 'AuthorURI' => get_rocket_option( 'wl_author_URI' ), - 'TextDomain' => isset( $plugins['wp-rocket/wp-rocket.php']['TextDomain'] ) ? $plugins['wp-rocket/wp-rocket.php']['TextDomain'] : '', - 'DomainPath' => isset( $plugins['wp-rocket/wp-rocket.php']['DomainPath'] ) ? $plugins['wp-rocket/wp-rocket.php']['DomainPath'] : '', - ); + 'Name' => get_rocket_option( 'wl_plugin_name' ), + 'PluginURI' => get_rocket_option( 'wl_plugin_URI' ), + 'Version' => isset( $plugins['wp-rocket/wp-rocket.php']['Version'] ) ? $plugins['wp-rocket/wp-rocket.php']['Version'] : '', + 'Description' => reset( ( $white_label_description ) ), + 'Author' => get_rocket_option( 'wl_author' ), + 'AuthorURI' => get_rocket_option( 'wl_author_URI' ), + 'TextDomain' => isset( $plugins['wp-rocket/wp-rocket.php']['TextDomain'] ) ? $plugins['wp-rocket/wp-rocket.php']['TextDomain'] : '', + 'DomainPath' => isset( $plugins['wp-rocket/wp-rocket.php']['DomainPath'] ) ? $plugins['wp-rocket/wp-rocket.php']['DomainPath'] : '', + ); // if white label, remove our names from contributors. if ( rocket_is_white_label() ) { @@ -291,13 +295,13 @@ function rocket_rollback() { wp_nonce_ays( '' ); } - $plugin_transient = get_site_transient( 'update_plugins' ); - $plugin_folder = plugin_basename( dirname( WP_ROCKET_FILE ) ); - $plugin_file = basename( WP_ROCKET_FILE ); - $version = WP_ROCKET_LASTVERSION; - $c_key = get_rocket_option( 'consumer_key' ); - $url = sprintf( 'https://wp-rocket.me/%s/wp-rocket_%s.zip', $c_key, $version ); - $temp_array = array( + $plugin_transient = get_site_transient( 'update_plugins' ); + $plugin_folder = plugin_basename( dirname( WP_ROCKET_FILE ) ); + $plugin_file = basename( WP_ROCKET_FILE ); + $version = WP_ROCKET_LASTVERSION; + $c_key = get_rocket_option( 'consumer_key' ); + $url = sprintf( 'https://wp-rocket.me/%s/wp-rocket_%s.zip', $c_key, $version ); + $temp_array = array( 'slug' => $plugin_folder, 'new_version' => $version, 'url' => 'https://wp-rocket.me', @@ -322,10 +326,12 @@ function rocket_rollback() { $upgrader = new Plugin_Upgrader( $upgrader_skin ); remove_filter( 'site_transient_update_plugins', 'rocket_check_update', 100 ); $upgrader->upgrade( $plugin ); - // translators: %s is the plugin name. - wp_die( '', sprintf( __( '%s Update Rollback', 'rocket' ), WP_ROCKET_PLUGIN_NAME ), array( - 'response' => 200, - ) ); + wp_die( + // translators: %s is the plugin name. + '', sprintf( __( '%s Update Rollback', 'rocket' ), WP_ROCKET_PLUGIN_NAME ), array( + 'response' => 200, + ) + ); } } add_action( 'admin_post_rocket_rollback', 'rocket_rollback' ); @@ -354,10 +360,10 @@ function rocket_maybe_generate_advanced_cache_file() { * @since 2.6.5 */ function rocket_maybe_generate_config_files() { - list( $host, $path ) = get_rocket_parse_url( home_url() ); - $path = ( ! empty( $path ) ) ? str_replace( '/', '.', untrailingslashit( $path ) ) : ''; + $home = get_rocket_parse_url( home_url() ); + $path = ( ! empty( $home['path'] ) ) ? str_replace( '/', '.', untrailingslashit( $home['path'] ) ) : ''; - if ( ! file_exists( WP_ROCKET_CONFIG_PATH . strtolower( $host ) . $path . '.php' ) ) { + if ( ! file_exists( WP_ROCKET_CONFIG_PATH . strtolower( $home['host'] ) . $path . '.php' ) ) { rocket_generate_config_file(); } } @@ -373,24 +379,6 @@ function rocket_maybe_set_wp_cache_define() { } } -/** - * Launches the database optimization from admin - * - * @since 2.8 - * @author Remy Perona - */ -function rocket_optimize_database() { - if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'rocket_optimize_database' ) ) { - wp_nonce_ays( '' ); - } - - do_rocket_database_optimization(); - - wp_redirect( wp_get_referer() ); - die(); -} -add_action( 'admin_post_rocket_optimize_database', 'rocket_optimize_database' ); - /** * Filter plugin fetching API results to inject Imagify * @@ -451,3 +439,117 @@ function rocket_add_imagify_api_result( $result, $action, $args ) { return $result; } add_filter( 'plugins_api_result', 'rocket_add_imagify_api_result', 11, 3 ); + +/** + * Gets all data to send to the analytics system + * + * @since 2.11 + * @author Remy Perona + * + * @return array An array of data + */ +function rocket_analytics_data() { + global $wp_version, $is_nginx, $is_apache, $is_iis7, $is_IIS; + + $untracked_wp_rocket_options = array( + 'license' => 1, + 'consumer_email' => 1, + 'consumer_key' => 1, + 'secret_key' => 1, + 'secret_cache_key' => 1, + 'minify_css_key' => 1, + 'minify_js_key' => 1, + 'sitemaps' => 1, + 'cdn_zone' => 1, + 'cdn_cnames' => 1, + 'cloudflare_email' => 1, + 'cloudflare_api_key' => 1, + 'cloudflare_domain' => 1, + 'cloudflare_zone_id' => 1, + 'cloudflare_old_settings' => 1, + 'submit_optimize' => 1, + 'analytics_enabled' => 1, + 'wl_author' => 1, + 'wl_author_URI' => 1, + 'wl_description' => 1, + 'wl_plugin_URI' => 1, + 'wl_plugin_name' => 1, + 'wl_plugin_slug' => 1, + ); + + $theme = wp_get_theme(); + $data = array_diff_key( get_option( WP_ROCKET_SLUG ), $untracked_wp_rocket_options ); + $locale = explode('_', get_locale() ); + + if ( $is_nginx ) { + $data['web_server'] = 'NGINX'; + } elseif ( $is_apache ) { + $data['web_server'] = 'Apache'; + } elseif ( $is_iis7 ) { + $data['web_server'] = 'IIS 7'; + } elseif ( $is_IIS ) { + $data['web_server'] = 'IIS'; + } + + $data['php_version'] = preg_replace( '@^(\d\.\d+).*@', '\1', phpversion() ); + $data['wordpress_version'] = preg_replace( '@^(\d\.\d+).*@', '\1', $wp_version ); + $data['current_theme'] = $theme->get( 'Name' ); + $data['active_plugins'] = rocket_get_active_plugins(); + $data['locale'] = $locale[0]; + $data['multisite'] = is_multisite(); + + return $data; +} + +/** + * Determines if we should send the analytics data + * + * @since 2.11 + * @author Remy Perona + * + * @return bool True if we should send them, false otherwise + */ +function rocket_send_analytics_data() { + if ( ! get_rocket_option( 'analytics_enabled' ) ) { + return false; + } + + if ( ! current_user_can( 'administrator' ) ) { + return false; + } + + if ( false === get_transient( 'rocket_send_analytics_data' ) ) { + set_transient( 'rocket_send_analytics_data', 1, 7 * DAY_IN_SECONDS ); + return true; + } + + return false; +} + +/** + * Handles the analytics opt-in notice selection and prevent further display + * + * @since 2.11 + * @author Remy Perona + */ +function rocket_analytics_optin() { + if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'analytics_optin' ) ) { + wp_nonce_ays( '' ); + } + + if ( ! current_user_can( 'administrator' ) ) { + wp_redirect( wp_get_referer() ); + die(); + } + + if ( 'yes' === $_GET['value'] ) { + update_rocket_option( 'analytics_enabled', 1 ); + set_transient( 'rocket_analytics_optin', 1 ); + } + + update_option( 'rocket_analytics_notice_displayed', 1 ); + + wp_redirect( wp_get_referer() ); + die(); +} +add_action( 'admin_post_rocket_analytics_optin', 'rocket_analytics_optin' ); diff --git a/inc/admin/ajax.php b/inc/admin/ajax.php index 2cb5034159..e07b093f98 100644 --- a/inc/admin/ajax.php +++ b/inc/admin/ajax.php @@ -1,5 +1,5 @@ 10, 'body' => array( 'data' => array( - 'user_email' => defined( 'WP_ROCKET_EMAIL' ) ? sanitize_email( WP_ROCKET_EMAIL ) : '', - 'user_key' => defined( 'WP_ROCKET_KEY' ) ? sanitize_key( WP_ROCKET_KEY ) : '', - 'user_website' => home_url(), + 'user_email' => defined( 'WP_ROCKET_EMAIL' ) ? sanitize_email( WP_ROCKET_EMAIL ) : '', + 'user_key' => defined( 'WP_ROCKET_KEY' ) ? sanitize_key( WP_ROCKET_KEY ) : '', + 'user_website' => home_url(), 'wp_version' => $GLOBALS['wp_version'], 'wp_active_plugins' => rocket_get_active_plugins(), 'wp_rocket_version' => WP_ROCKET_VERSION, 'wp_rocket_options' => get_option( WP_ROCKET_SLUG ), - 'support_summary' => $_POST['summary'], + 'support_summary' => $_POST['summary'], 'support_description' => $_POST['description'], ), ), @@ -38,7 +38,11 @@ function wp_ajax_rocket_new_ticket_support() { if ( ! is_wp_error( $response ) ) { wp_send_json( wp_remote_retrieve_body( $response ) ); } else { - wp_send_json( array( 'msg' => 'BAD_SERVER' ) ); + wp_send_json( + array( + 'msg' => 'BAD_SERVER', + ) + ); } } add_action( 'wp_ajax_rocket_new_ticket_support', 'wp_ajax_rocket_new_ticket_support' ); @@ -55,7 +59,7 @@ function wp_ajax_rocket_helpscout_live_search() { WP_ROCKET_WEB_MAIN . 'tools/wp-rocket/helpscout/livesearch.php', array( 'timeout' => 10, - 'body' => array( + 'body' => array( 'query' => esc_html( wp_strip_all_tags( $query, true ) ), 'lang' => get_locale(), ), diff --git a/inc/admin/class-repeater-field.php b/inc/admin/class-repeater-field.php index 27cd924e21..08914d8509 100644 --- a/inc/admin/class-repeater-field.php +++ b/inc/admin/class-repeater-field.php @@ -1,5 +1,5 @@ option = $args['name']; + $this->option = $args['name']; $this->label_screen = ! empty( $args['label_screen'] ) ? esc_html( $args['label_screen'] ) : false; - $this->placeholder = ! empty( $args['placeholder'] ) ? 'placeholder="' . $args['placeholder'] . '" ' : ''; + $this->placeholder = ! empty( $args['placeholder'] ) ? 'placeholder="' . $args['placeholder'] . '" ' : ''; $this->is_drag_n_drop = ! empty( $args['repeater_drag_n_drop'] ) ? true : false; $this->label_add_field = ! empty( $args['repeater_label_add_field'] ) ? $args['repeater_label_add_field'] : false; @@ -197,7 +197,6 @@ public function render() { -
the_field(); ?>
diff --git a/inc/admin/compat/cf-options-5.4.php b/inc/admin/compat/cf-options-5.4.php index 33edb2e3f4..93aaedc69f 100644 --- a/inc/admin/compat/cf-options-5.4.php +++ b/inc/admin/compat/cf-options-5.4.php @@ -1,9 +1,9 @@ -zones( $newvalue['cloudflare_domain'] ); if ( isset( $zone->result[0]->id ) ) { diff --git a/inc/admin/compat/cf-upgrader-5.4.php b/inc/admin/compat/cf-upgrader-5.4.php index 33f1a02680..5ebf7ed3e1 100644 --- a/inc/admin/compat/cf-upgrader-5.4.php +++ b/inc/admin/compat/cf-upgrader-5.4.php @@ -1,9 +1,9 @@ -zones( $options['cloudflare_domain'] ); if ( isset( $zone->result[0]->id ) ) { diff --git a/inc/admin/options.php b/inc/admin/options.php index da3612b679..9a912839b5 100644 --- a/inc/admin/options.php +++ b/inc/admin/options.php @@ -1,5 +1,5 @@ ', + printf( + '
', sanitize_html_class( $args['name'] ), sanitize_html_class( $args['type'] ), isset( $args['parent'] ) ? 'fieldparent-' . sanitize_html_class( $args['parent'] ) : '' @@ -74,60 +75,58 @@ function rocket_field( $args ) { } switch ( $args['type'] ) { - case 'number' : - case 'email' : - case 'text' : - + case 'number': + case 'email': + case 'text': $value = get_rocket_option( $args['name'] ); if ( false === $value ) { $value = $default; } - $value = esc_attr( $value ); + $value = esc_attr( $value ); $number_options = 'number' === $args['type'] ? ' min="0" class="small-text"' : ''; - $autocomplete = in_array( $args['name'], array( 'consumer_key', 'consumer_email' ), true ) ? ' autocomplete="off"' : ''; - $disabled = ( 'consumer_key' === $args['name'] && defined( 'WP_ROCKET_KEY' ) ) || ( 'consumer_email' === $args['name'] && defined( 'WP_ROCKET_EMAIL' ) ) ? ' disabled="disabled"' : $readonly; + $autocomplete = in_array( $args['name'], array( 'consumer_key', 'consumer_email' ), true ) ? ' autocomplete="off"' : ''; + $disabled = ( 'consumer_key' === $args['name'] && defined( 'WP_ROCKET_KEY' ) ) || ( 'consumer_email' === $args['name'] && defined( 'WP_ROCKET_EMAIL' ) ) ? ' disabled="disabled"' : $readonly; ?> - -