WIP: Add Event Sources Logic (ActivityPub follows) #86
12 changed files with 34 additions and 34 deletions
|
@ -2,15 +2,15 @@
|
|||
/**
|
||||
* Event sources collection file.
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge\ActivityPub\Collection;
|
||||
namespace Event_Bridge_For_ActivityPub\ActivityPub\Collection;
|
||||
|
||||
use WP_Error;
|
||||
use WP_Query;
|
||||
use ActivityPub_Event_Bridge\ActivityPub\Event_Source;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Event_Source;
|
||||
|
||||
use function Activitypub\is_tombstone;
|
||||
use function Activitypub\get_remote_metadata_by_actor;
|
||||
|
@ -22,7 +22,7 @@ class Event_Sources {
|
|||
/**
|
||||
* The custom post type.
|
||||
*/
|
||||
const POST_TYPE = 'activitypub_event_bridge_follow';
|
||||
const POST_TYPE = 'Event_Bridge_For_ActivityPub_follow';
|
||||
|
||||
/**
|
||||
* Register the post type used to store the external event sources (i.e., followed ActivityPub actors).
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
/**
|
||||
* Event-Source (=ActivityPub Actor that is followed) model.
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge\ActivityPub;
|
||||
namespace Event_Bridge_For_ActivityPub\ActivityPub;
|
||||
|
||||
use Activitypub\Activity\Actor;
|
||||
use ActivityPub_Event_Bridge\ActivityPub\Collection\Event_Sources;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Collection\Event_Sources;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
|
@ -36,10 +36,10 @@ class Event_Source extends Actor {
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert a Custom-Post-Type input to an \ActivityPub_Event_Bridge\ActivityPub\Model\Event_Source.
|
||||
* Convert a Custom-Post-Type input to an \Event_Bridge_For_ActivityPub\ActivityPub\Model\Event_Source.
|
||||
*
|
||||
* @param \WP_Post $post The post object.
|
||||
* @return \ActivityPub_Event_Bridge\ActivityPub\Event_Source|WP_Error
|
||||
* @return \Event_Bridge_For_ActivityPub\ActivityPub\Event_Source|WP_Error
|
||||
*/
|
||||
public static function init_from_cpt( $post ) {
|
||||
if ( Event_Sources::POST_TYPE !== $post->post_type ) {
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
/**
|
||||
* Event Sources.
|
||||
*
|
||||
* @package Activitypub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge\Admin;
|
||||
namespace Event_Bridge_For_ActivityPub\Admin;
|
||||
|
||||
use Activitypub\Collection\Actors;
|
||||
use Activitypub\Activity\Extended_Object\Event;
|
||||
|
@ -67,7 +67,7 @@ class Event_Sources {
|
|||
* Respond to the Ajax request to fetch feeds
|
||||
*/
|
||||
public function ajax_fetch_events() {
|
||||
if ( ! isset( $_POST['activitypub_event_bridge'] ) ) {
|
||||
if ( ! isset( $_POST['Event_Bridge_For_ActivityPub'] ) ) {
|
||||
wp_send_json_error( 'missing-parameters' );
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Health_Check class.
|
||||
*
|
||||
* @package Activitypub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Admin;
|
||||
|
|
|
@ -119,7 +119,7 @@ class Settings_Page {
|
|||
case 'event-sources':
|
||||
wp_enqueue_script( 'thickbox' );
|
||||
wp_enqueue_style( 'thickbox' );
|
||||
\load_template( ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . 'templates/event-sources.php', true );
|
||||
\load_template( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . 'templates/event-sources.php', true );
|
||||
break;
|
||||
case 'welcome':
|
||||
default:
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
/**
|
||||
* Class for handling and saving the ActivityPub event sources (i.e. follows).
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge;
|
||||
namespace Event_Bridge_For_ActivityPub;
|
||||
|
||||
use Activitypub\Http;
|
||||
use Exception;
|
||||
|
@ -15,13 +15,13 @@ use function register_post_type;
|
|||
/**
|
||||
* Class for handling and saving the ActivityPub event sources (i.e. follows).
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
class Event_Sources {
|
||||
/**
|
||||
* The custom post type.
|
||||
*/
|
||||
const POST_TYPE = 'activitypub_event_bridge_follow';
|
||||
const POST_TYPE = 'event_bridge_follow';
|
||||
|
||||
/**
|
||||
* Register the post type used to store the external event sources (i.e., followed ActivityPub actors).
|
||||
|
|
|
@ -183,7 +183,7 @@ class Setup {
|
|||
}
|
||||
|
||||
add_action( 'init', array( Health_Check::class, 'init' ) );
|
||||
add_action( 'init', array( Event_Sources::class, 'register_taxonomy' ) );
|
||||
add_action( 'init', array( Event_Sources::class, 'register_post_type' ) );
|
||||
|
||||
// Check if the minimum required version of the ActivityPub plugin is installed.
|
||||
if ( ! version_compare( $this->activitypub_plugin_version, EVENT_BRIDGE_FOR_ACTIVITYPUB_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
/**
|
||||
* Event Sources Table-Class file.
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
namespace ActivityPub_Event_Bridge\Table;
|
||||
namespace Event_Bridge_For_ActivityPub\Table;
|
||||
|
||||
use WP_List_Table;
|
||||
use Activitypub\Collection\Followers as FollowerCollection;
|
||||
use ActivityPub_Event_Bridge\ActivityPub\Event_Source;
|
||||
use Event_Bridge_For_ActivityPub\ActivityPub\Event_Source;
|
||||
|
||||
use function Activitypub\object_to_uri;
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ $args = wp_parse_args(
|
|||
<?php \esc_html_e( 'Settings', 'event-bridge-for-activitypub' ); ?>
|
||||
</a>
|
||||
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub-event-bridge&tab=event-sources' ) ); ?>" class="activitypub-event-bridge-settings-tab <?php echo \esc_attr( $args['event-sources'] ); ?>">
|
||||
<?php \esc_html_e( 'Event Sources', 'activitypub-event-bridge' ); ?>
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=event-bridge-for-activitypub&tab=event-sources' ) ); ?>" class="event-bridge-for-activitypub-settings-tab <?php echo \esc_attr( $args['event-sources'] ); ?>">
|
||||
<?php \esc_html_e( 'Event Sources', 'event-bridge-for-activitypub' ); ?>
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Event Sources management page for the ActivityPub Event Bridge.
|
||||
*
|
||||
* @package ActivityPub_Event_Bridge
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
|
@ -17,24 +17,24 @@ defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
|||
);
|
||||
|
||||
|
||||
$table = new \ActivityPub_Event_Bridge\Table\Event_Sources();
|
||||
$table = new \Event_Bridge_For_ActivityPub\Table\Event_Sources();
|
||||
?>
|
||||
|
||||
<div class="activitypub-event-bridge-settings activitypub-event-bridge-settings-page hide-if-no-js">
|
||||
<div class="event-bridge-for-activitypub-settings event-bridge-for-activitypub-settings-page hide-if-no-js">
|
||||
|
||||
<div class="box">
|
||||
<h2> <?php esc_html_e( 'Federated event sources', 'activitypub-event-bridge' ); ?> </h2>
|
||||
<p> <?php esc_html_e( 'Here you can add any Fediverse Account.', 'activitypub-event-bridge' ); ?> </p>
|
||||
<h2> <?php esc_html_e( 'Federated event sources', 'event-bridge-for-activitypub' ); ?> </h2>
|
||||
<p> <?php esc_html_e( 'Here you can add any Fediverse Account.', 'event-bridge-for-activitypub' ); ?> </p>
|
||||
|
||||
<!-- Button that triggers ThickBox -->
|
||||
<a href="#TB_inline?width=600&height=400&inlineId=activitypub_event_bridge_add_new_source" class="thickbox button button-primary">
|
||||
<?php esc_html_e( 'Add new', 'activitypub-event-bridge' ); ?>
|
||||
<a href="#TB_inline?width=600&height=400&inlineId=Event_Bridge_For_ActivityPub_add_new_source" class="thickbox button button-primary">
|
||||
<?php esc_html_e( 'Add new', 'event-bridge-for-activitypub' ); ?>
|
||||
</a>
|
||||
|
||||
<!-- ThickBox content (hidden initially) -->
|
||||
<div id="activitypub_event_bridge_add_new_source" style="display:none;">
|
||||
<h2><?php esc_html_e( 'Add new ActivityPub follow', 'activitypub-event-bridge' ); ?> </h2>
|
||||
<p> <?php esc_html_e( 'Here you can enter either a handle or instance URL.', 'activitypub-event-bridge' ); ?> </p>
|
||||
<div id="Event_Bridge_For_ActivityPub_add_new_source" style="display:none;">
|
||||
<h2><?php esc_html_e( 'Add new ActivityPub follow', 'event-bridge-for-activitypub' ); ?> </h2>
|
||||
<p> <?php esc_html_e( 'Here you can enter either a handle or instance URL.', 'event-bridge-for-activitypub' ); ?> </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue