Links on this page…

Plugins! feed.feed icon

TXP Plugins! is powered by Textpattern and most happily hosted by DreamHost.

Copyright Notice Plugin

This plugin supplies tags that allow you to easily display a well formatted copyright message for use in …

  1. The head section of your xhtml pages.
  2. For a site-wide copyright notice.
  3. 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

  1. the oldest article posted in the TXP installation (start date).
  2. 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

Version 1.2 from 1.1

Version 1.1 from 1.0

Download

The latest version is available here—as are any prior versions.

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-dateend-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.

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.

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…

  1. Under Admin > Preferences > Advanced preferences name one of your empty custom fields. Remember this name!
  2. In a new or existing article, look for the custom field you just set up. It should be under “Advanced Options”.
  3. In this field type “copyright(start=’1066’;end=’2006’;owner=’King Harold’)” but without the quotation marks.
  4. 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.
  5. 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)…

Version History

v1.3 October 25th, 2006

v1.2 June 6th, 2006

v1.1 May 25th, 2006

v1.0 May 10th, 2006

v0.3 May 7th, 2006

v0.2 May 2nd, 2006

v0.1 April 28th, 2006.

Credits

This plugin was inspired by Nathan Smith’s article about using php to set the copyright dates on his website SonSpring.