Current Path : /storage/v11800/affypharma/public_html/wp-content/plugins/w3-total-cache/

Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64

Upload File :
Current File : /storage/v11800/affypharma/public_html/wp-content/plugins/w3-total-cache/Minify_Environment.php
<?php
namespace W3TC;





/**
 * class Minify_Environment
 */
class Minify_Environment {
	public function __construct() {
		add_filter( 'w3tc_browsercache_rules_section',
			array( $this, 'w3tc_browsercache_rules_section' ),
			10, 3 );
	}

	/**
	 * Fixes environment in each wp-admin request
	 *
	 * @param Config  $config
	 * @param bool    $force_all_checks
	 *
	 * @throws Util_Environment_Exceptions
	 */
	public function fix_on_wpadmin_request( $config, $force_all_checks ) {
		$exs = new Util_Environment_Exceptions();

		$this->fix_folders( $config, $exs );

		if ( $config->get_boolean( 'config.check' ) || $force_all_checks ) {
			if ( $config->get_boolean( 'minify.enabled' ) &&
				Util_Rule::can_check_rules() &&
				$config->get_boolean( 'minify.rewrite' ) ) {
				$this->rules_core_add( $config, $exs );
			} else {
				$this->rules_core_remove( $exs );
			}

			if ( $config->get_boolean( 'minify.enabled' ) &&
				$config->get_string( 'minify.engine' ) == 'file' ) {
				$this->rules_cache_add( $config, $exs );
			} else {
				$this->rules_cache_remove( $exs );
			}
		}

		// if no errors so far - check if rewrite actually works
		if ( count( $exs->exceptions() ) <= 0 ) {
			try {
				if ( $config->get_boolean( 'minify.enabled' ) &&
					$config->get_boolean( 'minify.rewrite' ) &&
					$config->get_boolean( 'minify.debug' ) )
					$this->verify_rewrite_working();
			} catch ( \Exception $ex ) {
				$exs->push( $ex );
			}

			if ( $config->get_boolean( 'minify.enabled' ) )
				$this->verify_engine_working( $config, $exs );
		}

		if ( count( $exs->exceptions() ) > 0 )
			throw $exs;
	}

	/**
	 * Fixes environment once event occurs
	 *
	 * @param Config  $config
	 * @param string  $event
	 * @param null|Config $old_config
	 * @throws Util_Environment_Exceptions
	 */
	public function fix_on_event( $config, $event, $old_config = null ) {
		// Schedules events
		if ( $config->get_boolean( 'minify.enabled' ) &&
			$config->get_string( 'minify.engine' ) == 'file' ) {
			if ( $old_config != null &&
				$config->get_integer( 'minify.file.gc' ) !=
				$old_config->get_integer( 'minify.file.gc' ) ) {
				$this->unschedule();
			}

			if ( !wp_next_scheduled( 'w3_minify_cleanup' ) ) {
				wp_schedule_event( time(),
					'w3_minify_cleanup', 'w3_minify_cleanup' );
			}
		} else {
			$this->unschedule();
		}
	}

	/**
	 * Fixes environment after plugin deactivation
	 *
	 * @throws Util_Environment_Exceptions
	 */
	public function fix_after_deactivation() {
		$exs = new Util_Environment_Exceptions();

		$this->rules_core_remove( $exs );
		$this->rules_cache_remove( $exs );

		$this->unschedule();

		if ( count( $exs->exceptions() ) > 0 )
			throw $exs;
	}

	/**
	 *
	 *
	 * @param Config  $config
	 * @return array
	 */
	function get_required_rules( $config ) {
		if ( !$config->get_boolean( 'minify.enabled' ) )
			return null;

		$rewrite_rules = array();
		if ( $config->get_string( 'minify.engine' ) == 'file' ) {
			$minify_rules_cache_path = Util_Rule::get_minify_rules_cache_path();
			$rewrite_rules[] = array(
				'filename' => $minify_rules_cache_path,
				'content'  => $this->rules_cache_generate( $config )
			);
		}
		$minify_rules_core_path = Util_Rule::get_minify_rules_core_path();
		$rewrite_rules[] = array(
			'filename' => $minify_rules_core_path,
			'content'  => $this->rules_core_generate( $config ),
			'priority' => 1000
		);

		return $rewrite_rules;
	}



	/**
	 * Fixes folders
	 *
	 * @param Config  $config
	 * @param Util_Environment_Exceptions $exs
	 */
	private function fix_folders( $config, $exs ) {
		// folder that we delete if exists and not writeable
		if ( $config->get_boolean( 'minify.enabled' ) &&
			$config->get_string( 'minify.engine' ) == 'file' ) {
			$dir = W3TC_CACHE_MINIFY_DIR;

			try{
				if ( file_exists( $dir ) && !is_writeable( $dir ) )
					Util_WpFile::delete_folder( $dir, '', isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '' );
			} catch ( Util_WpFile_FilesystemRmdirException $ex ) {
				$exs->push( $ex );
			}
		}
	}

	/**
	 * Minifiers availability error handling
	 *
	 * @param Config  $config
	 * @param Util_Environment_Exceptions $exs
	 */
	private function verify_engine_working( $config, $exs ) {
		$minifiers_errors = array();

		if ( $config->get_string( 'minify.js.engine' ) == 'yuijs' ) {
			$path_java = $config->get_string( 'minify.yuijs.path.java' );
			$path_jar = $config->get_string( 'minify.yuijs.path.jar' );

			if ( !file_exists( $path_java ) ) {
				$minifiers_errors[] = sprintf( 'YUI Compressor (JS): JAVA executable path was not found. The default minifier JSMin will be used instead.' );
			} elseif ( !file_exists( $path_jar ) ) {
				$minifiers_errors[] = sprintf( 'YUI Compressor (JS): JAR file path was not found. The default minifier JSMin will be used instead.' );
			}
		}

		if ( $config->get_string( 'minify.css.engine' ) == 'yuicss' ) {
			$path_java = $config->get_string( 'minify.yuicss.path.java' );
			$path_jar = $config->get_string( 'minify.yuicss.path.jar' );

			if ( !file_exists( $path_java ) ) {
				$minifiers_errors[] = sprintf( 'YUI Compressor (CSS): JAVA executable path was not found. The default CSS minifier will be used instead.' );
			} elseif ( !file_exists( $path_jar ) ) {
				$minifiers_errors[] = sprintf( 'YUI Compressor (CSS): JAR file path was not found. The default CSS minifier will be used instead.' );
			}
		}

		if ( $config->get_string( 'minify.js.engine' ) == 'ccjs' ) {
			$path_java = $config->get_string( 'minify.ccjs.path.java' );
			$path_jar = $config->get_string( 'minify.ccjs.path.jar' );

			if ( !file_exists( $path_java ) ) {
				$minifiers_errors[] = sprintf( 'Closure Compiler: JAVA executable path was not found. The default minifier JSMin will be used instead.' );
			} elseif ( !file_exists( $path_jar ) ) {
				$minifiers_errors[] = sprintf( 'Closure Compiler: JAR file path was not found. The default minifier JSMin will be used instead.' );
			}
		}

		if ( count( $minifiers_errors ) ) {
			$minify_error = 'The following minifiers cannot be found or are no longer working:</p><ul>';

			foreach ( $minifiers_errors as $minifiers_error ) {
				$minify_error .= '<li>' . $minifiers_error . '</li>';
			}

			$minify_error .= '</ul><p>This message will automatically disappear once the issue is resolved.';

			$exs->push( new Util_Environment_Exception( $minify_error ) );
		}
	}

	/**
	 * 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 "Minify OK" message.<br/>';
			$tech_message .= 'The plugin made a request to ' .
				$url . ' but received: <br />' .
				$result . '<br />';
			$tech_message .= 'instead of "Minify 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 );
		}
	}

	/**
	 * Perform rewrite test
	 *
	 * @param string  $url
	 * @return boolean
	 */
	private function test_rewrite( $url ) {
		$key = sprintf( 'w3tc_rewrite_test_%s', substr( md5( $url ), 0, 16 ) );
		$result = get_site_transient( $key );

		if ( $result != 'ok' ) {
			$response = Util_Http::get( $url );

			$is_ok = ( !is_wp_error( $response ) &&
				$response['response']['code'] == 200 &&
				trim( $response['body'] ) == 'Minify OK' );

			if ( $is_ok )
				$result = 'ok';
			else {
				if ( is_wp_error( $response ) )
					$result = $response->get_error_message();
				else {
					$result = '<pre>' .
						print_r( $response['response'], true ) .
						'</pre>';
				}
			}

			set_site_transient( $key, $result, 30 );
		}

		return $result;
	}



	/**
	 * scheduling stuff
	 */
	private function unschedule() {
		if ( wp_next_scheduled( 'w3_minify_cleanup' ) ) {
			wp_clear_scheduled_hook( 'w3_minify_cleanup' );
		}
	}



	/**
	 * rules core modification
	 */

	/**
	 * Writes directives to WP .htaccess
	 *
	 * @throws Util_WpFile_FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
	 */
	private function rules_core_add( $config, $exs ) {

		Util_Rule::add_rules( $exs, Util_Rule::get_minify_rules_core_path(),
			$this->rules_core_generate( $config ),
			W3TC_MARKER_BEGIN_MINIFY_CORE,
			W3TC_MARKER_END_MINIFY_CORE,
			array(
				W3TC_MARKER_BEGIN_PGCACHE_CORE => 0,
				W3TC_MARKER_BEGIN_WORDPRESS => 0,
				W3TC_MARKER_END_BROWSERCACHE_CACHE => strlen( W3TC_MARKER_END_BROWSERCACHE_CACHE ) + 1,
				W3TC_MARKER_END_PGCACHE_CACHE => strlen( W3TC_MARKER_END_PGCACHE_CACHE ) + 1,
				W3TC_MARKER_END_MINIFY_CACHE => strlen( W3TC_MARKER_END_MINIFY_CACHE ) + 1
			)
		);
	}

	/**
	 * Removes Page Cache core directives
	 *
	 * @param Util_Environment_Exceptions $exs
	 * @throws Util_WpFile_FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
	 */
	private function rules_core_remove( $exs ) {
		// no need to remove rules for apache - its in cache .htaccess file
		if ( !Util_Environment::is_nginx() )
			return;

		Util_Rule::remove_rules( $exs,
			Util_Rule::get_minify_rules_core_path(),
			W3TC_MARKER_BEGIN_MINIFY_CORE ,
			W3TC_MARKER_END_MINIFY_CORE );
	}

	/**
	 * Generates rules for WP dir
	 *
	 * @param Config  $config
	 * @return string
	 */
	public function rules_core_generate( $config ) {
		switch ( true ) {
		case Util_Environment::is_apache():
		case Util_Environment::is_litespeed():
			return $this->rules_core_generate_apache( $config );

		case Util_Environment::is_nginx():
			return $this->rules_core_generate_nginx( $config );
		}

		return '';
	}

	private function site_uri() {
		$site_uri = rtrim( network_site_url( '', 'relative' ), '/' ) . '/';

		/* There is a bug in WP where network_home_url can return
		 * a non-relative URI even though scheme is set to relative.
		 */
		if ( Util_Environment::is_url( $site_uri ) ) {
			$site_uri = parse_url( $site_uri, PHP_URL_PATH );
		}

		return $site_uri;
	}

	/**
	 * Generates rules
	 *
	 * @param Config  $config
	 * @return string
	 */
	function rules_core_generate_apache( $config ) {
		$cache_uri = Util_Environment::url_to_uri(
			Util_Environment::filename_to_url( W3TC_CACHE_MINIFY_DIR ) ) . '/';
		$site_uri = $this->site_uri();

		/* There is a bug in WP where network_home_url can return
		 * a non-relative URI even though scheme is set to relative.
		 */
		if ( Util_Environment::is_url( $site_uri ) ) {
			$site_uri = parse_url( $site_uri, PHP_URL_PATH );
		}

		$engine = $config->get_string( 'minify.engine' );
		$browsercache = $config->get_boolean( 'browsercache.enabled' );
		$brotli = ( $browsercache &&
			$config->get_boolean( 'browsercache.cssjs.brotli' ) &&
			!defined( 'W3TC_PAGECACHE_OUTPUT_COMPRESSION_OFF' ) );
		$compression = ( $browsercache &&
			$config->get_boolean( 'browsercache.cssjs.compression' ) &&
			!defined( 'W3TC_PAGECACHE_OUTPUT_COMPRESSION_OFF' ) );

		$rules = '';
		$rules .= W3TC_MARKER_BEGIN_MINIFY_CORE . "\n";
		$rules .= "<IfModule mod_rewrite.c>\n";
		$rules .= "    RewriteEngine On\n";
		$rules .= "    RewriteBase " . $cache_uri . "\n";

		if ( $engine == 'file' ) {
			if ( $brotli ) {
				$rules .= "    RewriteCond %{HTTP:Accept-Encoding} br\n";
				$rules .= "    RewriteRule .* - [E=APPEND_EXT:_br]\n";
				$rules .= "    RewriteCond %{REQUEST_FILENAME}%{ENV:APPEND_EXT} -" . ( $config->get_boolean( 'minify.file.nfs' ) ? 'F' : 'f' ) . "\n";
				$rules .= "    RewriteRule (.*) $1%{ENV:APPEND_EXT} [L]\n";
			}
			if ( $compression ) {
				$rules .= "    RewriteCond %{HTTP:Accept-Encoding} gzip\n";
				$rules .= "    RewriteRule .* - [E=APPEND_EXT:_gzip]\n";
				$rules .= "    RewriteCond %{REQUEST_FILENAME}%{ENV:APPEND_EXT} -" . ( $config->get_boolean( 'minify.file.nfs' ) ? 'F' : 'f' ) . "\n";
				$rules .= "    RewriteRule (.*) $1%{ENV:APPEND_EXT} [L]\n";
			}
			if ( !$brotli && !$compression ) {
				$rules .= "    RewriteCond %{REQUEST_FILENAME} !-f\n";
			}
		}
		$rules .= "    RewriteRule ^(.+\\.(css|js))$ {$site_uri}index.php [L]\n";

		$rules .= "</IfModule>\n";
		$rules .= W3TC_MARKER_END_MINIFY_CORE . "\n";

		return $rules;
	}

	/**
	 * Generates rules
	 *
	 * @param Config  $config
	 * @return string
	 */
	function rules_core_generate_nginx( $config ) {
		$cache_uri = Util_Environment::url_to_uri(
			Util_Environment::filename_to_url( W3TC_CACHE_MINIFY_DIR ) ) . '/';
		$first_regex_var = '$1';

		// for subdir - need to count subdir in url
		if ( Util_Environment::is_wpmu() && !Util_Environment::is_wpmu_subdomain() ) {
			// take into accont case when whole subdir wpmu is installed in subdir
			$home_uri = network_home_url( '', 'relative' );
			if ( substr( $cache_uri, 0, strlen( $home_uri ) ) == $home_uri )
				$cache_uri = $home_uri . '([a-z0-9]+/)?' .
					substr( $cache_uri, strlen( $home_uri ) );
			else
				$cache_uri = '(/[a-z0-9]+)?' . $cache_uri;

			$first_regex_var = '$2';
		}

		$minify_uri = $this->site_uri();

		$engine = $config->get_string( 'minify.engine' );
		$browsercache = $config->get_boolean( 'browsercache.enabled' );
		$brotli = ( $browsercache &&
			$config->get_boolean( 'browsercache.cssjs.brotli' ) &&
			!defined( 'W3TC_PAGECACHE_OUTPUT_COMPRESSION_OFF' ) );
		$compression = ( $browsercache &&
			$config->get_boolean( 'browsercache.cssjs.compression' ) &&
			!defined( 'W3TC_PAGECACHE_OUTPUT_COMPRESSION_OFF' ) );

		$rules = '';
		$rules .= W3TC_MARKER_BEGIN_MINIFY_CORE . "\n";

		if ( $engine == 'file' ) {
			$rules .= "set \$w3tc_enc \"\";\n";

			if ( $brotli ) {
				$rules .= "if (\$http_accept_encoding ~ br) {\n";
				$rules .= "    set \$w3tc_enc _br;\n";
				$rules .= "}\n";
			}

			if ( $compression ) {
				$rules .= "if (\$http_accept_encoding ~ gzip) {\n";
				$rules .= "    set \$w3tc_enc _gzip;\n";
				$rules .= "}\n";
			}

			$rules .= "if (-f \$request_filename\$w3tc_enc) {\n";
			$rules .= "    rewrite (.*) $1\$w3tc_enc break;\n";
			$rules .= "}\n";
		}
		$rules .= "rewrite ^$cache_uri {$minify_uri}index.php last;\n";
		$rules .= W3TC_MARKER_END_MINIFY_CORE . "\n";

		return $rules;
	}



	/*
	 * cache rules
	 */

	/**
	 * Writes directives to file cache .htaccess
	 * Throws exception on error
	 *
	 * @param Config  $config
	 * @param Util_Environment_Exceptions $exs
	 */
	private function rules_cache_add( $config, $exs ) {
		Util_Rule::add_rules( $exs,
			Util_Rule::get_minify_rules_cache_path(),
			$this->rules_cache_generate( $config ),
			W3TC_MARKER_BEGIN_MINIFY_CACHE,
			W3TC_MARKER_END_MINIFY_CACHE,
			array(
				W3TC_MARKER_BEGIN_PGCACHE_CACHE => 0,
				W3TC_MARKER_BEGIN_BROWSERCACHE_CACHE => 0,
				W3TC_MARKER_BEGIN_MINIFY_CORE => 0,
				W3TC_MARKER_BEGIN_PGCACHE_CORE => 0,
				W3TC_MARKER_BEGIN_WORDPRESS => 0
			)
		);
	}

	/**
	 * Removes Page Cache core directives
	 *
	 * @param Util_Environment_Exceptions $exs
	 * @throws Util_WpFile_FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
	 */
	private function rules_cache_remove( $exs ) {
		// apache's cache files are not used when core rules disabled
		if ( !Util_Environment::is_nginx() )
			return;

		Util_Rule::remove_rules( $exs,
			Util_Rule::get_minify_rules_cache_path(),
			W3TC_MARKER_BEGIN_MINIFY_CACHE,
			W3TC_MARKER_END_MINIFY_CACHE );

	}

	/**
	 * Generates directives for file cache dir
	 *
	 * @param Config  $config
	 * @return string
	 */
	private function rules_cache_generate( $config ) {
		switch ( true ) {
		case Util_Environment::is_apache():
		case Util_Environment::is_litespeed():
			return $this->rules_cache_generate_apache( $config );

		case Util_Environment::is_nginx():
			return $this->rules_cache_generate_nginx( $config );
		}

		return '';
	}


	/**
	 * Generates directives for file cache dir
	 *
	 * @param Config  $config
	 * @return string
	 */
	private function rules_cache_generate_apache( $config ) {
		$browsercache = $config->get_boolean( 'browsercache.enabled' );
		$brotli = ( $browsercache && $config->get_boolean( 'browsercache.cssjs.brotli' ) );
		$compression = ( $browsercache && $config->get_boolean( 'browsercache.cssjs.compression' ) );
		$expires = ( $browsercache && $config->get_boolean( 'browsercache.cssjs.expires' ) );
		$lifetime = ( $browsercache ? $config->get_integer( 'browsercache.cssjs.lifetime' ) : 0 );
		$cache_control = ( $browsercache && $config->get_boolean( 'browsercache.cssjs.cache.control' ) );
		$etag = ( $browsercache && $config->get_integer( 'browsercache.html.etag' ) );
		$w3tc = ( $browsercache && $config->get_integer( 'browsercache.cssjs.w3tc' ) );
		$compatibility = $config->get_boolean( 'pgcache.compatibility' );

		$rules = '';
		$rules .= W3TC_MARKER_BEGIN_MINIFY_CACHE . "\n";
		// workaround for .gzip
		if ( $compatibility ) {
			$rules .= "Options -MultiViews\n";
		}

		if ( $etag ) {
			$rules .= "FileETag MTime Size\n";
		}

		if ( $brotli ) {
			$rules .= "<IfModule mod_mime.c>\n";
			$rules .= "    AddType text/css .css_br\n";
			$rules .= "    AddEncoding br .css_br\n";
			$rules .= "    AddType application/x-javascript .js_br\n";
			$rules .= "    AddEncoding br .js_br\n";
			$rules .= "</IfModule>\n";
			$rules .= "<IfModule mod_deflate.c>\n";
			$rules .= "    <IfModule mod_setenvif.c>\n";
			$rules .= "        SetEnvIfNoCase Request_URI \\.css_br$ no-brotli\n";
			$rules .= "        SetEnvIfNoCase Request_URI \\.js_br$ no-brotli\n";
			$rules .= "    </IfModule>\n";
			$rules .= "</IfModule>\n";
		}

		if ( $compression ) {
			$rules .= "<IfModule mod_mime.c>\n";
			$rules .= "    AddType text/css .css_gzip\n";
			$rules .= "    AddEncoding gzip .css_gzip\n";
			$rules .= "    AddType application/x-javascript .js_gzip\n";
			$rules .= "    AddEncoding gzip .js_gzip\n";
			$rules .= "</IfModule>\n";
			$rules .= "<IfModule mod_deflate.c>\n";
			$rules .= "    <IfModule mod_setenvif.c>\n";
			$rules .= "        SetEnvIfNoCase Request_URI \\.css_gzip$ no-gzip\n";
			$rules .= "        SetEnvIfNoCase Request_URI \\.js_gzip$ no-gzip\n";
			$rules .= "    </IfModule>\n";
			$rules .= "</IfModule>\n";
		}

		if ( $expires ) {
			$rules .= "<IfModule mod_expires.c>\n";
			$rules .= "    ExpiresActive On\n";
			$rules .= "    ExpiresByType text/css A" . $lifetime . "\n";
			$rules .= "    ExpiresByType application/x-javascript A" . $lifetime . "\n";
			$rules .= "</IfModule>\n";
		}

		if ( $w3tc || $brotli || $compression || $cache_control ) {
			$rules .= "<IfModule mod_headers.c>\n";

			if ( $w3tc ) {
				$rules .= "    Header set X-Powered-By \"" .
					Util_Environment::w3tc_header() . "\"\n";
			}

			if ( $brotli || $compression ) {
				$rules .= "    Header set Vary \"Accept-Encoding\"\n";
			}

			if ( $cache_control ) {
				$cache_policy = $config->get_string( 'browsercache.cssjs.cache.policy' );

				switch ( $cache_policy ) {
				case 'cache':
					$rules .= "    Header set Pragma \"public\"\n";
					$rules .= "    Header set Cache-Control \"public\"\n";
					break;

				case 'cache_public_maxage':
					$rules .= "    Header set Pragma \"public\"\n";

					if ( $expires ) {
						$rules .= "    Header append Cache-Control \"public\"\n";
					} else {
						$rules .= "    Header set Cache-Control \"max-age=" . $lifetime . ", public\"\n";
					}
					break;

				case 'cache_validation':
					$rules .= "    Header set Pragma \"public\"\n";
					$rules .= "    Header set Cache-Control \"public, must-revalidate, proxy-revalidate\"\n";
					break;

				case 'cache_noproxy':
					$rules .= "    Header set Pragma \"public\"\n";
					$rules .= "    Header set Cache-Control \"private, must-revalidate\"\n";
					break;

				case 'cache_maxage':
					$rules .= "    Header set Pragma \"public\"\n";

					if ( $expires ) {
						$rules .= "    Header append Cache-Control \"public, must-revalidate, proxy-revalidate\"\n";
					} else {
						$rules .= "    Header set Cache-Control \"max-age=" . $lifetime . ", public, must-revalidate, proxy-revalidate\"\n";
					}
					break;

				case 'no_cache':
					$rules .= "    Header set Pragma \"no-cache\"\n";
					$rules .= "    Header set Cache-Control \"max-age=0, private, no-store, no-cache, must-revalidate\"\n";
					break;
				}
			}

			$rules .= "</IfModule>\n";
		}

		$rules .= W3TC_MARKER_END_MINIFY_CACHE . "\n";

		return $rules;
	}

	/**
	 * Generates directives for file cache dir
	 *
	 * @param Config  $config
	 * @return string
	 */
	private function rules_cache_generate_nginx( $config ) {
		$cache_uri = Util_Environment::url_to_uri(
			Util_Environment::filename_to_url( W3TC_CACHE_MINIFY_DIR ) ) . '/';

		$browsercache = $config->get_boolean( 'browsercache.enabled' );
		$brotli = ( $browsercache && $config->get_boolean( 'browsercache.cssjs.brotli' ) );
		$gzip = ( $browsercache && $config->get_boolean( 'browsercache.cssjs.compression' ) );

		$rules = '';
		$rules .= W3TC_MARKER_BEGIN_MINIFY_CACHE . "\n";

		$common_rules_a = Dispatcher::nginx_rules_for_browsercache_section(
			$config, 'cssjs', true );
		$common_rules_a[] = 'add_header Vary "Accept-Encoding";';

		$common_rules = '    ' . implode( "\n    ", $common_rules_a ) . "\n";

		if ( $brotli ) {
			$rules .= "location ~ " . $cache_uri . ".*js_br$ {\n";
			$rules .= "    brotli off;\n";
			$rules .= "    types {}\n";
			$rules .= "    default_type application/x-javascript;\n";
			$rules .= "    add_header Content-Encoding br;\n";
			$rules .= $common_rules;
			$rules .= "}\n";

			$rules .= "location ~ " . $cache_uri . ".*css_br$ {\n";
			$rules .= "    brotli off;\n";
			$rules .= "    types {}\n";
			$rules .= "    default_type text/css;\n";
			$rules .= "    add_header Content-Encoding br;\n";
			$rules .= $common_rules;
			$rules .= "}\n";
		}

		if ( $gzip ) {
			$rules .= "location ~ " . $cache_uri . ".*js_gzip$ {\n";
			$rules .= "    gzip off;\n";
			$rules .= "    types {}\n";
			$rules .= "    default_type application/x-javascript;\n";
			$rules .= "    add_header Content-Encoding gzip;\n";
			$rules .= $common_rules;
			$rules .= "}\n";

			$rules .= "location ~ " . $cache_uri . ".*css_gzip$ {\n";
			$rules .= "    gzip off;\n";
			$rules .= "    types {}\n";
			$rules .= "    default_type text/css;\n";
			$rules .= "    add_header Content-Encoding gzip;\n";
			$rules .= $common_rules;
			$rules .= "}\n";
		}

		$rules .= W3TC_MARKER_END_MINIFY_CACHE . "\n";

		return $rules;
	}

	public function w3tc_browsercache_rules_section( $section_rules, $config, $section ) {
		if ( Util_Environment::is_litespeed() ) {
			$o = new Minify_Environment_LiteSpeed( $config );
			$section_rules = $o->w3tc_browsercache_rules_section(
				$section_rules, $section );
		}
		return $section_rules;
	}
}

ESTRELLA Pharma – Affy Pharma Pvt Ltd

TREPODOX

POWDER FOR ORAL SUSPENSION
30ML (HDPE BOTTLE)

Composition

Cefpodoxime 50mg/5ml

Indications & Uses

UTIs, LRTs

TREPODOX – CV

POWDER FOR ORAL SUSPENSION
30ML (GLASS BOTTLE)

Composition

Cefpodoxime 50mg + Potassium Clavulanate 31.25mg/ 5ml

Indications & Uses

Upper & lower respiratory infections, Uncomplicated skin infections, Urinary Tract Infections

ESTY CLAV

POWDER FOR ORAL SUSPENSION
30ML (GLASS +HDPE BOTTLE)

Composition

Amoxycillin 200mg + Potassium clavulanate 28.50 mg/ 5ml

Indications & Uses

Community Acquired Pneumonia, Acute Exacerbations of Chronic Bronchitis, Upper Respiratory Tract Infections, Urinary Tract Infections

ESTRIXIME – CV

POWDER FOR ORAL SUSPENSION
30ML (GLASS BOTTLE)

Composition

Cefixime 50mg + Potassium clavulanate 31.25mg/5ml

Indications & Uses

Urinary Tract Inefctions, AECB, Otitis Media, Typhoid/p>

ESTRIXIME

POWDER FOR ORAL SUSPENSION
30ML (HDPE BOTTLE)

Composition

Cefixime 50mg/5ml

Indications & Uses

Urinary Tract Inefctions, Gastroenteritis

REOMELL

ORAL SUSPENSION
15 ml

Composition

Azithromycin 200mg/5ml

Indications & Uses

Community Acquired Pneumonia, Acute Exacerbations of Chronic Bronchitis,

TAMEST – DS

ORAL SUSPENSION
60 ml

Composition

Paracetamol 250mg/5ml

Indications & Uses

Fever, Pain

STREFEN

ORAL SUSPENSION
60 ml

Composition

Paracetamol 125mg + Mefenamic Acid 50mg/5ml

Indications & Uses

Pain, Fever

STREFOX

ORAL SUSPENSION
30 ml

Composition

Ofloxacin 50mg/5ml

Indications & Uses

Acute exacerbations of chronic Bronchitis, Diarrhoea

TAMACET-P

SYRUP
60 ml

Composition

Paracetamol 125mg + PPH 5mg + Cetirizine HCI 2mg/5ml

Indications & Uses

Fever, common cold & Flu

HEPTRELL

ORAL SUSPENSION
200ml

Composition

Cyproheptadine HCI 2mg + Tricholine citrate 0.275mg/5ml

Indications & Uses

Stimulate Apetite, Induces Weight Gain, Cure Allergies

TREP-DSR

CAPSULES ( HARD GELATIN)
10X10 (Alu-Alu)

Composition

Pantoprazole 40mg (EC) + Domperidone 30mg (SR)

Indications & Uses

GERD, Dyspepsia, Acid Peptic Disorders, Gastritis

RALE-DSR

CAPSULES ( HARD GELATIN)
11X10 (Alu-Alu)

Composition

Rabeprazole 20mg (EC) + Domperidone SR

Indications & Uses

GERD, Dyspepsia, Acid Peptic Disorders, Gastritis

STRETOP-40

INJECTION
40ml

Composition

Pantoprazole Sodium 40mg + NaCL

Indications & Uses

Acid-peptic disorders in hospitalized patients, Zollinger – Ellison Syndrome, Treatment of GERD Associated with Erasive Esophagitis, GL Bleed

DIMACID

SUSPENSION
170ml

Composition

Activated Dimethicone 25mg + Magnesium Hydroxide 200mg+ Aluminium Hydroxide Gel 200mg/10ml

Indications & Uses

Heartburn, Acid Indigestion

ELLAZYME

SYRUP
200ml

Composition

Alpha Amylase (1:2000) 50mg, Pepsin(1:3000) 10mg/5ml

Indications & Uses

Dyspepsia, Flatulence, Anorexia, Pancreatic Insufficiency

ARBOLL-Z

CAPSULES (HARD GELATIN)
10X3X10

Composition

Vitamin C 75mg + Vitamin B12 5mcg + Carbonyl Iron 100mg + Folic Acid 1.5mg + Zinc Sulphate 61.8mg

Indications & Uses

Hyphocromic Anemia in Pregnancy, Chronic and / or Acute Blood Loss, Post-gynaesurgery, Iron Deficiency Anemia

EST-D3 60K

CAPSULES (SOFT GELATIN)
10X1X4

Composition

Cholecalciferol 60000 UI

Indications & Uses

Osteoporosis, Osteoarthritis, Musculoskeletal Pain, Type- 2 Diabetes, Menstrual Irregularities, Pre-eclampsia, IUGR

STREBONA

ORAL SUSPENSION
200ml

Composition

Calcium Carbonate 625mg, Vitamin D3 125 IU/5ml

Indications & Uses

Osteomalacia, Osteoporosis, Fractures, Premenstrual Syndrome

STREFE-III

SYRUP (IRON TONIC)
300 ml

Composition

Iron (III) Hydroxide Polymaltose 50mg, Folic Acid 0.5mg/15ml

Indications & Uses

Pregnancy and lactation, Iron Deficiency Anaemia, Anaemia due to Excessive Haemorrhage, Anaemia Associated with Infections and Malignant Disease

STRECIUM

CAPSULES (SOFT GELATIN)
5X2X15

Composition

Calcitriol 0.25mcg + Calcium Carbonate 500mg + Zinc Sulphate 7.5mg

Indications & Uses

Osteoporosis, Hypoparathyroidism, Pregnancy & Lactation, Premenstrual Syndrome

ESTRE-SPAS

TABLETS
20X10

Composition

Mefenamic Acid 250mg + Dicyclomine HCI 10mg

Indications & Uses

Dysmenorrhea, Irritable Bowel Syndrome, Colic and Bladder Spasm, Abdominal Pain

TAMEST-A

TABLETS (BLISTERS)
20X10

Composition

Nimeulide 100mg + Paracetamo; 325mg

Indications & Uses

Arthritis Pain, Soft Tissue Trauma Including Sprains, Musculoskeletal Pain, Pain Following Dental Extraction

PARTRA FORTE

TABLETS

20X10

Composition

Tramadol 37.5mg + Paracetamol 325mg

Indications & Uses

Chronic Back Pain, Osteoarthritis, Postoperative Pain

UMRELY GEL

GEL
30g

Composition

Diclofenac Diethylamine 1.16% w/w + Oleum Linseed Oil 3 % w/w + Menthol 5% w/w +Methyl Salicylate 10% w/w

Indications & Uses

Sprains & Strains, Lower Back Pain, Joint Pain, Knee Pain

MOISTACT

CREAM
20g

Composition

Urea 10% +Lactic Acid 10% + Propylene Glycol 10% + Liquid Paraffin 10%

Indications & Uses

Foot Cracks, Keratolytic

BELODIP

OINTMENT
15g

Composition

Clotrimazole 1% w/w + Beclomethasone Dipropionate 0.025% w/w + Neomycin 0.5% w/w

Indications & Uses

Eczema, Psoriasis, Corticosteroid Responsive Dermatoses

MIN-DAND

LOTION
100 ml

Composition

Ketoconazole 2% w/v

Indications & Uses

Pityriasis, Dandruff

MIN-DAND-Z

LOTION
100 ml

Composition

Ketoconazole Shampoo 2% w/v + ZPTO 1% w/v

Indications & Uses

Pityriasis, Dandruff

MIN-DAND

SOAP
75g

Composition

Ketoconazole 1% w/w

Indications & Uses

Tinea Versicolor, Prophylaxis of Pityriasis Versicolor

FLUTRELLA

TABLETS
20X1X1

Composition

Fluconazole 200mg

Indications & Uses

Vaginal Candidiasis, Brochopulmonary Infections, Candiduria, Tinea Pedis, Corposis, Cruris, Versicolor

ESTRAVIT

SYRUP
200ml

Composition

L-Iysine HCI 25mg + Vitamin B1 2.5mg + Vitamin B2 2.5mg + Vitamin B6 0.75mg + D-panthenol 3mg +Niacinamide 25mg + Mecobalamin 2mcg/10ml

Indications & Uses

Sub-optimal Growth, Poor Weight Gain, Malnutrition, Prolonged Illness

LYCOSTER PLUS

SYRUP
225ml

Composition

Each 10ml Contains: Lycopene 6% 1000mcg + Vitamin A Palmitate 2500 IU + Vitamin E 10 IU + Ascorbic Acid 50mg + Selenium (as Sodium Selenate) 35mcg + Zinc (As Zinc Gluconate) 3mg + Manganese (as Manganese Gluconate) 2mg + Iodine ( As Potassium Iodine) 100mcg + Copper (As Copper Sulphate0 500mcg + Thiamine HCI 2mg + Riboflavine 3mg + Pyridoxine HCI 1.5mg

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

OSERON

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Antioxidant, Multivitamin & Multiminerals

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

GERMELLA

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Vitamin E (Natural) 400 IU + Wheat Germ Oil 100mg + Omega 3 Fatty Acids 30mg

Indications & Uses

Ulcerative colitis, Metabolic Syndrome, Rheumatoid Arthritis, Type-2 Diabetes, Cardiovascular Diseases

LYCOSTER GOLD

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Each SG Contains Lycopene 6% 2000 IU + Vitamin A 2500 IU + Vitamin E Acetate 10 IU + Vitamin C 50 mg + Zinc sulphate Monohydrate 27.45mg + Selenium Dioxide 70mcg

Indications & Uses

Idiopathic Male Infertility, Pre-eclampsia, Prostate Cancer, Cardiovascular Diseases, Diabetes Mellitus

OSERON -G

CAPSULES (SOFT GELATIN)
10X1X11

Composition

Ginseng + Multivitamin + Multimineral

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

OSERON -G

CAPSULES (SOFT GELATIN)
10X1X11

Composition

Ginseng + Multivitamin + Multimineral

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

ESTRIXIME-200 LB

TABLETS (Alu-Alu)
20X10

Composition

Cefixime 200mg + Lactic Acid Bacilus 2.5 billion spores

Indications & Uses

Otitis Media, Pharyngitis & Tonsillitis, Uncomplicated Urinary Tract Infections, Acute Exacerbations of Chronic Bronchitis, Enteric Fever

ESTRIXIME-CV-325

TABLETS (Alu-Alu)
10X1X6

Composition

Cefixime 200mg + Potassium Clavulanate 125mg

Indications & Uses

Respiratory Tract Infections, Urinary Tract Infections, Skin & Skin Structure Infections

ESTY CLAV-625 LB

TABLETS (Alu-Alu)
10X1X6

Composition

Amoxycillin 500mg + Potassium Clavulanate 125mg

Indications & Uses

Respiratory Tract Infections, Community Acquired Pneumonia, Gynaecological Infections, Acute Exacerbations of Chronic Bronchitis, Skin and Soft Tissue Infections

FLOXEST

TABLETS (Blister)
20X10

Composition

Ofloxacin 200mg + Ornidazole 500mg

Indications & Uses

Surgical ions, Diarrheas of Mixed Etiology, Gynaecological Infections, Orofacial and Dental Infections

VOFLOX-500

TABLETS
10X10

Composition

Levofloxacin 500mg

Indications & Uses

Acute Bacterial Sinusitis, Acute Bacterial Exacerbations of Chronic Bronchitis, Skin & Skin Structure Infections, Chronic Bacterial Prostatitis, Urinary Tract Infections

FLOXEST – O

TABLETS (Alu-Alu)
20X10

Composition

Cefixime 200mg + Ofloxacin 200mg

Indications & Uses

Community Acquired Pneumonia, Multiple Drug Resistant-TB, Typhoid

FLOXEST

TABLETS (Alu-Alu)
20X10

Composition

Ofloxacin 200mg

Indications & Uses

Community Acquired Pneumonia, Multiple Drug Resistant-TB, Typhoid

ESTY CLAV- 1.2

INJECTIONS
1.2g

Composition

Amoxycillin 1000mg + Potassium Clavulanate 200mg + WFI

Indications & Uses

Community Acquired Pneumonia, Gynaecological Infections, Upper Respiratory Tract Infections, Skin and Soft Tissue Infections, Urinary Tract Infections, Acute Exacerbations of Chronic Bronchitis

TRELLON-SB 1.5

INJECTIONS
1.5g

Composition

Ceftriaxone 1000mg + Sulbactam 500mg + WFI

Indications & Uses

Gynaecological Infections, Lower Respiratory Tract Infections, Intra-abdominal Infections with Aerobic Organisms, Surgical Prophylaxis

TRELLON-TZ 1.125

INJECTIONS
1.125gm

Composition

Ceftriaxone 1000mg + Tazobactam 500 mg + WFI

Indications & Uses

Bone & Joint Infections, Intra-abdominal Infections, Bacterial Meningitis, Pre-operative Surgical Prophylaxis

RELLAM

INJECTIONS
1gm

Composition

Meropenem 1gm + WFI

Indications & Uses

Complicated Intra-abdominal Infection (cIAI), Complicated Skin & Skin Structure Infections (cSSSI), Bacterial Meningitis, Noscocomial Pneumonia

TRELIN-Z 4.5

INJECTIONS
4.5gm

Composition

Piperacillin 4000mg + Tazobactam 500mg + WFI

Indications & Uses

Intra-abdominal Infections, Complicated Urinary Tract Infections, Febrile Neutropenia, Lower Respiratory Tract Infections

TRELIN-Z 4.5

INJECTIONS
4.5gm

Composition

Piperacillin 4000mg + Tazobactam 500mg + WFI

Indications & Uses

Intra-abdominal Infections, Complicated Urinary Tract Infections, Febrile Neutropenia, Lower Respiratory Tract Infections

BUTRELLA

SYRUP

100ml

Composition

Ambroxol HCI 15mg + Guaiphensin 50mg + Terbutaline Sulphate 1.5mg + Mentholated Base/5ml

Indications & Uses

Bronchitis, Productive Cough, Emphysema, Bronchial Asthma

BUTRELLA-BR

SYRUP

100ml

Composition

Terbutaline Sulphate 1.25mg + Bromhexine HCI 4mg + Guaiphenesin 50mg + Methalated Base/5ml

Indications & Uses

Acute Cough, Abnormal Mucus Secretion, Productive Cough

DEXTRIN

SYRUP
100ml

Composition

Dextromethorphan Hydrobromide 10mg + Phenylpherine 5 mg + Cetrizine 5mg + Mentholated Base/5ml

Indications & Uses

Commom Cold and Flu, Nasal Congestion, Sore Throat

VOTRELL-M

TABLETS (Alu-Alu)
20X10

Composition

Levocetirizine 5mg + Montelukast 10mg

Indications & Uses

Allergic Rhinitis, Nasal Congestion, Asthma

VOTRELL

TABLETS (Alu-Alu)
20X11

Composition

Levocetirizine 5mg

Indications & Uses

Chronic Idiopathic Urticaria (CIU), Seasonal Allergic Rhinitis (SAR), Perennial Allergic Rhinitis (PAR)

Arrange A Callback
[]
1 Step 1
Full Name
Telephone
Departmentyour full name
Postal Address
Message
0 /
Previous
Next
Shopping Basket