From ad9a2194086e327b5a1bfc4748ca3526f0d201a7 Mon Sep 17 00:00:00 2001 From: patlockley Date: Sat, 7 Jul 2012 17:12:48 +0100 Subject: [PATCH] 3.4 WordPress version --- dublincore.php | 5 ++--- dublincore_admin.php | 13 +++++++++++-- dublincore_post_create_alter.php | 14 ++++++++++---- dublincore_theme_functions.php | 27 +++++++++++++++++++++++++++ readme.txt | 12 +++++++++--- 5 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 dublincore_theme_functions.php diff --git a/dublincore.php b/dublincore.php index 279c335..00975a1 100644 --- a/dublincore.php +++ b/dublincore.php @@ -8,7 +8,7 @@ Description: Add Dublin Core to an item within a blog post - Version: 0.93 + Version: 0.94 Author: Pgogy @@ -17,8 +17,7 @@ */ require_once("dublincore_ajax.php"); - - + require_once("dublincore_theme_functions.php"); require_once("dublincore_admin.php"); diff --git a/dublincore_admin.php b/dublincore_admin.php index 80e16e6..7f62231 100644 --- a/dublincore_admin.php +++ b/dublincore_admin.php @@ -27,7 +27,9 @@ function dublincore_options_page() { /> DC:Language

Modify the RSS Feed - />

Modify the Page / Post / Custom Post Type - />

-

Content to modify page / post with

+

Content to modify page / post with (before post content)

+ +

Content to modify page / post with (after post content)

The following shortcuts can be used

@@ -42,8 +44,11 @@ function dublincore_options_page() {

%contributor% - displays the DC:Contributor

%rights% - displays the DC:Rights

%format% - displays the DC:Format

-

%language% - displays the DC:Language

+

%language% - displays the DC:Language

+

Shortcodes

+

You can also display DC elements anywhere in the page by using the shortcode [dublin-core-metadata]

+

@@ -70,6 +75,8 @@ function register_dublincore() { register_setting( 'dublincore', 'dc_language'); register_setting( 'dublincore', 'dc_imethod'); register_setting( 'dublincore', 'content_to_add'); + register_setting( 'dublincore', 'content_to_add_before'); + register_setting( 'dublincore', 'content_for_shortcode'); register_setting( 'dublincore', 'metadata_feed_modify' ); register_setting( 'dublincore', 'metadata_page_modify' ); } @@ -224,6 +231,8 @@ function dublincore_postform(){ } update_option("content_to_add",$_POST['content_to_add']); + update_option("content_to_add_before",$_POST['content_to_add_before']); + update_option("content_for_shortcode",$_POST['content_for_shortcode']); } diff --git a/dublincore_post_create_alter.php b/dublincore_post_create_alter.php index 9dbd3e7..475be9e 100644 --- a/dublincore_post_create_alter.php +++ b/dublincore_post_create_alter.php @@ -316,6 +316,12 @@ function(response){ wp_nonce_field('dublincore_savepost','dublincore_savepost'); + echo "

Go to the Dublin Core Setup Page to set up the DC elements you wish to catalogue.

"; + + }else{ + + echo "

Please visit the Dublin Core Setup Page to set up the DC elements you wish to catalogue.

"; + } } @@ -543,11 +549,11 @@ function dublincore_add_menu($output){ } - function create_dublin_core_text(){ + function create_dublin_core_text($variable){ global $post; - $append = get_option("content_to_add"); + $append = get_option($variable); if (get_post_meta($post->ID,'dublin_core_author')){ @@ -667,7 +673,7 @@ function create_dublin_core_text(){ function dublin_core_shortcode( $atts ) { - return create_dublin_core_text(); + return create_dublin_core_text("content_for_shortcode"); } @@ -679,7 +685,7 @@ function append_dublincore($output){ if(get_option('metadata_page_modify')=="true"){ - return $output . create_dublin_core_text(); + return create_dublin_core_text("content_to_add_before") . $output . create_dublin_core_text("content_to_add"); }else{ diff --git a/dublincore_theme_functions.php b/dublincore_theme_functions.php new file mode 100644 index 0000000..16a34f1 --- /dev/null +++ b/dublincore_theme_functions.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/readme.txt b/readme.txt index 278f1a6..6f62a0e 100644 --- a/readme.txt +++ b/readme.txt @@ -2,10 +2,10 @@ Contributors: pgogy Tags: dublin core, dc, metadata Requires at least: 3.0.0 -Tested up to: 3.3 -Stable tag: 0.93 +Tested up to: 3.4 +Stable tag: 0.94 -Allows a user to add dublin core metadata (of their choice) to a wordpress post. +Allows a user to add dublin core metadata (of their choice) to a wordpress post. Also supports a new function library so dublin core can be added to themes. == Description == @@ -23,6 +23,12 @@ e.g. == Changelog == += 0.94 = +Support for theme functions +Added in support for custom shortcodes +Added in support for prefixing content with dublin core data + + = 0.93 = Support for posts and custom post types