SproutCMS

This is the code documentation for the SproutCMS project

source of /skin/sprout_load.php

  1. <?php
  2. use Sprout\Helpers\Needs;
  3. use Sprout\Helpers\Register;
  4.  
  5.  
  6. // Convert file/download/id(/size) links to actual file names e.g. 'files/123_example.jpg'
  7. Register::contentReplace('main_content', ['Sprout\\Helpers\\ContentReplace', 'fileDownload']);
  8.  
  9. // Update document links to have a cache-buster and also Google event tracking
  10. Register::contentReplace('main_content', ['Sprout\\Helpers\\Sprout', 'specialFileLinks']);
  11.  
  12. // Determine if there is a rel="facebox" in use and if so, load the Facebox library
  13. Register::contentReplace('inner_html', function($html) {
  14. if (preg_match('/class="[^"]*js-popup[^"]*"/', $html)) {
  15. Needs::fileGroup('magnific_popup');
  16. }
  17. return $html;
  18. });
  19.  
  20. Register::templateVariable('hello', function() {
  21. return 'Hello World!';
  22. });
  23.