Changeset 3245135
- Timestamp:
- 02/23/2025 06:36:14 AM (2 weeks ago)
- Location:
- enable-mastodon-apps/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
enable-mastodon-apps/trunk/README.md
r3245133 r3245135 7 7 - Requires PHP: 7.4 8 8 - License: [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html) 9 - Stable tag: 1.2. 09 - Stable tag: 1.2.1 10 10 11 11 Allow accessing your WordPress with Mastodon clients. Just enter your own blog URL as your instance. … … 101 101 ## Changelog 102 102 103 ### 1.2. 0103 ### 1.2.1 104 104 - Fixed Boost, Like and Comment notifications ([#216]) 105 105 - Announce Initial and Changed App Settings ([#207], [#214]) -
enable-mastodon-apps/trunk/enable-mastodon-apps.php
r3245133 r3245135 4 4 * Plugin author: Alex Kirk 5 5 * Plugin URI: https://github.com/akirk/enable-mastodon-apps 6 * Version: 1.2. 06 * Version: 1.2.1 7 7 * 8 8 * Description: Allow accessing your WordPress with Mastodon clients. Just enter your own blog URL as your instance. … … 21 21 define( 'ENABLE_MASTODON_APPS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 22 22 define( 'ENABLE_MASTODON_APPS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 23 define( 'ENABLE_MASTODON_APPS_VERSION', '1.2. 0' );23 define( 'ENABLE_MASTODON_APPS_VERSION', '1.2.1' ); 24 24 25 25 require __DIR__ . '/vendor/bshaffer/oauth2-server-php/src/OAuth2/Autoloader.php'; -
enable-mastodon-apps/trunk/includes/class-comment-cpt.php
r3245133 r3245135 237 237 } 238 238 239 return apply_filters( 'mastodon_api_account', null, $comment->comment_author_url, $request, null ); 239 $account = apply_filters( 'mastodon_api_account', null, $comment->comment_author_url, $request, null ); 240 if ( $account ) { 241 return $account; 242 } 243 244 $account = new Entity\Account(); 245 $account->id = $comment->comment_author_url; 246 $account->username = $comment->comment_author; 247 $account->display_name = $comment->comment_author; 248 $account->avatar = get_avatar_url( $comment->comment_author_email ); 249 $account->avatar_static = get_avatar_url( $comment->comment_author_email ); 250 $account->acct = $comment->comment_author_url; 251 $account->note = ''; 252 $account->created_at = new \DateTime( $comment->comment_date ); 253 $account->statuses_count = 0; 254 $account->last_status_at = new \DateTime( $comment->comment_date ); 255 $account->url = $comment->comment_author_url; 256 257 $account->source = array( 258 'privacy' => 'public', 259 'sensitive' => false, 260 'language' => 'en', 261 'note' => 'Comment', 262 'fields' => array(), 263 ); 264 265 return Handler\Account::api_account_ensure_numeric_id( $account, $comment->comment_author_url ); 240 266 } 241 267 } -
enable-mastodon-apps/trunk/includes/handler/class-account.php
r3243595 r3245135 28 28 add_filter( 'mastodon_api_account', array( $this, 'api_account' ), 10, 2 ); 29 29 add_filter( 'mastodon_api_account', array( $this, 'api_account_ema' ), 10, 4 ); 30 add_filter( 'mastodon_api_account', array( $this, 'api_account_ensure_numeric_id' ), 100, 2 );30 add_filter( 'mastodon_api_account', array( get_called_class(), 'api_account_ensure_numeric_id' ), 100, 2 ); 31 31 } 32 32 … … 96 96 } 97 97 98 public function api_account_ensure_numeric_id( $user_data, $user_id ) {98 public static function api_account_ensure_numeric_id( $user_data, $user_id ) { 99 99 if ( ! is_object( $user_data ) ) { 100 100 return $user_data; -
enable-mastodon-apps/trunk/includes/handler/class-notification.php
r3245133 r3245135 160 160 foreach ( get_posts( $args ) as $post ) { 161 161 $comment_id = Comment_CPT::post_id_to_comment_id( $post->ID ); 162 $account = apply_filters( 'mastodon_api_account', null, $post->post_author, null, $post );163 162 switch ( get_comment_type( $comment_id ) ) { 164 163 case 'like': 165 $type = ' like';164 $type = 'favourite'; 166 165 $status = apply_filters( 'mastodon_api_status', null, $post->post_parent, array() ); 167 166 break; … … 174 173 $status = apply_filters( 'mastodon_api_status', null, $post->ID, array() ); 175 174 } 176 if ( $account && $status ) { 177 $notifications[] = $this->get_notification_array( 178 $type, 179 mysql2date( 'Y-m-d\TH:i:s.000P', $post->post_date, false ), 180 $account, 181 $status 182 ); 175 $account = apply_filters( 'mastodon_api_account', null, $post->post_author, null, $post ); 176 if ( $status ) { 177 $status->account = $account; 183 178 } 184 } 185 } 186 179 180 $notifications[] = $this->get_notification_array( 181 $type, 182 mysql2date( 'Y-m-d\TH:i:s.000P', $post->post_date, false ), 183 $account, 184 $status 185 ); 186 } 187 } 187 188 $min_id = $request->get_param( 'min_id' ); 188 189 $max_id = $request->get_param( 'max_id' ); … … 245 246 * @return array 246 247 */ 247 protected function get_notification_array( string $type, $date, \Enable_Mastodon_Apps\Entity\Account $account, \Enable_Mastodon_Apps\Entity\Status $status): array {248 protected function get_notification_array( string $type, $date, ?\Enable_Mastodon_Apps\Entity\Account $account = null, ?\Enable_Mastodon_Apps\Entity\Status $status = null ): array { 248 249 $notification = array( 249 250 'id' => preg_replace( '/[^0-9]/', '', $date ),
Note: See TracChangeset
for help on using the changeset viewer.