shinsenter / defer.php Goto Github PK
View Code? Open in Web Editor NEW🚀 A PHP library that focuses on minimizing payload size of HTML document and optimizing page speed.
Home Page: https://github.com/shinsenter/defer.php
License: MIT License
🚀 A PHP library that focuses on minimizing payload size of HTML document and optimizing page speed.
Home Page: https://github.com/shinsenter/defer.php
License: MIT License
Hi !
My project using smarty template engine it's synax bellow
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir('/web/www.example.com/guestbook/templates/');
$smarty->setCompileDir('/web/www.example.com/guestbook/templates_c/');
$smarty->setConfigDir('/web/www.example.com/guestbook/configs/');
$smarty->setCacheDir('/web/www.example.com/guestbook/cache/');
$smarty->assign('name','Ned');
//** un-comment the following line to show the debug console
//$smarty->debugging = true;
$smarty->display('index.tpl');
it's display through display function but shinsenter not like that it's output direct
Deprecated: Return type of AppSeeds\Elements\DocumentNode::normalize() should either be compatible with DOMNode::normalize(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \vendor\shinsenter\defer.php\src\Elements\DocumentNode.php on line 272
Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in \vendor\shinsenter\defer.php\src\Elements\DocumentNode.php on line 197
how to fix it?
I think I posted this in the wrong github repo--I was sent to the defer.js one. Anyway, for some reason your optimized output does not get saved in the Cache Enabler cache. The author of Autoptimize says AO uses output buffering in order not to depend on any caching plugin.
Is it possible you could use this technique so yours gets cached, too? I prefer your plugin.
I have found a Script thats Broken all (No Console Error)
Before
Code-> https://paste.ee/p/ePXqY
After
Code-> https://paste.ee/p/aThOO
Setting
// Library injection $defer->append_defer_js = true; $defer->default_defer_time = 10; // Page optimizations $defer->enable_preloading = false; $defer->enable_dns_prefetch = false; $defer->fix_render_blocking = false; $defer->minify_output_html = false; // Tag optimizations $defer->enable_defer_css = false; $defer->enable_defer_scripts = false; $defer->enable_defer_images = false; $defer->enable_defer_iframes = false; $defer->enable_defer_background = false; $defer->enable_defer_fallback = false; // Web-font optimizations $defer->defer_web_fonts = false; // Image and iframe placeholders $defer->empty_gif = ''; $defer->empty_src = ''; $defer->use_color_placeholder = false; $defer->use_css_fadein_effects = false; // Blacklist $defer->do_not_optimize = [ 'document\.write\s*\(', '(jquery([-_][\d\.]+)?(\.min)?\.js|jquery-core)', 'partner', 'styleLogo' ];
Hello,
Whenever the page contains a script which contains a closing HTML tag, the parser gets it wrong and adds a closing </script> tag right in the middle
For instance this
$('<div class="bg-color-overlay"></div>').prependTo('body');
becomes this
$('<div class="bg-color-overlay"></script></div>').prependTo('body');
And breaks everything.
On My Framework what i use
Fatal error: Uncaught Error: Call to a member function get() on null in C:\xampp\htdocs\wcs\lib\system\api\defer.php\src\Defer.php:211 Stack trace: #0 C:\xampp\htdocs\wcs\lib\system\api\defer.php\src\Defer.php(78): shinsenter\Defer->nodefer() #1 C:\xampp\htdocs\wcs\lib\system\event\listener\OutputModListener.class.php(57): shinsenter\Defer->fromHtml('\r\n\r\n\r\n<!DOCTYPE...') #2 C:\xampp\htdocs\wcs\lib\system\event\EventHandler.class.php(221): wcf\system\event\listener\OutputModListener->execute('wcf\util\Header...', 'wcf\util\Header...', 'parseOutput', Array) #3 C:\xampp\htdocs\wcs\lib\util\HeaderUtil.class.php(140): wcf\system\event\EventHandler->fireAction('wcf\util\Header...', 'parseOutput') #4 [internal function]: wcf\util\HeaderUtil::parseOutput('\r\n\r\n\r\n<!DOCTYPE...', 9) #5 C:\xampp\htdocs\wcs\lib\system\WCF.class.php(191): ob_end_flush() #6 [internal function]: wcf\system\WCF::destruct() #7 {main} thrown in C:\xampp\htdocs\wcs\lib\system\api\defer.php\src\Defer.php on line 211
i musst change teh Follow Line https://github.com/shinsenter/defer.php/blob/master/src/Defer.php#L211 to
$has_nodefer = 0;
Dependabot was set up to create pull requests against the branch v2.0
, but couldn't find it.
If the branch has been permanently deleted you can update Dependabot's target branch from your dashboard.
The website is: dentzar.com.
Please click on the Search button and you’ll see strange looking box.
Original HTML:
data-avia-search-tooltip="<form role="search" action="https://dentzar.com/" id="searchform" method="get" class="">
<div>
<input type="submit" value="" id="searchsubmit" class="button avia-font-entypo-fontello" />
<input type="text" id="s" name="s" value="" placeholder='Search' />
</div>
</form>"
Defer.js optimized HTML:
data-avia-search-tooltip="<form role=&quot;search&quot; action=&quot;https://dentzar.com/&quot; id=&quot;searchform&quot; method=&quot;get&quot; class=&quot;&quot;>
<div>
<input type=&quot;submit&quot; value=&quot;&quot; id=&quot;searchsubmit&quot; class=&quot;button avia-font-entypo-fontello&quot; />
<input type=&quot;text&quot; id=&quot;s&quot; name=&quot;s&quot; value=&quot;&quot; placeholder='Search' />
</div>
</form>"
Reason: wrong HTML entity encoding.
Schedule: Fix in the next release
Temporary fix: None
this code
<p>Na was machst du den hier, Möchtest du den Boss, Chef, Gott usw. des Forum mal genauer betrachten oder haste einfach Interesse an meiner Person und Persönlichkeit?<br><br>Naja dann wünsche ich dir Viel Spaß und hoffe deine Träume erfüllt mein Profile <img src="https://www.cafe-anime.de/_OLD/wcf/images/smilies/wink.png" alt=";)"></p>
after minifyOutputHTML
<p>Na was machst du den hier, Möchtest du den Boss, Chef, Gott usw. des Forum mal genauer betrachten oder haste einfach Interesse an meiner Person und Persönlichkeit?<br><br> Naja dann wünsche ich dir Viel Spaß und hoffe deine Träume erfüllt mein Profile<img alt=";)" class="defer-lazied defer-loaded" data-src="https://www.cafe-anime.de/_OLD/wcf/images/smilies/wink.png" src="https://www.cafe-anime.de/_OLD/wcf/images/smilies/wink.png" data-lazied="IMG"><noscript><img src="https://www.cafe-anime.de/_OLD/wcf/images/smilies/wink.png" alt=";)" class="jsResizeImage"></noscript></p>
after "Profile<" is a space missing
or
<p><strong>Avatar (<a href="https://www.cafe-anime.de/index.php?thread/17375-10-jahre-cafe-anime-cafe-anime-feiert-geburtstag/&postID=514919#post514919">Vorlage</a>) by <a href="https://www.cafe-anime.de/index.php?user/5183-blacksad/">Blacksad</a>, Danke</strong></p>
after
<p><strong>Avatar (<a href="https://www.cafe-anime.de/index.php?thread/17375-10-jahre-cafe-anime-cafe-anime-feiert-geburtstag/&postID=514919#post514919">Vorlage</a> ) by<a href="https://www.cafe-anime.de/index.php?user/5183-blacksad/">Blacksad</a>, Danke</strong></p>
by "by<a" missing space
Wenn i User this page
https://community.woltlab.com with test page (Download https://www.woltlab.com/apps/)
https://github.com/shinsenter/defer.php/blob/master/test/test.php
Some Javascripts broken, diferent option i chose
sorry delete this
Hi.
I am using this version Dev Master (v2.5)
and got it all working.
I am using it in relation to Wordpress.
So if you have some updates you want to push
, or mention
, or test
, feel free to let me know :) and I'll give it a run.
i wish me a fully local version of JS because General Data Protection Regulation GDPR (DSGVO)
i cant use external source and the Polyfill.js is includes as External source by me
Hi I have tested your project on my Codeigniter source code.
Wow it changed the html code structure amazingly. But there was a problem. I think it is caused by your defer.js component. It makes all image and js resources unloadable.
Best regards and good luck!
DeepL Translation:
Can you insert an option for deffer_min.js. The one that inserts the script inline of HTMl and not external?
Kannst du eine Option für deffer_min.js einfügen. Die den den Script inline des HTMl einfügt und nicht externe?
The time is not set
Dependabot couldn't find a composer.json for this project.
Dependabot requires a composer.json to evaluate your project's current PHP dependencies. It had expected to find one at the path: /src/composer.json
.
If this isn't a PHP project, or if it is a library, you may wish to disable updates for it from within Dependabot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.