Changeset 3101476
- Timestamp:
- 06/12/2024 03:25:32 AM (2 months ago)
- Location:
- enable-mastodon-apps/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
enable-mastodon-apps/trunk/README.md
r3097861 r3101476 7 7 - Requires PHP: 7.4 8 8 - License: [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html) 9 - Stable tag: 0.9. 09 - Stable tag: 0.9. 10 10 11 11 Allow accessing your WordPress with Mastodon clients. Just enter your own blog URL as your instance. … … 98 98 ## Changelog 99 99 100 101 102 103 104 105 106 107 100 108 ### 0.9.0 101 109 - Complete Rewrite, started at the Cloudfest Hackathon! Props @pfefferle, @drivingralle, @kittmedia, @obenland … … 117 125 118 126 127 128 129 130 131 132 119 133 [#140]: https://github.com/akirk/enable-mastodon-apps/pull/140 120 134 [#138]: https://github.com/akirk/enable-mastodon-apps/pull/138 -
enable-mastodon-apps/trunk/enable-mastodon-apps.php
r3097861 r3101476 4 4 * Plugin author: Alex Kirk 5 5 * Plugin URI: https://github.com/akirk/enable-mastodon-apps 6 * Version: 0.9. 06 * Version: 0.9. 7 7 * 8 8 * Description: Allow accessing your WordPress with Mastodon clients. Just enter your own blog URL as your instance. … … 16 16 defined( 'ABSPATH' ) || exit; 17 17 define( 'ENABLE_MASTODON_APPS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 18 define( 'ENABLE_MASTODON_APPS_VERSION', '0.9. 0' );18 define( 'ENABLE_MASTODON_APPS_VERSION', '0.9.' ); 19 19 20 20 require __DIR__ . '/vendor/bshaffer/oauth2-server-php/src/OAuth2/Autoloader.php'; … … 65 65 } 66 66 ); 67 68 69 70 -
enable-mastodon-apps/trunk/includes/class-comment-cpt.php
r3097861 r3101476 4 4 * 5 5 * This contains the automatic mapping of comments to a custom post type. 6 7 8 9 10 11 12 13 6 14 * 7 15 * @package Enable_Mastodon_Apps … … 79 87 $comment = get_comment( $comment_id ); 80 88 } 81 if ( ! $comment ) {89 if ( ! $comment ) { 82 90 return; 83 91 } … … 147 155 $post_id = self::comment_id_to_post_id( $comment->comment_ID ); 148 156 if ( ! $post_id ) { 149 return; 150 } 151 152 $post_data = array( 153 'ID' => $post_id, 154 'post_status' => 'publish' === $new_status ? 'publish' : 'private', 155 ); 156 157 wp_update_post( $post_data ); 158 } 159 160 public function update_comment_post( $comment_id, $comment ) { 157 if ( 158 'approved' === $new_status && 159 'approved' !== $old_status 160 ) { 161 self::create_comment_post( $comment->comment_ID, $comment ); 162 } 163 return; 164 } 165 166 if ( 'approved' === $new_status ) { 167 wp_update_post( 168 array( 169 'ID' => $post_id, 170 'post_content' => $comment->comment_content, 171 'post_date' => $comment->comment_date, 172 'post_date_gmt' => $comment->comment_date_gmt, 173 'post_status' => 'publish', 174 ) 175 ); 176 return; 177 } 178 179 if ( 180 'trash' === $new_status || 181 'spam' === $new_status 182 ) { 183 $this->delete_comment_post( $comment->comment_ID ); 184 return; 185 } 186 } 187 188 public function update_comment_post( $comment_id, $data ) { 161 189 $post_id = self::comment_id_to_post_id( $comment_id ); 162 190 if ( ! $post_id ) { 163 191 return; 164 192 } 165 166 193 $post_data = array( 167 194 'ID' => $post_id, 168 'post_content' => $comment->comment_content, 169 'post_date' => $comment->comment_date, 170 'post_date_gmt' => $comment->comment_date_gmt, 195 'post_content' => $data['comment_content'], 196 'post_date' => $data['comment_date'], 197 'post_date_gmt' => $data['comment_date_gmt'], 198 'post_status' => $data['comment_approved'] ? 'publish' : 'trash', 171 199 ); 172 200 -
enable-mastodon-apps/trunk/includes/class-mastodon-admin.php
r3097861 r3101476 447 447 ); 448 448 } 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 449 479 } -
enable-mastodon-apps/trunk/includes/class-mastodon-api.php
r3097861 r3101476 1177 1177 'type' => 'string', 1178 1178 'description' => 'The type of search to perform.', 1179 'enum' => array( 'accounts', 'hashtags', 'statuses' ),1180 'default' => ' statuses',1179 'enum' => array( 'accounts', 'hashtags', 'statuses' ), 1180 'default' => '', 1181 1181 ), 1182 1182 'resolve' => array( -
enable-mastodon-apps/trunk/includes/class-mastodon-oauth.php
r3097861 r3101476 170 170 public function get_token() { 171 171 $request = Request::createFromGlobals(); 172 if ( ! $this->server->verifyResourceRequest( $request ) ) { 172 $response = new Response(); 173 if ( ! $this->server->verifyResourceRequest( $request, $response ) ) { 173 174 return null; 174 175 } 175 return $this->server->getAccessTokenData( $request );176 return $this->server->getAccessTokenData( $request ); 176 177 } 177 178 -
enable-mastodon-apps/trunk/includes/entity/class-media-attachment.php
r3097861 r3101476 141 141 return parent::validate( $key ); 142 142 } 143 144 145 146 147 148 149 143 150 } -
enable-mastodon-apps/trunk/includes/handler/class-instance.php
r3097861 r3101476 38 38 add_filter( 'mastodon_api_instance_extended_description', array( $this, 'api_instance_extended_description' ) ); 39 39 add_action( 'update_option_blogdescription', array( $this, 'save_created_at' ) ); 40 41 // Enable the link manager so peers can be added/updated.42 add_filter( 'pre_option_link_manager_enabled', '__return_true' );43 40 } 44 41 -
enable-mastodon-apps/trunk/includes/handler/class-media-attachment.php
r3097861 r3101476 181 181 'height' => intval( $block['height'] ), 182 182 'size' => $block['width'] . 'x' . $block['height'], 183 'aspect' => $block['width'] /$block['height'],183 'aspect' => $block['height'], 184 184 ); 185 185 } else { … … 246 246 'height' => intval( $block['height'] ), 247 247 'size' => $block['width'] . 'x' . $block['height'], 248 'aspect' => $block['width'] /$block['height'],248 'aspect' => $block['height'], 249 249 ); 250 250 } else { -
enable-mastodon-apps/trunk/templates/welcome.php
r3097861 r3101476 14 14 <h2><?php esc_html_e( 'Welcome', 'enable-mastodon-apps' ); ?></h2> 15 15 <p> 16 <?php esc_html_e( 'This plugin enables you to access your WordPress with Mastodon clients.', 'enable-mastodon-apps' ); ?> 16 <span><?php esc_html_e( 'This plugin enables you to access your WordPress with Mastodon clients.', 'enable-mastodon-apps' ); ?></span> 17 <span> 17 18 <?php 18 19 echo wp_kses( … … 30 31 ); 31 32 ?> 32 <?php esc_html_e( 'Make sure you scroll down to the "Browse third-party apps" section for more choice.', 'enable-mastodon-apps' ); ?> 33 </span> 34 <span><?php esc_html_e( 'Make sure you scroll down to the "Browse third-party apps" section for more choice.', 'enable-mastodon-apps' ); ?></span> 33 35 </p> 34 36 <p> … … 37 39 <input type="text" class="regular-text copyable" id="enable-mastodon-apps-instance" value="<?php echo esc_attr( $args['instance_url'] ); ?>" readonly="readonly"> 38 40 <p> 39 < ?php esc_html_e( 'The Mastodon app will then redirect you to the login page of your own WordPress site.', 'enable-mastodon-apps' ); ?>40 < ?php esc_html_e( 'Double-check the URL of the login form so that you don\'t enter your details on another site.', 'enable-mastodon-apps' ); ?>41 < ?php esc_html_e( 'You\'ll need to log in there and then authorize the app.', 'enable-mastodon-apps' ); ?>41 <> 42 <> 43 <> 42 44 </p> 43 45 <p> … … 66 68 <h2><?php esc_html_e( 'Recommended Plugins', 'enable-mastodon-apps' ); ?></h2> 67 69 <p> 68 < ?php esc_html_e( 'The Enable Mastodon Apps plugin works well on its own: it allows you to publish posts and show your all blog posts in the apps\' timelines.', 'enable-mastodon-apps' ); ?>69 < ?php esc_html_e( 'This can already be very useful on a blog where multiple people interact.', 'enable-mastodon-apps' ); ?>70 <> 71 <> 70 72 </p> 71 73 72 74 <p> 73 < ?php esc_html_e( 'That said, it was designed so that it can be meaningfully extended by other plugins.', 'enable-mastodon-apps' ); ?>74 < ?php esc_html_e( 'In particular this is the case for the following plugins:', 'enable-mastodon-apps' ); ?>75 <> 76 <> 75 77 </p> 76 78 </div> … … 89 91 <div id="enable-mastodon-apps-settings-accordion-block-activitypub-plugin" class="enable-mastodon-apps-settings-accordion-panel plugin-card-activitypub" hidden="hidden"> 90 92 <p> 91 < ?php \esc_html_e( 'The Activitypub plugin allows you interact with the Fediverse, for example Mastodon.', 'enable-mastodon-apps' ); ?>92 < ?php \esc_html_e( 'With this plugin installed, for example, you can search for Mastodon users and view their posts.', 'enable-mastodon-apps' ); ?>93 <> 94 <> 93 95 </p> 94 96 <?php if ( defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) : ?> 95 97 <p><strong><?php \esc_html_e( 'The Activitypub plugin is installed.', 'enable-mastodon-apps' ); ?></strong></p> 96 98 <?php else : ?> 97 <p><a href="<?php echo \esc_url_raw( \admin_url( 'plugin-install.php?tab=plugin-information&plugin=activitypub&TB_iframe=true' ) ); ?>" class="thickbox open-plugin-details-modal button install-now" target="_blank"><?php \esc_html_e( 'Install the FriendsPlugin', 'enable-mastodon-apps' ); ?></a></p>99 <p><a href="<?php echo \esc_url_raw( \admin_url( 'plugin-install.php?tab=plugin-information&plugin=activitypub&TB_iframe=true' ) ); ?>" class="thickbox open-plugin-details-modal button install-now" target="_blank"><?php \esc_html_e( 'Install the Plugin', 'enable-mastodon-apps' ); ?></a></p> 98 100 <?php endif; ?> 99 101 </div> … … 112 114 <div id="enable-mastodon-apps-settings-accordion-block-friends-plugin" class="enable-mastodon-apps-settings-accordion-panel plugin-card-friends" hidden="hidden"> 113 115 <p> 114 < ?php \esc_html_e( 'The Friends plugin allows you to follow others from within your own WordPress.', 'enable-mastodon-apps' ); ?>115 < ?php \esc_html_e( 'This will give you a feed of your friends\' posts which will also be displayed in the Enable Mastodon Apps plugin.', 'enable-mastodon-apps' ); ?>116 < ?php \esc_html_e( 'Combined with ActivityPub plugin you can also follow and interact with people over the ActivityPub protocol, for example on Mastodon.', 'enable-mastodon-apps' ); ?>116 <> 117 <> 118 <> 117 119 </p> 118 120 <?php if ( defined( 'FRIENDS_VERSION' ) ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.