Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

3.4 WordPress version

  • Loading branch information...
commit ad9a2194086e327b5a1bfc4748ca3526f0d201a7 1 parent a629505
@pgogy authored
View
5 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");
View
13 dublincore_admin.php
@@ -27,7 +27,9 @@ function dublincore_options_page() {
<input type="checkbox" name="language" <?PHP if(trim(get_option("dc_language"))=="true"){ echo "checked"; } ?> /> DC:Language <br />
<h2>Modify the RSS Feed - <input type="checkbox" name="metadata_feed_modify" <?PHP if(trim(get_option("metadata_feed_modify"))=="true"){ echo "checked"; } ?> /></h2>
<h2>Modify the Page / Post / Custom Post Type - <input type="checkbox" name="metadata_page_modify" <?PHP if(trim(get_option("metadata_page_modify"))=="true"){ echo "checked"; } ?> /></h2>
- <h2>Content to modify page / post with</h2>
+ <h2>Content to modify page / post with (before post content)</h2>
+ <textarea name="content_to_add_before" cols=130 rows=10><?PHP echo stripslashes(get_option("content_to_add_before")); ?></textarea>
+ <h2>Content to modify page / post with (after post content)</h2>
<textarea name="content_to_add" cols=130 rows=10><?PHP echo stripslashes(get_option("content_to_add")); ?></textarea>
<div>
<p>The following shortcuts can be used</p>
@@ -42,8 +44,11 @@ function dublincore_options_page() {
<p>%contributor% - displays the DC:Contributor </p>
<p>%rights% - displays the DC:Rights </p>
<p>%format% - displays the DC:Format </p>
- <p>%language% - displays the DC:Language </p>
+ <p>%language% - displays the DC:Language </p>
</div>
+ <h2>Shortcodes</h2>
+ <p>You can also display DC elements anywhere in the page by using the shortcode [dublin-core-metadata]</p>
+ <textarea name="content_for_shortcode" cols=130 rows=10><?PHP echo stripslashes(get_option("content_for_shortcode")); ?></textarea>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
@@ -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']);
}
View
14 dublincore_post_create_alter.php
@@ -316,6 +316,12 @@ function(response){
wp_nonce_field('dublincore_savepost','dublincore_savepost');
+ echo "<p>Go to <a href='" . get_site_url() . "/wp-admin/options-general.php?page=dublincore'>the Dublin Core Setup Page</a> to set up the DC elements you wish to catalogue.</p>";
+
+ }else{
+
+ echo "<p>Please visit <a href='" . get_site_url() . "/wp-admin/options-general.php?page=dublincore'>the Dublin Core Setup Page</a> to set up the DC elements you wish to catalogue.</p>";
+
}
}
@@ -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{
View
27 dublincore_theme_functions.php
@@ -0,0 +1,27 @@
+<?PHP
+
+ function return_dublin_core_value($element,$post_id){
+
+ switch($element){
+
+ case 'dublin_core_author': return get_post_meta($post_id,'dublin_core_author',true); break;
+ case 'dublin_core_subject': return get_post_meta($post_id,'dublin_core_subject',true); break;
+ case 'dublin_core_title': return get_post_meta($post_id,'dublin_core_title',true); break;
+ case 'dublin_core_description': return get_post_meta($post_id,'dublin_core_description',true); break;
+ case 'dublin_core_type': return get_post_meta($post_id,'dublin_core_type',true); break;
+ case 'dublin_core_source': return get_post_meta($post_id,'dublin_core_source',true); break;
+ case 'dublin_core_coverage': return get_post_meta($post_id,'dublin_core_coverage',true); break;
+ case 'dublin_core_relation': return get_post_meta($post_id,'dublin_core_relation',true); break;
+ case 'dublin_core_publisher': return get_post_meta($post_id,'dublin_core_publisher',true); break;
+ case 'dublin_core_contributor': return get_post_meta($post_id,'dublin_core_contributor',true); break;
+ case 'dublin_core_rights': return get_post_meta($post_id,'dublin_core_rights',true); break;
+ case 'dublin_core_format': return get_post_meta($post_id,'dublin_core_format',true); break;
+ case 'dublin_core_language': return get_post_meta($post_id,'dublin_core_language',true); break;
+ case 'dublin_core_instructionalmethod': return get_post_meta($post_id,'dublin_core_instructionalmethod',true); break;
+ default : break;
+
+ }
+
+ }
+
+?>
View
12 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
Please sign in to comment.
Something went wrong with that request. Please try again.