PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.6.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.6.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / webp / class-wpo-htaccess-capabilities.php

class-wpo-htaccess-capabilities.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.6.0, at webp/class-wpo-htaccess-capabilities.php

63 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('WPO_PLUGIN_MAIN_PATH')) die('No direct access allowed');
4
5 require_once(WPO_PLUGIN_MAIN_PATH . 'vendor/autoload.php');
6 use HtaccessCapabilityTester\HtaccessCapabilityTester;
7
8 class WPO_Htaccess_Capabilities {
9
10 private static $_instance = null;
11
12 /**
13 * Tests and sets up server's htacess capabilities as properties
14 */
15 public function __construct() {
16 $uploads = wp_upload_dir();
17 $this->hct = new HtaccessCapabilityTester($uploads['basedir'] . '/wpo', $uploads['baseurl'] . '/wpo');
18 $this->htaccess_enabled = $this->hct->htaccessEnabled();
19 $this->mod_headers = $this->get_mod_header_status();
20 $this->mod_mime = $this->get_mod_mime_status();
21 $this->mod_rewrite = $this->get_mod_rewrite_status();
22 }
23
24 /**
25 * Gets singleton instance
26 *
27 * @return object
28 */
29 public static function get_instance() {
30 if (null === self::$_instance) {
31 self::$_instance = new WPO_Htaccess_Capabilities();
32 }
33 return self::$_instance;
34 }
35
36 /**
37 * Gets `mod_headers` status by checking if it is loaded and working
38 *
39 * @return bool
40 */
41 public function get_mod_header_status() {
42 return (true === $this->hct->moduleLoaded('headers') && true === $this->hct->headerSetWorks());
43 }
44
45 /**
46 * Gets `mod_mime` status by checking if it is loaded and working
47 *
48 * @return bool
49 */
50 public function get_mod_mime_status() {
51 return (true === $this->hct->moduleLoaded('mime') && true === $this->hct->addTypeWorks());
52 }
53
54 /**
55 * Gets `mod_rewrite` status by checking if it is loaded and working
56 *
57 * @return bool
58 */
59 public function get_mod_rewrite_status() {
60 return (true === $this->hct->moduleLoaded('rewrite') && true == $this->hct->rewriteWorks());
61 }
62 }
63