tenweb-speed-optimizer
Last commit date
assets
11 months ago
config
2 years ago
exported
4 years ago
includes
2 months ago
test
4 years ago
vendor
1 month ago
views
11 months ago
.editorconfig
3 years ago
OptimizerAdmin.php
1 year ago
OptimizerAdminBar.php
2 years ago
OptimizerApi.php
1 month ago
OptimizerCli.php
1 year ago
OptimizerDataRepository.php
1 year ago
changelog.txt
3 years ago
config.php
1 month ago
env.php
1 month ago
phpcs.xml
3 years ago
readme.txt
1 month ago
tenweb_speed_optimizer.php
1 month ago
webpack.config.js
3 years ago
config.php
81 lines
| 1 | <?php |
| 2 | |
| 3 | define('TENWEB_SO_VERSION', '2.33.0'); |
| 4 | define('TENWEB_SO_CONNECTED_FROM', 'speed_optimizer'); |
| 5 | define('TENWEB_SO_DIR', plugin_dir_path(TWO_PLUGIN_FILE)); |
| 6 | define('TENWEB_SO_PLUGIN_DIR', plugin_dir_path(TWO_PLUGIN_FILE)); |
| 7 | define('TENWEB_SO_BASENAME', plugin_basename(TWO_PLUGIN_FILE)); |
| 8 | define('TW_OPTIMIZE_PREFIX', 'two'); |
| 9 | |
| 10 | if (!defined('TENWEB_PREFIX')) { |
| 11 | define('TENWEB_PREFIX', 'tenweb'); |
| 12 | } |
| 13 | |
| 14 | if (!defined('TENWEB_VERSION')) { |
| 15 | define('TENWEB_VERSION', 'two-' . TENWEB_SO_VERSION); |
| 16 | } |
| 17 | |
| 18 | // in seconds |
| 19 | if (!defined('TENWEB_SO_IN_PROGRESS_LOCK')) { |
| 20 | define('TENWEB_SO_IN_PROGRESS_LOCK', 300); |
| 21 | } |
| 22 | |
| 23 | if (!defined('TENWEB_SO_URL')) { |
| 24 | define('TENWEB_SO_URL', plugins_url(plugin_basename(__DIR__))); |
| 25 | } |
| 26 | |
| 27 | if (!defined('TENWEB_SO_NOOPTIMIZE_URL')) { |
| 28 | define('TENWEB_SO_NOOPTIMIZE_URL', get_site_url() . '?two_nooptimize=1'); |
| 29 | } |
| 30 | |
| 31 | if (!defined('TENWEB_SO_CACHE_CHILD_DIR')) { |
| 32 | define('TENWEB_SO_CACHE_CHILD_DIR', '/cache/tw_optimize/'); |
| 33 | } |
| 34 | |
| 35 | if (!defined('TENWEB_SO_LOGS_MAX_LINES_LIMIT')) { |
| 36 | define('TENWEB_SO_LOGS_MAX_LINES_LIMIT', 100); |
| 37 | } |
| 38 | |
| 39 | if (!defined('TENWEB_SO_DEBUG_MODE')) { |
| 40 | define('TENWEB_SO_DEBUG_MODE', false); //set this to true to enable logging in plugin |
| 41 | } |
| 42 | |
| 43 | if (!defined('TENWEB_CACHE_ALLOWED_DIR_SIZE_IN_BYTES')) { |
| 44 | //MAX Allowed size 1GB |
| 45 | define('TENWEB_CACHE_ALLOWED_DIR_SIZE_IN_BYTES', 1000000000); |
| 46 | } |
| 47 | |
| 48 | if (!defined('TENWEB_CACHE_STRUCTURE_ALLOWED_SIZE')) { |
| 49 | //MAX Allowed size 5GB |
| 50 | define('TENWEB_CACHE_STRUCTURE_ALLOWED_SIZE', 4882813); |
| 51 | } |
| 52 | |
| 53 | if (!function_exists('get_plugins')) { |
| 54 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 55 | } |
| 56 | |
| 57 | if (!defined('TWO_NOT_OPTIMIZED_STATUS_LIST')) { |
| 58 | define('TWO_NOT_OPTIMIZED_STATUS_LIST', [404, 403, 500, 502, 504]); |
| 59 | } |
| 60 | |
| 61 | $tenweb_so_mu_plugins = get_mu_plugins(); |
| 62 | define('TENWEB_SO_HOSTED_ON_10WEB', isset($tenweb_so_mu_plugins['tenweb-init.php'])); |
| 63 | define('TENWEB_SO_HOSTED_ON_NGINX', TENWEB_SO_HOSTED_ON_10WEB || (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower(sanitize_text_field($_SERVER['SERVER_SOFTWARE'])), 'nginx') !== false)); |
| 64 | |
| 65 | if (!function_exists('get_home_path')) { |
| 66 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
| 67 | } |
| 68 | // phpcs:disable WordPressVIPMinimum.Functions.RestrictedFunctions |
| 69 | $tw_is_htaccess_writable = (file_exists(get_home_path() . '.htaccess') && is_writable(get_home_path() . '.htaccess')) |
| 70 | || (!file_exists(get_home_path() . '.htaccess') && file_exists(get_home_path()) && is_writable(get_home_path())); |
| 71 | // phpcs:enable |
| 72 | define('TENWEB_SO_HTACCESS_WRITABLE', $tw_is_htaccess_writable); |
| 73 | |
| 74 | if (!defined('TENWEB_SO_PAGE_CACHE_DIR')) { |
| 75 | define('TENWEB_SO_PAGE_CACHE_DIR', WP_CONTENT_DIR . '/cache/tw_optimize/page_cache/'); |
| 76 | } |
| 77 | |
| 78 | global $two_incompatible_plugin_list; |
| 79 | |
| 80 | require_once __DIR__ . '/env.php'; |
| 81 |