Skip to content

Commit

Permalink
forgot to flush the rewrite rules
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Apr 27, 2010
1 parent 3e16e5f commit 7c3530e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
23 changes: 16 additions & 7 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: /.well-known/
Plugin URI: http://notizblog.org/
Description: This plugin enables "Well-Known URIs" support for WordPress (RFC 5785: http://tools.ietf.org/html/rfc5785).
Version: 0.2
Version: 0.2.1
Author: Matthias Pfefferle
Author URI: http://notizblog.org/
*/
Expand All @@ -12,6 +12,7 @@
add_filter('query_vars', array('WellKnownPlugin', 'queryVars'));
add_action('parse_request', array('WellKnownPlugin', 'delegateRequest'));
add_action('generate_rewrite_rules', array('WellKnownPlugin', 'rewriteRules'));
register_activation_hook(__FILE__, array('WellKnown', 'activationHook'));

/**
* well-known class
Expand All @@ -30,7 +31,15 @@ function queryVars($vars) {

return $vars;
}


/**
* activation hook
*/
function activationHook() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}

/**
* Add rewrite rules for .well-known.
*
Expand All @@ -43,22 +52,22 @@ function rewriteRules($wp_rewrite) {

$wp_rewrite->rules = $wellKnownRules + $wp_rewrite->rules;
}

/**
* delegates the request to the matching (registered) class
*/
function delegateRequest() {
global $wp_query, $wp;

$wellKnown = array();
$wellKnown = apply_filters('well-known', $wellKnown);

$queryVars = $wp->query_vars;

if( array_key_exists('well-known', $queryVars) ) {
if (array_key_exists($queryVars['well-known'], $wellKnown)) {
$remoteFunction = $wellKnown[$queryVars['well-known']];

call_user_func($remoteFunction);
} else {
header("HTTP/1.1 404 Not Found");
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link:
Tags: OpenID, XRD, well-known, XML, Discovery
Requires at least: 2.7
Tested up to: 2.9.9
Stable tag: 0.2
Stable tag: 0.2.1

This plugin enables "Well-Known URIs" support for WordPress (RFC 5785: http://tools.ietf.org/html/rfc5785).

Expand Down Expand Up @@ -37,6 +37,8 @@ From the RFC:

== Changelog ==

= 0.2.1 =
* Forgot to flush the rewrite rules
= 0.2 =
* Better doku
= 0.1 =
Expand Down

0 comments on commit 7c3530e

Please sign in to comment.