/* global SUI */ /** * External dependencies */ import React from 'react'; /** * WordPress dependencies */ const { __ } = wp.i18n; /** * Internal dependencies */ import Button from '../../components/sui-button'; import Notice from '../../components/sui-notice'; import { UserContext } from '../../context'; import SupportLink from '../../components/support-link'; import CodeSnippet from '../../components/sui-code-snippet'; import OrderedList from '../../components/ordered-list'; import Tabs from '../../components/sui-tabs'; import {createInterpolateElement} from "@wordpress/element"; /** * Server instructions component. */ export default class ServerInstructions extends React.Component { /** * Share UI actions need to be performed manually for elements. * They should be done in this method. */ componentDidMount() { ServerInstructions.initSUIcomponents(); } componentDidUpdate() { ServerInstructions.initSUIcomponents(); } static initSUIcomponents() { const el = document.getElementById( 'wphb-server-instructions-apache' ); if ( el ) { SUI.suiTabs( el.querySelector( '.sui-tabs' ) ); } const troubleshootLink = document.getElementById( 'troubleshooting-link' ); if ( troubleshootLink ) { troubleshootLink.addEventListener( 'click', ( e ) => { e.preventDefault(); jQuery( 'html, body' ).animate( { scrollTop: jQuery( '#troubleshooting-apache' ).offset() .top, }, 'slow' ); } ); } } /** * Render cache wrapper element. * * @return {*} Notice or success message. */ cacheWrap() { let classNames = 'sui-hidden'; if ( 'apache' === this.props.currentServer ) { classNames = ''; } const enableButton = this.props.htaccessWritten ? ( ) : ( ); const noticeText = createInterpolateElement(__('
We tried applying the .htaccess rules automatically but we weren’t able to. Make sure your file permissions on your .htaccess file are set to 644, or and apply the rules yourself.
', 'wphb'), { p: , button: }); return ({ __( 'If you are unable to get the automated method working you can copy the generated code below into your .htaccess file to activate GZip compression.', 'wphb' ) }
{ __( 'Troubleshooting', 'wphb' ) }
{ __( 'If .htaccess does not work, and you have access to vhosts.conf or httpd.conf try this:', 'wphb' ) }
{ __( 'For NGINX servers:', 'wphb' ) }
{ __( 'If you do not have access to your NGINX config files you will need to contact your hosting provider to make these changes.', 'wphb' ) }
{ __( 'For IIS 7 servers and above,', 'wphb' ) }{ ' ' }
{ __( 'Hummingbird can control your Cloudflare GZip compression settings from here. Simply add your Cloudflare API details and configure away', 'wphb' ) }