/** * Formats custom URL * * @param array $files * @param string $type * @return array */ function get_minify_url_for_files($files, $type) { $minify_filename = Minify_Core::urls_for_minification_to_minify_filename($files, $type); if (is_null($minify_filename)) { return null; } $url = Minify_Core::minified_url($minify_filename); $url = Util_Environment::url_to_maybe_https($url); return $url; }
/** * Checks rewrite * * @throws Util_Environment_Exceptions */ private function verify_rewrite_working() { $url = Minify_Core::minified_url(rand() . 'w3tc_rewrite_test.css'); $result = $this->test_rewrite($url); if ($result != 'ok') { $home_url = get_home_url(); $tech_message = (Util_Environment::is_nginx() ? 'nginx configuration file' : '.htaccess file') . ' contains rules to rewrite url ' . $url . '. If handled by ' . 'plugin, it returns "OK" message.<br/>'; $tech_message .= 'The plugin made a request to ' . $url . ' but received: <br />' . $result . '<br />'; $tech_message .= 'instead of "OK" response. <br />'; $error = '<strong>W3 Total Cache error:</strong>It appears Minify ' . '<acronym title="Uniform Resource Locator">URL</acronym> ' . 'rewriting is not working. '; if (Util_Environment::is_nginx()) { $error .= 'Please verify that all configuration files are ' . 'included in the configuration file ' . '(and that you have reloaded / restarted nginx).'; } else { $error .= 'Please verify that the server configuration ' . 'allows .htaccess'; } $error .= '<br />Unfortunately minification will ' . 'not function without custom rewrite rules. ' . 'Please ask your server administrator for assistance. ' . 'Also refer to <a href="' . admin_url('admin.php?page=w3tc_install') . '">the install page</a> for the rules for your server.'; throw new Util_Environment_Exception($error, $tech_message); } }