Skip to content

Commit 1654298

Browse files
committed
Merge pull request #2 from roomshare/master
embed annotation added
2 parents 9bd0d14 + eeb5c1d commit 1654298

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/Oow/Plugin/Annotations/PluginAnnotations.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,11 @@ final class AjaxResponse
4242
public $action;
4343
/** @var boolean */
4444
public $nopriv = false;
45-
}
45+
}
46+
47+
/** @Annotation */
48+
final class Embed extends Annotation {
49+
public $id;
50+
public $regex;
51+
public $priority = 10;
52+
}

lib/Oow/Plugin/PluginManager.php

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public function addPlugin($plugin)
8383
if ($annot->nopriv) {
8484
add_action('wp_ajax_nopriv_'. $annot->action, $closure);
8585
}
86+
} elseif ($annot instanceof \Oow\Plugin\Annotations\Embed) { $id = $annot->id;
87+
$regex = $annot->regex;
88+
$func = array($plugin, $method->getName());
89+
$priority = $annot->priority;
90+
91+
wp_embed_register_handler($id, $regex, $func, $priority);
8692
}
8793
}
8894
}

0 commit comments

Comments
 (0)