Skip to content

Commit

Permalink
3.4 WordPress version
Browse files Browse the repository at this point in the history
  • Loading branch information
pgogy committed Jul 7, 2012
1 parent a629505 commit ad9a219
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 12 deletions.
5 changes: 2 additions & 3 deletions dublincore.php
Expand Up @@ -8,7 +8,7 @@
Description: Add Dublin Core to an item within a blog post
Version: 0.93
Version: 0.94
Author: Pgogy
Expand All @@ -17,8 +17,7 @@
*/

require_once("dublincore_ajax.php");


require_once("dublincore_theme_functions.php");

require_once("dublincore_admin.php");

Expand Down
13 changes: 11 additions & 2 deletions dublincore_admin.php
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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' );
}
Expand Down Expand Up @@ -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']);

}

Expand Down
14 changes: 10 additions & 4 deletions dublincore_post_create_alter.php
Expand Up @@ -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>";

}

}
Expand Down Expand Up @@ -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')){

Expand Down Expand Up @@ -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");

}

Expand All @@ -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{

Expand Down
27 changes: 27 additions & 0 deletions 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;

}

}

?>
12 changes: 9 additions & 3 deletions readme.txt
Expand Up @@ -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 ==

Expand All @@ -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

Expand Down

0 comments on commit ad9a219

Please sign in to comment.