Файловый менеджер - Редактировать - /home/digilove/public_html/plugins/system/aimyspeedoptimization/HtaccessHelper.php
Назад
<?php /* * Copyright (c) 2017-2024 Aimy Extensions, Netzum Sorglos Software GmbH * Copyright (c) 2015-2017 Aimy Extensions, Lingua-Systems Software GmbH * * https://www.aimy-extensions.com/ * * License: GNU GPLv2, see LICENSE.txt within distribution and/or * https://www.aimy-extensions.com/software-license.html */ defined( '_JEXEC' ) or die(); jimport( 'joomla.filesystem.file' ); use Joomla\CMS\Filesystem\File; abstract class AimySpeedOptimizationHtaccessHelper { static private $mark_start = '# Aimy Speed Optimization START -- keep this line!'; static private $mark_end = '# Aimy Speed Optimization END -- keep this line!'; static public function cleanup() { $c = self::get_contents(); $re = '/\s*' . self::$mark_start . '.*?' . self::$mark_end . '\s*/s'; if ( preg_match( $re, $c, $m ) ) { $c = str_replace( $m[0], "\n", $c ); if ( @File::write( self::get_path(), $c ) === false ) { throw new RuntimeException( self::get_error() ); } } } static public function modify( $to_state ) { if ( empty( $to_state ) ) { return; } $to_states = explode( '+', $to_state ); $c = self::get_contents(); $c .= "\n\n" . self::$mark_start . "\n\n"; $dir = JPATH_ROOT . '/media/plg_aimyspeedoptimization'; foreach ( $to_states as $state ) { $path = $dir . '/' . 'htaccess-' . basename( $state ) . '.txt'; if ( ! File::exists( $path ) ) { throw new RuntimeException( 'No htaccess data for ' . $state ); } $s = @file_get_contents( $path ); if ( $s === false ) { throw new RuntimeException( self::get_error() ); } $c .= $s; } $c .= "\n" . self::$mark_end . "\n\n"; if ( @File::write( self::get_path(), $c ) === false ) { throw new RuntimeException( self::get_error() ); } } static public function get_contents() { $c = @file_get_contents( self::get_path() ); if ( $c === false ) { throw new RuntimeException( self::get_error() ); } return $c; } static public function get_path() { return JPATH_ROOT . '/' . '.htaccess'; } static public function htaccess_exists() { return file_exists( self::get_path() ); } static private function get_error() { $e = error_get_last(); if ( ! is_array( $e ) ) { return 'Unknown error'; } return $e[ 'message' ]; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка