Fix the require paths

This commit is contained in:
Jeremy Dormitzer 2018-09-27 18:46:21 -04:00
parent 203dd6a556
commit 263ab187ab
20 changed files with 70 additions and 64 deletions

View File

@ -1,9 +1,9 @@
<?php
namespace init;
require_once plugin_dir_path( __FILE__ ) . '/server/api.php';
require_once plugin_dir_path( __FILE__ ) . '/server/actors.php';
require_once plugin_dir_path( __FILE__ ) . '/migrations.php';
require_once plugin_dir_path( __FILE__ ) . 'server/api.php';
require_once plugin_dir_path( __FILE__ ) . 'server/actors.php';
require_once plugin_dir_path( __FILE__ ) . 'migrations.php';
add_action( 'rest_api_init', function() {
\api\register_routes();

View File

@ -1,6 +1,8 @@
<?php
namespace activities;
require_once plugin_dir_path( __FILE__ ) . '../util.php';
function get_activity( $id ) {
global $wpdb;
$activity_json = $wpdb->get_var( $wpdb->prepare(
@ -48,6 +50,7 @@ function strip_private_fields( $activity ) {
function persist_activity( $activity ) {
global $wpdb;
$activity = \util\dereference_object( $activity );
if ( !array_key_exists( 'id', $activity ) ) {
return new \WP_Error(
'invalid_activity',
@ -74,6 +77,7 @@ function persist_activity( $activity ) {
function create_local_activity( $activity ) {
global $wpdb;
$activity = \util\dereference_object( $activity );
if ( !array_key_exists( 'type', $activity ) ) {
return new \WP_Error(
'invalid_activity',

View File

@ -1,10 +1,10 @@
<?php
namespace activities\accept;
require_once plugin_dir_path( __FILE__ ) . '/../following.php';
require_once plugin_dir_path( __FILE__ ) . '/../followers.php';
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '/../actors.php';
require_once plugin_dir_path( __FILE__ ) . '../following.php';
require_once plugin_dir_path( __FILE__ ) . '../followers.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../actors.php';
function handle_inbox( $actor_slug, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,8 +1,8 @@
<?php
namespace activities\announce;
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '/../shares.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../shares.php';
function handle_inbox( $actor_slug, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,8 +1,8 @@
<?php
namespace activities\block;
require_once plugin_dir_path( __FILE__ ) . '/../blocks.php';
require_once plugin_dir_path( __FILE__ ) . '/../actors.php';
require_once plugin_dir_path( __FILE__ ) . '../blocks.php';
require_once plugin_dir_path( __FILE__ ) . '../actors.php';
function handle_outbox( $actor, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,7 +1,7 @@
<?php
namespace activities\create;
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
/*
Create a new post or comment (depending on $activity["object"]["type"]),

View File

@ -1,7 +1,7 @@
<?php
namespace activities\delete;
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
function handle_outbox( $actor, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,10 +1,10 @@
<?php
namespace activities\follow;
require_once plugin_dir_path( __FILE__ ) . '/../following.php';
require_once plugin_dir_path( __FILE__ ) . '/../actors.php';
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '/../outbox.php';
require_once plugin_dir_path( __FILE__ ) . '../following.php';
require_once plugin_dir_path( __FILE__ ) . '../actors.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../outbox.php';
function handle_outbox( $actor_slug, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,9 +1,9 @@
<?php
namespace activities\like;
require_once plugin_dir_path( __FILE__ ) . '/../likes.php';
require_once plugin_dir_path( __FILE__ ) . '/../actors.php';
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../likes.php';
require_once plugin_dir_path( __FILE__ ) . '../actors.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
function handle_outbox( $actor, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,9 +1,9 @@
<?php
namespace activities\reject;
require_once plugin_dir_path( __FILE__ ) . '/../following.php';
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '/../actors.php';
require_once plugin_dir_path( __FILE__ ) . '../following.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../actors.php';
function handle_inbox( $actor_slug, $activity ) {
if ( !array_key_exists( 'object', $activity ) ) {

View File

@ -1,13 +1,13 @@
<?php
namespace activities\undo;
require_once plugin_dir_path( __FILE__ ) . '/../../util.php';
require_once plugin_dir_path( __FILE__ ) . '/../activities.php';
require_once plugin_dir_path( __FILE__ ) . '/../actors.php';
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '/../likes.php';
require_once plugin_dir_path( __FILE__ ) . '/../following.php';
require_once plugin_dir_path( __FILE__ ) . '/../followers.php';
require_once plugin_dir_path( __FILE__ ) . '../../util.php';
require_once plugin_dir_path( __FILE__ ) . '../activities.php';
require_once plugin_dir_path( __FILE__ ) . '../actors.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../likes.php';
require_once plugin_dir_path( __FILE__ ) . '../following.php';
require_once plugin_dir_path( __FILE__ ) . '../followers.php';
function handle_outbox( $actor_slug, $activity ) {
$object = validate_undo( $activity );

View File

@ -1,7 +1,7 @@
<?php
namespace activities\update;
require_once plugin_dir_path( __FILE__ ) . '/../objects.php';
require_once plugin_dir_path( __FILE__ ) . '../objects.php';
function handle_outbox( $actor_slug, $activity ) {
if ( !(array_key_exists( 'type', $activity ) && $activity['type'] === 'Update') ) {

View File

@ -1,13 +1,13 @@
<?php
namespace api;
require_once plugin_dir_path( __FILE__ ) . '/actors.php';
require_once plugin_dir_path( __FILE__ ) . '/outbox.php';
require_once plugin_dir_path( __FILE__ ) . '/objects.php';
require_once plugin_dir_path( __FILE__ ) . '/activities.php';
require_once plugin_dir_path( __FILE__ ) . '/following.php';
require_once plugin_dir_path( __FILE__ ) . '/likes.php';
require_once plugin_dir_path( __FILE__ ) . '/shares.php';
require_once plugin_dir_path( __FILE__ ) . 'actors.php';
require_once plugin_dir_path( __FILE__ ) . 'outbox.php';
require_once plugin_dir_path( __FILE__ ) . 'objects.php';
require_once plugin_dir_path( __FILE__ ) . 'activities.php';
require_once plugin_dir_path( __FILE__ ) . 'following.php';
require_once plugin_dir_path( __FILE__ ) . 'likes.php';
require_once plugin_dir_path( __FILE__ ) . 'shares.php';
function get_actor( $request ) {
$actor = $request['actor'];

View File

@ -2,12 +2,14 @@
namespace deliver;
require_once plugin_dir_path( __FILE__ ) . 'activities.php';
require_once plugin_dir_path( __FILE__ ) . '../util.php';
// TODO look at inReplyTo, object, target, and tag objects
// and deliver to their audience as well. Recurse through these
// objects up to some limit
function deliver_activity( $activity ) {
$activity = \util\dereference_object( $activity );
$recipients = array();
foreach ( array( 'to', 'bto', 'cc', 'bcc', 'audience' ) as $field ) {
$recipients = array_merge(

View File

@ -1,8 +1,8 @@
<?php
namespace followers;
require_once plugin_dir_path( __FILE__ ) . '/actors.php';
require_once plugin_dir_path( __FILE__ ) . '/objects.php';
require_once plugin_dir_path( __FILE__ ) . 'actors.php';
require_once plugin_dir_path( __FILE__ ) . 'objects.php';
function add_follower( $actor_slug, $follower ) {
global $wpdb;

View File

@ -1,7 +1,7 @@
<?php
namespace following;
require_once plugin_dir_path( __FILE__ ) . '/collections.php';
require_once plugin_dir_path( __FILE__ ) . 'collections.php';
define( 'PTEROTYPE_FOLLOW_PENDING', 'PENDING' );
define( 'PTEROTYPE_FOLLOW_FOLLOWING', 'FOLLOWING' );

View File

@ -9,17 +9,17 @@ When an Activity is received (i.e. POSTed) to an Actor's inbox, the server must:
*/
namespace inbox;
require_once plugin_dir_path( __FILE__ ) . '/activities.php';
require_once plugin_dir_path( __FILE__ ) . '/objects.php';
require_once plugin_dir_path( __FILE__ ) . '/deliver.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/create.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/update.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/delete.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/follow.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/accept.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/reject.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/announce.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/undo.php';
require_once plugin_dir_path( __FILE__ ) . 'activities.php';
require_once plugin_dir_path( __FILE__ ) . 'objects.php';
require_once plugin_dir_path( __FILE__ ) . 'deliver.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/create.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/update.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/delete.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/follow.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/accept.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/reject.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/announce.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/undo.php';
function handle_activity( $actor_slug, $activity ) {
if ( !array_key_exists( 'type', $activity ) ) {

View File

@ -1,7 +1,7 @@
<?php
namespace likes;
require_once plugin_dir_path( __FILE__ ) . '/collections.php';
require_once plugin_dir_path( __FILE__ ) . 'collections.php';
function create_local_actor_like( $actor_id, $object_id ) {
global $wpdb;

View File

@ -12,16 +12,16 @@ When an Activity is received (i.e. POSTed) to an Actor's outbox, the server must
*/
namespace outbox;
require_once plugin_dir_path( __FILE__ ) . '/activities.php';
require_once plugin_dir_path( __FILE__ ) . '/actors.php';
require_once plugin_dir_path( __FILE__ ) . '/deliver.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/create.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/update.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/delete.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/like.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/follow.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/block.php';
require_once plugin_dir_path( __FILE__ ) . '/activities/undo.php';
require_once plugin_dir_path( __FILE__ ) . 'activities.php';
require_once plugin_dir_path( __FILE__ ) . 'actors.php';
require_once plugin_dir_path( __FILE__ ) . 'deliver.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/create.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/update.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/delete.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/like.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/follow.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/block.php';
require_once plugin_dir_path( __FILE__ ) . 'activities/undo.php';
function handle_activity( $actor_slug, $activity ) {
// TODO handle authentication/authorization

View File

@ -1,7 +1,7 @@
<?php
namespace shares;
require_once plugin_dir_path( __FILE__ ) . '/collections.php';
require_once plugin_dir_path( __FILE__ ) . 'collections.php';
function add_share( $object_id, $activity_id ) {
global $wpdb;