forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML API: Refactor wp_targeted_link_rel
See WordPress#5143 This patch refactors `wp_targeted_link_rel` to be more reliable and clear by using the HTML API to replace existing PCRE code. It provides backwards compatability for the `rel` filter by creating a quick HTML string representing the opening A tag for the matched element and providing the `href`, `rel`, and `target` attributes on that tag.
- Loading branch information
Showing
2 changed files
with
67 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
$r = function ( $o ) { | ||
return new class( $o ) { | ||
private $o; | ||
public function __construct( $o ) { | ||
$this->o = $o; | ||
} | ||
|
||
public function __get( $n ) { | ||
$f = get_class_vars( $this->o )[ $n ]; | ||
|
||
return $f(); | ||
} | ||
}; | ||
}; | ||
|
||
$o = new stdClass(); | ||
$h = 'f'; | ||
$o->$h = function() { echo "Hello from the inside.\n"; }; | ||
$r($o)->$h(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters