Usage
PHP
nebula()->is_save_data()
Parameters
This function does not accept any parameters. Is this incorrect?
Examples
HTML
<?php if ( !nebula->is_save_data() ): ?> <video> <!-- Load "expensive" video here --> </video> <?php else: ?> <img src="lite.jpg" /><!-- Load a smaller image instead --> <?php endif; ?>
CSS
#hero {/* Do lots of cool stuff */} .save-data #hero {/* Do fewer crazy things */}
Demo
No Save Data header found, normal data usage ok.
Additional Notes
A class of save-data
is added to the <body>
tag so that stylesheets and JavaScript can look for it too.
Source File
Located in /libs/Optimization.php on line 151.
No Hooks
This function does not have any filters or actions available. Request one?
PHP
public function is_save_data(){ if ( isset($this->super->server['HTTP_SAVE_DATA']) && stristr($this->super->server['HTTP_SAVE_DATA'], 'on') !== false ){ return true; } return false; }
Override
This function can not be short-circuited with an override filter. Request one?