Please Check for an upgrade'; if (version_compare($wp_version,$required_ver,"<")) { exit ($exit_msg); } if(!class_exists('wprdfa') ) : class wprdfa { var $plugin_url; var $db_option = 'wprda_options'; function wprdfa() { $this->plugin_url = trailingslashit( WP_PLUGIN_URL.'/'.dirname( plugin_basename(__FILE__))); add_action('admin_menu', array(&$this, 'admin_menu')); # Insert FOAF header $options = $this->get_options(); if($options['foaf']=='on'){ add_action('wp_head', array(&$this, 'insert_foaf_meta_tag'),'3'); } # This little hack stops the admin pages having 'on', 'foaf_know_admin' => 'on', 'foaf_know_editor' => 'on', 'foaf_know_author' => 'on', 'foaf_know_contributor' => '', 'foaf_know_subscriber' => '', 'dc_elements' => '' ); # get saved options $saved = get_option($this->db_option); # assign vars if (!empty($saved)) { foreach($saved as $key => $option) $options[$key] = $option; } # allow updates of var if ($saved != $options) { update_option($this->db_option, $options); } return $options; } function install() { $this->get_options(); } function handle_options() { $options = $this->get_options(); if(isset($_POST['submitted']) ) { check_admin_referer('wprdfa-nonce'); $options= array(); $options['foaf']= $_POST['foaf']; $options['layout']= (int) $_POST['layout']; $options['foaf_know_admin']= $_POST['foaf_know_admin']; $options['foaf_know_editor']= $_POST['foaf_know_editor']; $options['foaf_know_author']= $_POST['foaf_know_author']; $options['foaf_know_contributor']= $_POST['foaf_know_contributor']; $options['foaf_know_subscriber']= $_POST['foaf_know_subscriber']; $options['dc_elements']= $_POST['dc_elements']; update_option($this->db_option, $options); echo '

Settings Saved.

'; } $layout=$options['layout']; $foaf=$options['foaf']=='on'?'checked':''; $foaf_know_admin=$options['foaf_know_admin']=='on'?'checked':''; $foaf_know_editor=$options['foaf_know_editor']=='on'?'checked':''; $foaf_know_author=$options['foaf_know_author']=='on'?'checked':''; $foaf_know_contributor=$options['foaf_know_contributor']=='on'?'checked':''; $foaf_know_subscriber=$options['foaf_know_subscriber']=='on'?'checked':''; $dc_elements=$options['dc_elements']=='on'?'checked':''; # submit URL same as this page $action_url = $_SERVER['REQUEST_URI']; include('wp-rdfa-options.php'); } function admin_menu() { add_options_page('wp-RDFa options', 'wp-rdfa', 8, basename(__FILE__), array(&$this, 'handle_options')); } # Let the world know about your FOAF file (generated foaf.php) function insert_foaf_meta_tag() { echo ''; } ##### Dublin Core Intergration ##### function insert_dc_header() { echo ''; } function extend_the_title($title = '') { global $post; $about = get_permalink($post->ID); if(in_the_loop() == 'true') { $tag_date = $this->extend_the_date(); return $tag_date.''.$title.''; } else { return $title; } } function extend_the_date() { global $post; $about = get_permalink($post->ID); if(in_the_loop() == 'true') { return ''; } else { return $author; } } function extend_the_author($author = '') { global $post; $about = get_permalink($post->ID); if(in_the_loop() == 'true') { return ''.$author.''; } else { return $author; } } # end class } else : exit ("Class wprdfa already declared!"); endif; $wprdfa = new wprdfa(); if(isset($wprdfa)) { register_activation_hook( __FILE__, array(&$wprdfa, 'install') ); } ?>