use static method to upgrade post content to shortcodes

This commit is contained in:
Matthias Pfefferle 2023-01-23 20:31:14 +01:00
parent d4b88f228d
commit cb1c26a365
2 changed files with 11 additions and 15 deletions

View file

@ -50,8 +50,7 @@ class Admin {
switch ( $tab ) {
case 'settings':
$post_model = new \Activitypub\Model\Post();
$post_model->upgrade_post_content_template();
\Activitypub\Model\Post::upgrade_post_content_template();
\load_template( \dirname( __FILE__ ) . '/../templates/settings.php' );
break;

View file

@ -16,8 +16,7 @@ class Post {
private $tags;
private $object_type;
public function __construct( $post = null ) {
if ( $post ) {
public function __construct( $post ) {
$this->post = \get_post( $post );
$this->post_author = $this->post->post_author;
@ -29,8 +28,6 @@ class Post {
$this->object_type = $this->generate_object_type();
}
}
public function __call( $method, $params ) {
$var = \strtolower( \substr( $method, 4 ) );
@ -289,7 +286,7 @@ class Post {
*
* @return string the updated template content
*/
public function upgrade_post_content_template() {
public static function upgrade_post_content_template() {
// Get the custom template.
$old_content = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT );