changed regex logic
and added some more changes
This commit is contained in:
parent
c53f840230
commit
ceaa3a4241
2 changed files with 11 additions and 1 deletions
|
@ -19,7 +19,7 @@ namespace Activitypub;
|
||||||
* Initialize plugin
|
* Initialize plugin
|
||||||
*/
|
*/
|
||||||
function init() {
|
function init() {
|
||||||
defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?<=[\s>]|^)#(\w*[A-Za-z_]+\w*)\b(?!;)' );
|
defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|^)#(\w*[A-Za-z_]+\w*)' );
|
||||||
|
|
||||||
require_once dirname( __FILE__ ) . '/includes/class-signature.php';
|
require_once dirname( __FILE__ ) . '/includes/class-signature.php';
|
||||||
require_once dirname( __FILE__ ) . '/includes/class-activity.php';
|
require_once dirname( __FILE__ ) . '/includes/class-activity.php';
|
||||||
|
@ -59,6 +59,9 @@ function init() {
|
||||||
|
|
||||||
require_once dirname( __FILE__ ) . '/includes/class-hashtag.php';
|
require_once dirname( __FILE__ ) . '/includes/class-hashtag.php';
|
||||||
\Activitypub\Hashtag::init();
|
\Activitypub\Hashtag::init();
|
||||||
|
|
||||||
|
require_once dirname( __FILE__ ) . '/includes/class-health-check.php';
|
||||||
|
\Activitypub\Health_Check::init();
|
||||||
}
|
}
|
||||||
add_action( 'plugins_loaded', '\Activitypub\init' );
|
add_action( 'plugins_loaded', '\Activitypub\init' );
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,13 @@ class Test_Activitypub_Hashtag extends WP_UnitTestCase {
|
||||||
array( '#test', '#test' ),
|
array( '#test', '#test' ),
|
||||||
array( 'hallo #test test', 'hallo #test test' ),
|
array( 'hallo #test test', 'hallo #test test' ),
|
||||||
array( 'hallo #object test', 'hallo <a rel="tag" class="u-tag u-category" href="' . $link . '">#object</a> test' ),
|
array( 'hallo #object test', 'hallo <a rel="tag" class="u-tag u-category" href="' . $link . '">#object</a> test' ),
|
||||||
|
array( 'hallo <a href="http://test.test/#object">test</a> test', 'hallo <a href="http://test.test/#object">test</a> test' ),
|
||||||
|
array( 'hallo <a href="http://test.test/#object">#test</a> test', 'hallo <a href="http://test.test/#object">#test</a> test' ),
|
||||||
|
array( '<div>hallo #object test</div>', '<div>hallo <a rel="tag" class="u-tag u-category" href="' . $link . '">#object</a> test</div>' ),
|
||||||
|
array( '<div>hallo #object</div>', '<div>hallo <a rel="tag" class="u-tag u-category" href="' . $link . '">#object</a></div>' ),
|
||||||
|
array( '<div>#object</div>', '<div>#object</div>' ),
|
||||||
|
array( '<a>#object</a>', '<a>#object</a>' ),
|
||||||
|
array( '<div style="color: #ccc;">object</a>', '<div style="color: #ccc;">object</a>' ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue