| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; |
| 3 |
|
| 4 |
class HalfdataGreenPopups { |
| 5 |
function __construct() { |
| 6 |
add_filter('berqwp_before_script_optimization', [$this, 'moveArgScript']); |
| 7 |
} |
| 8 |
|
| 9 |
function moveArgScript($buffer) { |
| 10 |
$achorScript = 'lepopup_ajax_url'; |
| 11 |
$appendMarkerMatch = '/wp-content/plugins/halfdata-green-popups/js/lepopup.min.js'; |
| 12 |
|
| 13 |
if (strpos($buffer, $achorScript) !== false && strpos($buffer, $appendMarkerMatch) !== false) { |
| 14 |
$scriptSeqManipulate = new scriptSeqManipulate(); |
| 15 |
$scriptSeqManipulate->setBuffer($buffer); |
| 16 |
$scriptSeqManipulate->appendBefore($achorScript, $appendMarkerMatch); |
| 17 |
$buffer = $scriptSeqManipulate->getBuffer(); |
| 18 |
$scriptSeqManipulate->clean(); |
| 19 |
unset($scriptSeqManipulate); |
| 20 |
} |
| 21 |
|
| 22 |
return $buffer; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
new HalfdataGreenPopups(); |