forked from CameronGilroy/EasyCopyright
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EasyCopyright.php
64 lines (44 loc) · 2.09 KB
/
EasyCopyright.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*
#EasyCopyright#
##About##
* By Cameron Gilroy - few change to make it work in php 8 by eydolan
* EasyCopyright
* Version: 1.1.1
* Based in part on Copyright by AMDbuilder
* Creator: Cameron Gilroy http://www.camerongilroy.com
* Support URL: http://www.camerongilroy.com/
* GitHub: http://github.com/camgill/EasyCopyright
EasyCopyright is a simple snippet for ModX Revolution that inserts the the current year and the site name. Check the example below.
*© +CameronGilroy.com+ 2009-2011 - Powered by +MODx+*
###Thanks###
A big thank you goes to the creators of MODx Revolution!
[dflock](https://github.com/dflock/ "dflock"): Thanks for the new features added to 1.1!
###Usage###
<code>[[!EasyCopyright]]</code> - Outputs *© [[Your Site name here]] 2011 - Powered by MODx*
<code>[[!EasyCopyright? &StartYear=`2009`]]</code> - Outputs *© [[Your Site name here]] 2009-2011 - Powered by MODx*
##Configuration##
The variables that are available are listed below with a description.
You can also call the contents of a chunk into any of these fields like this <code>[[!EasyCopyright? &Powered=`[[$Your_Chunk_Name]]`]]</code>
* Name - Your site name
* Start Year - What ever you put in!
* Powered - is the link to the ModX site
* YearSeparator - is the separator that goes between the Start Year and the current year
* PoweredBySeparator - is the separator that goes between the current Year and Powered by
###Defaults###
* Name - Your site name
* Start Year - No Default must be called in the snippet
* Powered - is the link to the ModX site
* YearSeparator - "-"
* PoweredBySeparator - "-"
*/
$Name = $Name ?? $modx->getOption('name', $scriptProperties, '[[++site_name]]');
$PoweredBySeparator = $PoweredBySeparator ?? "-";
$Powered = $Powered ?? "Powered by <a href='http://www.modxcms.com'>MODx</a>";
$PoweredBy = $PoweredBy !== 'false' ? " {$PoweredBySeparator} {$Powered}" : "";
$YearSeparator = $YearSeparator ?? "-";
$cYear = date("Y");
$StartYear = $StartYear ?? $cYear;
$years = $cYear > $StartYear ? "{$StartYear}{$YearSeparator}{$cYear}" : $cYear;
return "© {$Name} {$years}{$PoweredBy}";
?>