Plugin Directory

Changeset 3101476

Timestamp:
06/12/2024 03:25:32 AM (8 weeks ago)
Author:
akirk
Message:

enable-mastodon-apps 0.9.1

Location:
enable-mastodon-apps/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • enable-mastodon-apps/trunk/README.md

    r3097861 r3101476  
    77- Requires PHP: 7.4
    88- License: [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html)
    9 - Stable tag: 0.9.0
     9- Stable tag: 0.9.
    1010
    1111Allow accessing your WordPress with Mastodon clients. Just enter your own blog URL as your instance.
     
    9898## Changelog
    9999
     100
     101
     102
     103
     104
     105
     106
     107
    100108### 0.9.0
    101109- Complete Rewrite, started at the Cloudfest Hackathon! Props @pfefferle, @drivingralle, @kittmedia, @obenland
     
    117125
    118126
     127
     128
     129
     130
     131
     132
    119133[#140]: https://github.com/akirk/enable-mastodon-apps/pull/140
    120134[#138]: https://github.com/akirk/enable-mastodon-apps/pull/138
  • enable-mastodon-apps/trunk/enable-mastodon-apps.php

    r3097861 r3101476  
    44 * Plugin author: Alex Kirk
    55 * Plugin URI: https://github.com/akirk/enable-mastodon-apps
    6  * Version: 0.9.0
     6 * Version: 0.9.
    77 *
    88 * Description: Allow accessing your WordPress with Mastodon clients. Just enter your own blog URL as your instance.
     
    1616defined( 'ABSPATH' ) || exit;
    1717define( 'ENABLE_MASTODON_APPS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    18 define( 'ENABLE_MASTODON_APPS_VERSION', '0.9.0' );
     18define( 'ENABLE_MASTODON_APPS_VERSION', '0.9.' );
    1919
    2020require __DIR__ . '/vendor/bshaffer/oauth2-server-php/src/OAuth2/Autoloader.php';
     
    6565    }
    6666);
     67
     68
     69
     70
  • enable-mastodon-apps/trunk/includes/class-comment-cpt.php

    r3097861 r3101476  
    44 *
    55 * This contains the automatic mapping of comments to a custom post type.
     6
     7
     8
     9
     10
     11
     12
     13
    614 *
    715 * @package Enable_Mastodon_Apps
     
    7987            $comment = get_comment( $comment_id );
    8088        }
    81         if ( ! $comment ) {
     89        if ( ! $comment ) {
    8290            return;
    8391        }
     
    147155        $post_id = self::comment_id_to_post_id( $comment->comment_ID );
    148156        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 ) {
    161189        $post_id = self::comment_id_to_post_id( $comment_id );
    162190        if ( ! $post_id ) {
    163191            return;
    164192        }
    165 
    166193        $post_data = array(
    167194            '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',
    171199        );
    172200
  • enable-mastodon-apps/trunk/includes/class-mastodon-admin.php

    r3097861 r3101476  
    447447        );
    448448    }
     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
    449479}
  • enable-mastodon-apps/trunk/includes/class-mastodon-api.php

    r3097861 r3101476  
    11771177                        'type'        => 'string',
    11781178                        'description' => 'The type of search to perform.',
    1179                         'enum'        => array( 'accounts', 'hashtags', 'statuses' ),
    1180                         'default'     => 'statuses',
     1179                        'enum'        => array( 'accounts', 'hashtags', 'statuses' ),
     1180                        'default'     => '',
    11811181                    ),
    11821182                    'resolve'    => array(
  • enable-mastodon-apps/trunk/includes/class-mastodon-oauth.php

    r3097861 r3101476  
    170170    public function get_token() {
    171171        $request = Request::createFromGlobals();
    172         if ( ! $this->server->verifyResourceRequest( $request ) ) {
     172        $response = new Response();
     173        if ( ! $this->server->verifyResourceRequest( $request, $response ) ) {
    173174            return null;
    174175        }
    175         return $this->server->getAccessTokenData( $request );
     176        return $this->server->getAccessTokenData( $request );
    176177    }
    177178
  • enable-mastodon-apps/trunk/includes/entity/class-media-attachment.php

    r3097861 r3101476  
    141141        return parent::validate( $key );
    142142    }
     143
     144
     145
     146
     147
     148
     149
    143150}
  • enable-mastodon-apps/trunk/includes/handler/class-instance.php

    r3097861 r3101476  
    3838        add_filter( 'mastodon_api_instance_extended_description', array( $this, 'api_instance_extended_description' ) );
    3939        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' );
    4340    }
    4441
  • enable-mastodon-apps/trunk/includes/handler/class-media-attachment.php

    r3097861 r3101476  
    181181                    'height' => intval( $block['height'] ),
    182182                    'size'   => $block['width'] . 'x' . $block['height'],
    183                     'aspect' => $block['width'] / $block['height'],
     183                    'aspect' => $block['height'],
    184184                );
    185185            } else {
     
    246246                    'height' => intval( $block['height'] ),
    247247                    'size'   => $block['width'] . 'x' . $block['height'],
    248                     'aspect' => $block['width'] / $block['height'],
     248                    'aspect' => $block['height'],
    249249                );
    250250            } else {
  • enable-mastodon-apps/trunk/templates/welcome.php

    r3097861 r3101476  
    1414        <h2><?php esc_html_e( 'Welcome', 'enable-mastodon-apps' ); ?></h2>
    1515        <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>
    1718            <?php
    1819                echo wp_kses(
     
    3031                );
    3132                ?>
    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>
    3335        </p>
    3436        <p>
     
    3739        <input type="text" class="regular-text copyable" id="enable-mastodon-apps-instance" value="<?php echo esc_attr( $args['instance_url'] ); ?>" readonly="readonly">
    3840        <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            <>
    4244        </p>
    4345        <p>
     
    6668        <h2><?php esc_html_e( 'Recommended Plugins', 'enable-mastodon-apps' ); ?></h2>
    6769        <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            <>
    7072        </p>
    7173
    7274        <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            <>
    7577        </p>
    7678    </div>
     
    8991        <div id="enable-mastodon-apps-settings-accordion-block-activitypub-plugin" class="enable-mastodon-apps-settings-accordion-panel plugin-card-activitypub" hidden="hidden">
    9092            <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                <>
    9395            </p>
    9496            <?php if ( defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) : ?>
    9597                <p><strong><?php \esc_html_e( 'The Activitypub plugin is installed.', 'enable-mastodon-apps' ); ?></strong></p>
    9698            <?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 Friends Plugin', '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>
    98100            <?php endif; ?>
    99101        </div>
     
    112114        <div id="enable-mastodon-apps-settings-accordion-block-friends-plugin" class="enable-mastodon-apps-settings-accordion-panel plugin-card-friends" hidden="hidden">
    113115            <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                <>
    117119            </p>
    118120            <?php if ( defined( 'FRIENDS_VERSION' ) ) : ?>
Note: See TracChangeset for help on using the changeset viewer.