-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from akirk/dedicated-integrations
Create dedicated Integrations classes
- Loading branch information
Showing
3 changed files
with
104 additions
and
72 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
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
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,44 @@ | ||
<?php | ||
/** | ||
* Pixelfed Integration | ||
* | ||
* Add what it takes to make Pixelfed apps talk to WordPress. | ||
* | ||
* @package Enable_Mastodon_Apps | ||
*/ | ||
|
||
namespace Enable_Mastodon_Apps\Integration; | ||
|
||
/** | ||
* This is the class that implements the Pixelfed adapations. | ||
* | ||
* @since 0.1 | ||
* | ||
* @package Enable_Mastodon_Apps | ||
* @author Alex Kirk | ||
*/ | ||
class Pixelfed { | ||
public function __construct() { | ||
add_filter( 'mastodon_api_nodeinfo_software', array( $this, 'mastodon_api_pixelfed_nodeinfo_software' ) ); | ||
add_filter( 'mastodon_api_new_app_post_formats', array( $this, 'mastodon_api_pixelfed_post_formats' ), 10, 2 ); | ||
} | ||
|
||
public function mastodon_api_pixelfed_nodeinfo_software( $software ) { | ||
if ( 'okhttp/4.9.2' === $_SERVER['HTTP_USER_AGENT'] ) { | ||
return array( | ||
'name' => 'pixelfed', | ||
'version' => '0.11.5', | ||
); | ||
} | ||
|
||
return $software; | ||
} | ||
|
||
public function mastodon_api_pixelfed_post_formats( $post_formats, $app_metadata ) { | ||
if ( in_array( $app_metadata, array( 'Pixelfed' ) ) ) { | ||
$post_formats = array( 'image' ); | ||
} | ||
|
||
return $post_formats; | ||
} | ||
} |