Minor cleanups.

This commit is contained in:
Greg 2023-01-22 11:27:13 -05:00
parent 740a73b00f
commit 3a82891948
2 changed files with 12 additions and 1 deletions

View file

@ -2,8 +2,18 @@
namespace Activitypub;
class Shortcodes {
/**
* The post object we're currently working on
*
* @var WP_Post $post A WordPress Post Object
*/
private $post;
/**
* Class constructor, registering WordPress then shortcodes
*
* @param WP_Post $post A WordPress Post Object
*/
public function __construct( $post = null ) {
if( $post == null ) {
$post = \get_post();
@ -16,7 +26,7 @@ class Shortcodes {
}
foreach( get_class_methods( $this ) as $shortcode ) {
if( $shortcode != 'init' && strpos( $shortcode, '__' ) !== 0 ) {
if( strpos( $shortcode, '__' ) !== 0 ) {
add_shortcode( 'ap_' . $shortcode, array( $this, $shortcode ) );
}
}

View file

@ -238,6 +238,7 @@ class Post {
$post = $this->post;
$content = $this->get_post_content_template();
// Register the shortcodes.
$shortcodes = new \Activitypub\Shortcodes( $post );
// Fill in the shortcodes.