Copyright Notice Plugin
This plugin supplies tags that allow you to easily display a well formatted copyright message for use in …
- The head section of your xhtml pages.
- For a site-wide copyright notice.
- For a per-article copyright notice with access to custom field data.
The first tag, <txp:sed_copyright/> generates a copyright message. The dates used can be set as attributes to the tag. However, by default a date range is calculated from
- the oldest article posted in the TXP installation (start date).
- the date of the last update to any article (end date).
This means you can probably forget about copyright notice maintenance in your sites. Sit back and let the editing of articles drive the copyright date changes as needed.
You can check it out at the foot of this very page.
If you need more control than that then try the <txp:sed_copyright_date/> tag that just returns the dates. You can use it in your forms to build the message you require.
Changes from last version
Version 1.3 from 1.2
- Updated for TxP 4.0.4
- Surpression of duplicate key warnings.
Version 1.2 from 1.1
- Uses the bundled library plugin.
- Can now be used in article forms and articles themselves.
- Allows overriding of attributes based on values of a custom field.
Version 1.1 from 1.0
- Restricted the date checking to articles that are live or sticky.
- Fixed a css display problem in the help section.
Download
The latest version is available here—as are any prior versions.
- sed_copyright.v1.3.zip [24.51KB]
v1.3 of the Copyright notice generator. This zip includes the latest library. You will need to install both files for the copyright generator to work. : 602 download(s)
- sed_copyright-1.2.zip [23.88KB]
v1.2 of the Copyright notice generator. Includes the library plugin. You need to install and activate both plugins for things to work. : 440 download(s)
- sed_copyright-1.1.txt [30.72KB]
v1.1 of the Copyright notice generator. Fixes a problem with the help section and restricts checking of dates to live and sticky articles only. : 927 download(s)
- sed_copyright-1.0.txt [29.92KB]
v1.0 of the Copyright notice generator.
Note: Please download this if you are using v0.3 and ied_plugin_composer as v0.3 messes up plugin_composer's export as php command. This release fixes it. : 886 download(s)
- sed_copyright-0.3.txt [29.56KB]
v0.3 of the Copyright notice generator. : 895 download(s)
- sed_copyright-0.2.txt [19.54KB]
v0.2 of the Copyright notice generator. : 893 download(s)
- sed_copyright-0.1.txt [15.67KB]
v0.1 of the Copyright notice generator. : 920 download(s)
Forum Thread
There is a thread on the TXP forum for this plugin.
Display Copyright Notice Plugin
sed_copyright plugin, v1.3
Outputs a copyright message in one of the following formats…
Copyright-Section [Date-Section] Owner-Section
or
Copyright-Section Owner-Section [Date-Section]
Where the optional date-section can be a single date (either the start or the end date) or a date range in the format “start-date – end-date”. The dates can be provided as an attribute to the plugin or the plugin can work them out based on the oldest article posted to the DB and the latest update to any article on the site. If comments count as ‘modifications’ to the site then the DB of articles is checked, otherwise the last_mod value in the global preferences is used.
The copyright-section and owner-section are customizable via the tag attributes and the owner section can now hyper-link to other resources.
Wraptag and class for the resulting notice are also customizable.
The copyright date tag
This tag can take the following attributes…
| Attribute | Default Value | Description |
|---|---|---|
| ‘start_year’ | ‘’ | Optional: Sets the start year. Omit or leave empty for automatic detection of start year. |
| ‘end_year’ | ‘’ | Optional: Sets the end year. Omit or leave empty for auto detect of end year. Set to ‘now’ to use the current year. |
| ‘date_type’ | ‘range’ | Optional: sets the type of date stamp. Valid: ‘none’, ‘range’, ‘start’ or ‘end’. |
Examples…
Here are some examples of how to use this tag…
Basic use.
<txp:sed_copyright_date/>
...will give you the start_year—end_year range from your DB, unless the articles have all been written in the same year in which case you will only get that year.
Only display the current year.
<txp:sed_copyright_date date_type='end' end_year='now'/>
In 2008 this would display “2008” and in 2009 the year would update too—regardless of when the articles in the site were actually posted.
Fixed start year, automatic end year.
<txp:sed_copyright_date start_year='2000'/>
This would give 2000—200x where 200x is the year of the last mod to the articles.
The copyright tag
This tag can take the following attributes…
| Attribute | Default Value | Description |
|---|---|---|
| ‘owner’ | ‘’ | Optional copyright owner. Omit or leave empty to default to the site name, but you should supply this if the copyright owner is different from the TXP site name. |
| ‘owner_href’ | ‘’ | The href to use for the owner-section. Omit or leave blank for none. If you want an email link then prepend with ‘mailto:’ |
| ‘owner_title’ | ‘’ | The title for the owner-section href. |
| ‘copy_text’ | ’©’ | The copyright string to use before the date-section. |
| ‘start_year’ | ‘’ | Optional: Sets the start year. Omit or leave empty for automatic detection of start year. |
| ‘end_year’ | ‘’ | Optional: Sets the end year. Omit or leave empty for auto detect of end year. Set to ‘now’ to use the current year. |
| ‘date_type’ | ‘range’ | Optional: sets the type of date stamp. Valid: ‘none’, ‘range’, ‘start’ or ‘end’. |
| ‘order’ | ‘cdo’ | Optional: order of sections. Omit or leave blank for default copyright-date-owner order. Valid values: ‘cdo’, ‘cod’ |
| ‘wraptag’ | ‘’ | Optional: Name of the tag to use to wrap the listing. Now defaults to blank (=no wrap tag) |
| ‘class’ | ‘copyright’ | Optional: Name of class to use for the wrap tag. |
| ‘custom’ | ‘’ | Optional: When used in an article or article form, this specifies the name of the custom field to search for per-article values. |
These items have changed since the last release.
Examples…
Here are some examples of how to use this tag…
Basic use.
<txp:sed_copyright owner='John Doe' />
Will produce the message ”© [date-section] John Doe” where the content of the [date-section] depends on the articles in your site. If the oldest post was in 2003 and the most recent mod in 2006 then you would get ”© 2003-2006 John Doe” but if the first post was in 2006 as well you would only get ”© 2006 John Doe”.
If you omit the owner attribute then the site name will be used instead. This is Okay for sites where the site name matches the copyright owner. On other sites you should provide this attribute.
Change the output year(s).
Year manipulation is as for the <txp:sed_copyright_date/> tag.
Change the copyright message.
<txp:sed_copyright owner='John Doe' copy_text='Copyright'/>
Change the order of the sections in the notice.
<txp:sed_copyright owner='John Doe' order='cod'/>
Produces the following: ”© John Doe 2006”. If you omit the order attribute—or set it to any value other than ‘cod’—then the sections will be output in cdo (copyright-date-owner) order.
Changing the default wrap values.
<txp:sed_copyright owner='John Doe' wraptag='div' class='foobar'/>
Note: Now defaults to blank—that is, no wraptag. If you need the previous behaviour you will need to add wraptag='p' to your attributes.
Setting up the owner section as links.
<txp:sed_copyright owner='John Doe' owner_href='http://txp-plugins.netcarving.com/plugins/johns-article/' owner_title="Click here to go to John's page."/>
The above example will output the following: ”© 2005-2006 John Doe”. Note that the owner section is now a hyper-link to another page.
NOTE: If the href starts with ‘mailto:’ then the tag will encode the email address in an attempt to prevent email harvesting.
Per-Article Copyright.
Include the <txp:sed_copyright/> tag in an article or an article form and use the new ‘custom’ attribute to tell the tag which custom field to look in for custom values for the ‘start’, ‘end’, ‘owner’, ‘owner_href’ and ‘owner_title’ fields. If these values are missing then the tag defaults to the article author and the year of the article’s posting. If the article is being published by you but the copyright belongs to a third party you can attribute it by using the custom field.
Steps for setting this up…
- Under Admin > Preferences > Advanced preferences name one of your empty custom fields. Remember this name!
- In a new or existing article, look for the custom field you just set up. It should be under “Advanced Options”.
- In this field type “copyright(start=’1066’;end=’2006’;owner=’King Harold’)” but without the quotation marks.
- Add this tag to the body of the article
<txp:sed_copyright custom='my_name'/>
Make sure you replace ‘my_name’ with the name of your custom field! Now publish your article and make sure it is live. - Visit the page and you should see ”© 1066-2006 King Harold”.
You can also include the owner_href and owner_title parameters in the custom field to setup a clickable link.
If you omit the owner field then it default’s to the article author. If you omit the start year it defaults to the year the article was posted.
The main use of this approach would be for attributing article copyright to an individual not in the publishing chain or to the person who originally posted the article.
To-Do and Feature Enhancements
Feature ideas (in sequence of likely implementation)…
- If it is used inside an article form displaying an individual article then pull the owner’s name and article dates from the author’s real name in the DB.
Start date would be the posted date, end date would be the lastmod date but only if the author made the mod, otherwise would need to stick to a single year in the date section.
Version History
v1.3 October 25th, 2006
- Updated to work with TxP 4.0.4’s stricter attribute checking.
- Fixes a warning about duplicate keys in debug/testing mode.
v1.2 June 6th, 2006
- Uses the bundled library plugin.
- Can now be used in article forms and articles themselves.
- Allows overriding of attributes based on values of a custom field.
v1.1 May 25th, 2006
- Restricted date selection to live or sticky articles.
- Fixed a css display problem in the help section of the plugin.
v1.0 May 10th, 2006
- Cleaned up internal code a little. (Thanks raggar!)
- Changed the default wraptag to blank.
- Fixed a compatability problem with ied_plugin_composer.
- Fixed a display problem when installed from the plugin cache directory.
v0.3 May 7th, 2006
- Split out the date extraction part of the original tag and made it available as a new tag.
Now you can pull the dates to make up your own copyright (or other) message as needed. - You can now make the owner section into a link.
- If the owner_href starts with ‘mailto:’ then the rest of the reference will be encoded to try to stop email address harvesters.
v0.2 May 2nd, 2006
- Improved the cache handling code for the start and end years from the DB.
- Added a default value for the owner attribute: if left blank it will use the site name.
- Added some extra date checking code.
- Added a new attribute named ‘order’ which gives some flexibility in the ordering of the sections making up the notice.
v0.1 April 28th, 2006.
- Provide a way of detecting the first article in the DB and extract the start year from this.
- Provide a way of detecting the latest update to the DB and extract the end year from this.
- Provide a way of setting the copyright owner string.
- Provide a way of overriding the start/end dates.
- Provide a way of only using the start or end date.
Credits
This plugin was inspired by Nathan Smith’s article about using php to set the copyright dates on his website SonSpring.