* @param boolean $type Whether to enable or disable the rules. */ public function toggle_rules( $type = 1 ) { $this->set_htaccess_path(); ( 1 === $type ) ? $this->enable() : $this->disable(); } /** * Check if rule is enabled. * * @since 1.0.0 * * @return boolean True if the rule is enabled, false otherwise. */ public function is_enabled() { // Get the content of htaccess. $content = $this->wp_filesystem->get_contents( $this->path ); // Return the result. return preg_match( $this->rules['enabled'], $content ); } }