Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 5.0.1.0
- * @ Author : DeZender
- * @ Release on : 22.04.2022
- * @ Official site : http://DeZender.Net
- *
- */
- /**
- * @author emrenogay.com
- */
- function ngy_new_buffer($buffer)
- {
- $amp_domain = get_field('nogay_amp_domain', 'option');
- $amp_domain_prefix = get_field('nogay_current_amp_domain', 'option');
- if ((strpos($buffer, 'https://cdn.ampproject.org/') !== false) && !is_admin()) {
- if (get_field('nogay_is_active_ampcdn', 'option')) {
- $searchForAMP = ['action="' . get_site_url()];
- $replaceForAMP = ['action="' . generateCdnLinks()];
- $buffer = str_replace($searchForAMP, $replaceForAMP, $buffer);
- $site = str_replace('/', '\\/', get_site_url());
- $pattern = '@<a(.*?)href="' . $site . '@si';
- $replace = '<a$1href="' . generateCdnLinks();
- $buffer = preg_replace($pattern, $replace, $buffer);
- if (get_field('nogay_remove_amp_prefix', 'option')) {
- $dom = new DOMDocument();
- $dom->loadHTML($buffer, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
- $aTags = $dom->getElementsByTagName('a');
- foreach ($aTags as $a) {
- $href = $a->getAttribute('href');
- if (strpos($href, '/amp') !== false) {
- $newHref = str_replace('/amp', '', $href);
- $a->setAttribute('href', $newHref);
- }
- }
- $buffer = $dom->saveHTML();
- }
- }
- if (get_field('nogay_image_is_active_ampcdn', 'option')) {
- $addon = generateCdnLinks(true);
- $pattern = '@<(amp-img|img|amp-anim)(.*?)src="' . str_replace('/', '\\/', get_site_url()) . '@si';
- $replace = '<$1$2$3src="' . $addon;
- $buffer = preg_replace($pattern, $replace, $buffer);
- $removeSrcSet = '@srcset="(.*?)"@si';
- $buffer = preg_replace($removeSrcSet, '', $buffer);
- $bgPattern = '@(.*?)background-image:(.*?)url\\(' . get_site_url() . '@si';
- $bgReplace = '$1background-image:$2url(' . generateCdnLinks(true);
- $buffer = preg_replace($bgPattern, $bgReplace, $buffer);
- }
- }
- if (!empty($amp_domain)) {
- $amp_domain = str_replace(['https://', 'http://'], NULL, $amp_domain);
- $amp_domain_prefix = str_replace(['https://', 'http://'], NULL, $amp_domain_prefix);
- $currentSchema = str_replace('/', '\\/', nogay_is_ssl()) . $_SERVER['HTTP_HOST'];
- $newSchema = $amp_domain;
- if (!empty($amp_domain_prefix) && get_field('nogay_auto_subdomain', 'option')) {
- $newSchema = $amp_domain_prefix . '.' . $newSchema;
- }
- if (get_field('nogay_remove_amp_prefix', 'option')) {
- ...............................................................
- ...................................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment