HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/wp-content/plugins/w3-total-cache/Minify_Extract.php
<?php
namespace W3TC;

class Minify_Extract {
	/**
	 * Extracts JS files from content
	 * w3tc-url-escaping: When rendered, URLs need to be escaped via
	 * htmlspecialchars instead of esc_attr to not change the way it is encoded
	 * in source html. E.g. html contains a&amp;b Using esc_attr that will not
	 * double escape it as a result config value will be a&b.
	 *
	 * @param string  $content
	 * @return array
	 */
	static public function extract_js( $content ) {
		$matches = null;
		$files = array();

		$content = preg_replace( '~<!--.*?-->~s', '', $content );

		if ( preg_match_all( '~<script\s+[^<>]*src=["\']?([^"\']+)["\']?[^<>]*>\s*</script>~is',
				$content, $matches ) ) {
			$files = $matches[1];
		}

		$files = array_values( array_unique( $files ) );

		return $files;
	}

	/**
	 * Extract CSS files from content
	 *
	 * @param string  $content
	 * @return array
	 */
	static public function extract_css( $content ) {
		$content = preg_replace( '~<!--.*?-->~s', '', $content );

		$tags_files = array();

		$matches = null;
		if ( preg_match_all( '~<link\s+([^>]+)/?>(.*</link>)?~Uis', $content,
				$matches, PREG_SET_ORDER ) ) {
			foreach ( $matches as $match ) {
				$attrs = array();
				$attr_matches = null;
				if ( preg_match_all( '~(\w+)=["\']([^"\']*)["\']~', $match[1],
						$attr_matches, PREG_SET_ORDER ) ) {
					foreach ( $attr_matches as $attr_match ) {
						$attrs[$attr_match[1]] = trim( $attr_match[2] );
					}
				}

				if ( isset( $attrs['href'] ) && isset( $attrs['rel'] ) &&
					stristr( $attrs['rel'], 'stylesheet' ) !== false &&
					( !isset( $attrs['media'] ) || stristr( $attrs['media'], 'print' ) === false ) ) {
					$tags_files[] = array( $match[0], $attrs['href'] );
				}
			}

		}

		if ( preg_match_all( '~@import\s+(url\s*)?\(?["\']?\s*([^"\'\)\s]+)\s*["\']?\)?[^;]*;?~is',
				$content, $matches, PREG_SET_ORDER ) ) {
			foreach ( $matches as $match )
				$tags_files[] = array( $match[0], $match[2] );
		}

		return $tags_files;
	}
}