Created
February 6, 2016 12:34
-
-
Save Drabush/13f48c8aee66b3c27e46 to your computer and use it in GitHub Desktop.
Auto update copyright year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* copyrightYear: get years to copyright footer | |
* Parameters: | |
* start [optional]: First year of website. | |
* DEFAULT: nothing. | |
* separator [optional]: the space string between start and current year | |
* [[copyrightYear]] // return: 2016 | |
* [[copyrightYear? &start=`2014`]] // return: 2014 – 2016 | |
*/ | |
$start = $modx->getOption('start', $scriptProperties, date("Y")); | |
$separator = $modx->getOption('separator', $scriptProperties, ' - '); | |
$now = date("Y"); | |
$start = isset($start)? $start : $now; | |
$years = ($now > $start && $start > '1970') ? $start . $separator . $now : $now; | |
return $years; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment