Changeset 2920184
- Timestamp:
- 06/01/2023 02:54:31 PM (3 years ago)
- Location:
- appful-app
- Files:
-
- 12 added
- 57 edited
- 42 copied
-
tags/3.1.0 (copied) (copied from appful-app/trunk)
-
tags/3.1.0/appful-app.php (copied) (copied from appful-app/trunk/appful-app.php) (1 diff)
-
tags/3.1.0/appful.log (copied) (copied from appful-app/trunk/appful.log)
-
tags/3.1.0/frontend/scripts/user.js (copied) (copied from appful-app/trunk/frontend/scripts/user.js)
-
tags/3.1.0/frontend/templates/appful_menu_page.html.twig (copied) (copied from appful-app/trunk/frontend/templates/appful_menu_page.html.twig)
-
tags/3.1.0/includes/api/Api.php (copied) (copied from appful-app/trunk/includes/api/Api.php)
-
tags/3.1.0/includes/api/Endpoints.php (copied) (copied from appful-app/trunk/includes/api/Endpoints.php) (2 diffs)
-
tags/3.1.0/includes/api/ReqHandler.php (copied) (copied from appful-app/trunk/includes/api/ReqHandler.php) (2 diffs)
-
tags/3.1.0/includes/api/client/BackendClient.php (modified) (3 diffs)
-
tags/3.1.0/includes/api/client/SelfClient.php (added)
-
tags/3.1.0/includes/api/dtos/BlogHooksDto.php (copied) (copied from appful-app/trunk/includes/api/dtos/BlogHooksDto.php)
-
tags/3.1.0/includes/api/dtos/BlogInfoDto.php (copied) (copied from appful-app/trunk/includes/api/dtos/BlogInfoDto.php)
-
tags/3.1.0/includes/api/handlers/AuthenticateUserRequestHandler.php (copied) (copied from appful-app/trunk/includes/api/handlers/AuthenticateUserRequestHandler.php)
-
tags/3.1.0/includes/api/handlers/ClearLogRequestHandler.php (copied) (copied from appful-app/trunk/includes/api/handlers/ClearLogRequestHandler.php)
-
tags/3.1.0/includes/api/handlers/PullLocalPostContentRequestHandler.php (added)
-
tags/3.1.0/includes/api/mapper/BlogHooksMapper.php (copied) (copied from appful-app/trunk/includes/api/mapper/BlogHooksMapper.php)
-
tags/3.1.0/includes/api/mapper/BlogInfoMapper.php (copied) (copied from appful-app/trunk/includes/api/mapper/BlogInfoMapper.php)
-
tags/3.1.0/includes/api/reponses/HttpResponse.php (added)
-
tags/3.1.0/includes/api/requests/HttpRequest.php (added)
-
tags/3.1.0/includes/domain/AuthenticateRequest.php (copied) (copied from appful-app/trunk/includes/domain/AuthenticateRequest.php)
-
tags/3.1.0/includes/domain/BlogHooks.php (copied) (copied from appful-app/trunk/includes/domain/BlogHooks.php)
-
tags/3.1.0/includes/domain/BlogInfo.php (copied) (copied from appful-app/trunk/includes/domain/BlogInfo.php)
-
tags/3.1.0/includes/helper/ClientTokenManager.php (copied) (copied from appful-app/trunk/includes/helper/ClientTokenManager.php)
-
tags/3.1.0/includes/helper/Constants.php (copied) (copied from appful-app/trunk/includes/helper/Constants.php) (1 diff)
-
tags/3.1.0/includes/helper/Logger.php (copied) (copied from appful-app/trunk/includes/helper/Logger.php)
-
tags/3.1.0/includes/hooks/AttachmentHook.php (copied) (copied from appful-app/trunk/includes/hooks/AttachmentHook.php)
-
tags/3.1.0/includes/hooks/PostHook.php (copied) (copied from appful-app/trunk/includes/hooks/PostHook.php)
-
tags/3.1.0/includes/hooks/UserHook.php (copied) (copied from appful-app/trunk/includes/hooks/UserHook.php)
-
tags/3.1.0/includes/main/AppfulPlugin.php (copied) (copied from appful-app/trunk/includes/main/AppfulPlugin.php) (2 diffs)
-
tags/3.1.0/includes/menu/Menu.php (copied) (copied from appful-app/trunk/includes/menu/Menu.php)
-
tags/3.1.0/includes/use_cases/AttachmentDeleteUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/AttachmentSaveUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/AuthenticateUserUseCase.php (copied) (copied from appful-app/trunk/includes/use_cases/AuthenticateUserUseCase.php)
-
tags/3.1.0/includes/use_cases/CategoryDeleteUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/CategorySaveUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/ClearLogsUseCase.php (copied) (copied from appful-app/trunk/includes/use_cases/ClearLogsUseCase.php)
-
tags/3.1.0/includes/use_cases/CommentDeleteUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/CommentSaveUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/DeleteSessionUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/GetLocalPostContentByIdUseCase.php (added)
-
tags/3.1.0/includes/use_cases/GetPostContentsByIdUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/IsLoggedInUseCase.php (copied) (copied from appful-app/trunk/includes/use_cases/IsLoggedInUseCase.php)
-
tags/3.1.0/includes/use_cases/LogoutUserUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/PostDeleteUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/PostSaveUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/PullLocalPostContentUseCase.php (added)
-
tags/3.1.0/includes/use_cases/RegisterBlogUseCase.php (copied) (copied from appful-app/trunk/includes/use_cases/RegisterBlogUseCase.php) (2 diffs)
-
tags/3.1.0/includes/use_cases/SendAttachmentChunkSyncUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/SendCategoryChunkSyncUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/SendCommentChunkSyncUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/SendPostChunkSyncUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/SendTagChunkSyncUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/SendUserChunkSyncUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/SyncAllUseCase.php (copied) (copied from appful-app/trunk/includes/use_cases/SyncAllUseCase.php)
-
tags/3.1.0/includes/use_cases/TagDeleteUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/TagSaveUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/UseCaseManager.php (copied) (copied from appful-app/trunk/includes/use_cases/UseCaseManager.php) (4 diffs)
-
tags/3.1.0/includes/use_cases/UserDeleteUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/use_cases/UserSaveUseCase.php (modified) (2 diffs)
-
tags/3.1.0/includes/wp/WPBlogManager.php (copied) (copied from appful-app/trunk/includes/wp/WPBlogManager.php) (1 diff)
-
tags/3.1.0/includes/wp/WPOptionsManager.php (copied) (copied from appful-app/trunk/includes/wp/WPOptionsManager.php)
-
tags/3.1.0/includes/wp/WPPostManager.php (modified) (1 diff)
-
tags/3.1.0/includes/wp/WPUserManager.php (copied) (copied from appful-app/trunk/includes/wp/WPUserManager.php)
-
tags/3.1.0/lib/vendor/autoload.php (copied) (copied from appful-app/trunk/lib/vendor/autoload.php)
-
tags/3.1.0/lib/vendor/composer/ClassLoader.php (copied) (copied from appful-app/trunk/lib/vendor/composer/ClassLoader.php)
-
tags/3.1.0/lib/vendor/composer/autoload_classmap.php (copied) (copied from appful-app/trunk/lib/vendor/composer/autoload_classmap.php) (5 diffs)
-
tags/3.1.0/lib/vendor/composer/autoload_psr4.php (copied) (copied from appful-app/trunk/lib/vendor/composer/autoload_psr4.php)
-
tags/3.1.0/lib/vendor/composer/autoload_real.php (copied) (copied from appful-app/trunk/lib/vendor/composer/autoload_real.php)
-
tags/3.1.0/lib/vendor/composer/autoload_static.php (copied) (copied from appful-app/trunk/lib/vendor/composer/autoload_static.php) (5 diffs)
-
tags/3.1.0/lib/vendor/composer/installed.php (copied) (copied from appful-app/trunk/lib/vendor/composer/installed.php)
-
tags/3.1.0/readme.txt (copied) (copied from appful-app/trunk/readme.txt) (1 diff)
-
trunk/appful-app.php (modified) (1 diff)
-
trunk/includes/api/Endpoints.php (modified) (2 diffs)
-
trunk/includes/api/ReqHandler.php (modified) (2 diffs)
-
trunk/includes/api/client/BackendClient.php (modified) (3 diffs)
-
trunk/includes/api/client/SelfClient.php (added)
-
trunk/includes/api/handlers/PullLocalPostContentRequestHandler.php (added)
-
trunk/includes/api/reponses/HttpResponse.php (added)
-
trunk/includes/api/requests/HttpRequest.php (added)
-
trunk/includes/helper/Constants.php (modified) (1 diff)
-
trunk/includes/main/AppfulPlugin.php (modified) (2 diffs)
-
trunk/includes/use_cases/AttachmentDeleteUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/AttachmentSaveUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/CategoryDeleteUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/CategorySaveUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/CommentDeleteUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/CommentSaveUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/DeleteSessionUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/GetLocalPostContentByIdUseCase.php (added)
-
trunk/includes/use_cases/GetPostContentsByIdUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/LogoutUserUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/PostDeleteUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/PostSaveUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/PullLocalPostContentUseCase.php (added)
-
trunk/includes/use_cases/RegisterBlogUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/SendAttachmentChunkSyncUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/SendCategoryChunkSyncUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/SendCommentChunkSyncUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/SendPostChunkSyncUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/SendTagChunkSyncUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/SendUserChunkSyncUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/TagDeleteUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/TagSaveUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/UseCaseManager.php (modified) (4 diffs)
-
trunk/includes/use_cases/UserDeleteUseCase.php (modified) (2 diffs)
-
trunk/includes/use_cases/UserSaveUseCase.php (modified) (2 diffs)
-
trunk/includes/wp/WPBlogManager.php (modified) (1 diff)
-
trunk/includes/wp/WPPostManager.php (modified) (1 diff)
-
trunk/lib/vendor/composer/autoload_classmap.php (modified) (5 diffs)
-
trunk/lib/vendor/composer/autoload_static.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
appful-app/tags/3.1.0/appful-app.php
r2920030 r2920184 12 12 * Plugin URI: https://appful.io 13 13 * Description: Appful® is the number 1 plugin for turning your WordPress Content into a native, beautiful app on iOS & Android in under 5 minutes. 14 * Version: 3. 0.014 * Version: 3.1.0 15 15 * Requires at least: 5.8 16 16 * Requires PHP: 7.4 -
appful-app/tags/3.1.0/includes/api/Endpoints.php
r2920030 r2920184 22 22 public static string $GET_POSTS = "get-post"; 23 23 public static string $GET_POST_CONTENTS = "get-post-content"; 24 public static string $GET_POST_CONTENT_LOCAL = "get-post-content-local"; 24 25 public static string $GET_USERS = "get-user"; 25 26 public static string $GET_TAGS = "get-tag"; … … 29 30 30 31 31 public static string $HOOK = "/appful/api /";32 public static string $HOOK = "/appful/api"; 32 33 public static string $CREATE_COMMENT = "create-comment"; 33 34 public static string $AUTHENTICATE_USER = "authenticate-user"; -
appful-app/tags/3.1.0/includes/api/ReqHandler.php
r2920030 r2920184 20 20 use AppfulPlugin\Api\Handlers\LogRequestHandler; 21 21 use AppfulPlugin\Api\Handlers\PostSyncRequestHandler; 22 use AppfulPlugin\Api\Handlers\PullLocalPostContentRequestHandler; 22 23 use AppfulPlugin\Api\Handlers\RequestHandler; 23 24 use AppfulPlugin\Api\Handlers\SyncRequestHandler; … … 54 55 new ClearLogRequestHandler( $use_case_manager->get_clear_logs_use_case() ), 55 56 new AuthenticateUserRequestHandler( $use_case_manager->get_authenticate_user_use_case() ), 57 new PullLocalPostContentRequestHandler( $use_case_manager->get_get_local_post_content_by_id_use_case() ), 56 58 ]; 57 59 } -
appful-app/tags/3.1.0/includes/api/client/BackendClient.php
r2907312 r2920184 3 3 namespace AppfulPlugin\Api\Client; 4 4 5 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Responses\ BackendResponse;5 use AppfulPlugin\Api\Requests\HttpRequest; 6 use AppfulPlugin\Api\Responses\HttpResponse; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 25 25 } 26 26 27 public function send_request( BackendRequest $backend_request ): BackendResponse {27 public function send_request( HttpRequest $backend_request ): HttpResponse { 28 28 try { 29 29 if ( ! $backend_request->has_header( "Authorization" ) ) { … … 42 42 } 43 43 44 return BackendResponse::backend_response()->body( json_decode( $response->getBody(), true ) )->status( $response->getStatusCode() );44 return HttpResponse::backend_response()->body( json_decode( $response->getBody(), true ) )->status( $response->getStatusCode() ); 45 45 } catch ( GuzzleException $e ) { 46 46 Logger::log( "Error happened when trying to execute backend request: " . $e->getMessage() ); 47 47 48 return BackendResponse::backend_response()->status( 500 );48 return HttpResponse::backend_response()->status( 500 ); 49 49 } 50 50 } -
appful-app/tags/3.1.0/includes/helper/Constants.php
r2920030 r2920184 35 35 public static string $API_VERSION_1 = "/v1"; 36 36 37 public static int $POST_SYNC_CHUNK_SIZE = 200;37 public static int $POST_SYNC_CHUNK_SIZE = 70; 38 38 public static int $COMMENT_SYNC_CHUNK_SIZE = 100; 39 39 public static int $ATTACHMENT_SYNC_CHUNK_SIZE = 200; -
appful-app/tags/3.1.0/includes/main/AppfulPlugin.php
r2920030 r2920184 5 5 use AppfulPlugin\Api\Api; 6 6 use AppfulPlugin\Api\Client\BackendClient; 7 use AppfulPlugin\Api\Client\SelfClient; 7 8 use AppfulPlugin\Api\ReqHandler; 8 9 use AppfulPlugin\Api\Rewrites; … … 27 28 $rewrites = new Rewrites(); 28 29 $backend_client = new BackendClient(); 29 $this->use_case_manager = new UseCaseManager( $backend_client ); 30 $self_client = new SelfClient(); 31 $this->use_case_manager = new UseCaseManager( $backend_client, $self_client ); 30 32 $api_request_handler = new ReqHandler( $this->use_case_manager ); 31 33 -
appful-app/tags/3.1.0/includes/use_cases/AttachmentDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( string $attachment_id ) { 18 18 Logger::log( "Sending attachment delete request for: " . $attachment_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$ATTACHMENT_PATH . "/" . $attachment_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$ATTACHMENT_PATH . "/" . $attachment_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/AttachmentSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\AttachmentMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Attachment; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $attachment_dto = AttachmentMapper::to_dto( $attachment ); 21 21 Logger::log( "Sending attachment save request with data: " . json_encode( $attachment_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $attachment_dto )->path( Constants::$ATTACHMENT_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $attachment_dto )->path( Constants::$ATTACHMENT_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/tags/3.1.0/includes/use_cases/CategoryDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( int $term_id ) { 18 18 Logger::log( "Sending category delete request for: " . $term_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/categories/" . $term_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/categories/" . $term_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/CategorySaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\CategoryMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Category; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $category_dto = CategoryMapper::to_dto( $category ); 21 21 Logger::log( "Sending category save request with data: " . json_encode( $category_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $category_dto )->path( Constants::$TAXONOMY_PATH . "/categories" );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $category_dto )->path( Constants::$TAXONOMY_PATH . "/categories" ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/tags/3.1.0/includes/use_cases/CommentDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( string $comment_id ) { 18 18 Logger::log( "Sending comment delete request for: " . $comment_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$COMMENT_PATH . "/" . $comment_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$COMMENT_PATH . "/" . $comment_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/CommentSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\CommentMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Comment; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $comment_dto = CommentMapper::to_dto( $comment ); 21 21 Logger::log( "Sending comment save request with data: " . json_encode( $comment_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $comment_dto )->path( Constants::$COMMENT_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $comment_dto )->path( Constants::$COMMENT_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/tags/3.1.0/includes/use_cases/DeleteSessionUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 18 18 public function invoke() { 19 19 Logger::log("Unregistering blog!"); 20 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$BLOG_PATH );20 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$BLOG_PATH ); 21 21 $this->backend_client->send_request( $request ); 22 22 } -
appful-app/tags/3.1.0/includes/use_cases/GetPostContentsByIdUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Domain\PostContent; 6 use AppfulPlugin\Wp\WPPostManager;7 6 8 7 class GetPostContentsByIdUseCase { 8 private PullLocalPostContentUseCase $pull_local_post_content_use_case; 9 10 public function __construct( PullLocalPostContentUseCase $pull_local_post_content_use_case ) { 11 $this->pull_local_post_content_use_case = $pull_local_post_content_use_case; 12 } 13 14 9 15 /** 10 16 * @param int[] $ids … … 13 19 */ 14 20 public function invoke( array $ids ): array { 15 return WPPostManager::get_post_contents_by_id( $ids ); 21 $post_contents = []; 22 23 foreach ( $ids as $post_id ) { 24 $response = $this->pull_local_post_content_use_case->invoke( $post_id ); 25 if ( $response != null ) { 26 $post_contents[] = $response; 27 } 28 } 29 30 return $post_contents; 16 31 } 17 32 } -
appful-app/tags/3.1.0/includes/use_cases/LogoutUserUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke() { 18 18 Logger::log( "Logout user!" ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$APPFUL_USER_PATH . "/logout" );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$APPFUL_USER_PATH . "/logout" ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/PostDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( int $post_id ) { 18 18 Logger::log( "Sending post delete request for: " . $post_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$POST_PATH . "/" . $post_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$POST_PATH . "/" . $post_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/PostSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\PostMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Post; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $post_dto = PostMapper::to_dto( $post ); 21 21 Logger::log( "Sending post save request with data: " . json_encode( $post_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $post_dto )->path( Constants::$POST_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $post_dto )->path( Constants::$POST_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/tags/3.1.0/includes/use_cases/RegisterBlogUseCase.php
r2920030 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\BlogInfoMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Helper\Constants; 9 9 use AppfulPlugin\Helper\Logger; … … 22 22 $blog_info_dto = BlogInfoMapper::to_dto( $blog_info ); 23 23 Logger::log( "Registering blog with data: " . json_encode( $blog_info_dto ) ); 24 $request = BackendRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH );24 $request = HttpRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH ); 25 25 $body = $this->backend_client->send_request( $request )->get_body(); 26 26 if ( $body != null && isset( $body['blog_id'] ) ) { -
appful-app/tags/3.1.0/includes/use_cases/SendAttachmentChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending attachment chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$ATTACHMENT_PATH . "/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$ATTACHMENT_PATH . "/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/tags/3.1.0/includes/use_cases/SendCategoryChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending category chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/categories/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/categories/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/tags/3.1.0/includes/use_cases/SendCommentChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending comment chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$COMMENT_PATH . "/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$COMMENT_PATH . "/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/tags/3.1.0/includes/use_cases/SendPostChunkSyncUseCase.php
r2907312 r2920184 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 7 use AppfulPlugin\Api\Mapper\SyncItemMapper; 8 use AppfulPlugin\Api\Requests\ BackendRequest;8 use AppfulPlugin\Api\Requests\HttpRequest; 9 9 use AppfulPlugin\Domain\SyncChunk; 10 10 use AppfulPlugin\Domain\SyncItem; … … 23 23 24 24 Logger::log( "Sending post chunk to sync: " . json_encode( $sync_item_dtos ) ); 25 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$POST_PATH . "/sync" );25 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$POST_PATH . "/sync" ); 26 26 $this->backend_client->send_request( $request ); 27 27 } -
appful-app/tags/3.1.0/includes/use_cases/SendTagChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending tag chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/tags/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/tags/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/tags/3.1.0/includes/use_cases/SendUserChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending user chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$USER_PATH . "/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$USER_PATH . "/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/tags/3.1.0/includes/use_cases/TagDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( int $term_id ) { 18 18 Logger::log( "Sending tag delete request for: " . $term_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/tags/" . $term_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/tags/" . $term_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/TagSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\TagMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Tag; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $tag_dto = TagMapper::to_dto( $tag ); 21 21 Logger::log( "Sending tag save request with data: " . json_encode( $tag_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $tag_dto )->path( Constants::$TAXONOMY_PATH . "/tags" );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $tag_dto )->path( Constants::$TAXONOMY_PATH . "/tags" ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/tags/3.1.0/includes/use_cases/UseCaseManager.php
r2920030 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Client\SelfClient; 6 7 7 8 class UseCaseManager { … … 54 55 private ClearLogsUseCase $clear_logs_use_case; 55 56 private AuthenticateUserUseCase $authenticate_user_use_case; 56 57 public function __construct( BackendClient $backend_client ) { 57 private PullLocalPostContentUseCase $pull_local_post_content_use_case; 58 private GetLocalPostContentByIdUseCase $get_local_post_content_by_id_use_case; 59 60 public function __construct( BackendClient $backend_client, SelfClient $self_client ) { 58 61 $this->get_android_asset_link_use_case = new GetAndroidAssetLinkUseCase(); 59 62 $this->get_apple_app_site_association_use_case = new GetAppleAppSiteAssociationUseCase(); … … 101 104 $this->user_delete_use_case = new UserDeleteUseCase( $backend_client ); 102 105 $this->user_save_use_case = new UserSaveUseCase( $backend_client ); 103 $this->get_post_contents_by_id_use_case = new GetPostContentsByIdUseCase();104 106 $this->clear_logs_use_case = new ClearLogsUseCase(); 105 107 $this->authenticate_user_use_case = new AuthenticateUserUseCase(); 108 $this->pull_local_post_content_use_case = new PullLocalPostContentUseCase( $self_client ); 109 $this->get_local_post_content_by_id_use_case = new GetLocalPostContentByIdUseCase(); 110 $this->get_post_contents_by_id_use_case = new GetPostContentsByIdUseCase( $this->pull_local_post_content_use_case ); 106 111 } 107 112 … … 297 302 return $this->authenticate_user_use_case; 298 303 } 304 305 public function get_pull_local_post_content_use_case(): PullLocalPostContentUseCase { 306 return $this->pull_local_post_content_use_case; 307 } 308 309 public function get_get_local_post_content_by_id_use_case(): GetLocalPostContentByIdUseCase { 310 return $this->get_local_post_content_by_id_use_case; 311 } 299 312 } -
appful-app/tags/3.1.0/includes/use_cases/UserDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( string $user_id ) { 18 18 Logger::log( "Sending user delete request for: " . $user_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$USER_PATH . "/" . $user_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$USER_PATH . "/" . $user_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/tags/3.1.0/includes/use_cases/UserSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\UserMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\User; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $user_dto = UserMapper::to_dto( $user ); 21 21 Logger::log( "Sending user save request with data: " . json_encode( $user_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $user_dto )->path( Constants::$USER_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $user_dto )->path( Constants::$USER_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/tags/3.1.0/includes/wp/WPBlogManager.php
r2920030 r2920184 21 21 private static function get_hooks(): BlogHooks { 22 22 return BlogHooks::blog_hooks() 23 ->create_comment( self::get_site_url() . Endpoints::$HOOK . Endpoints::$CREATE_COMMENT )24 ->authenticate_user( self::get_site_url() . Endpoints::$HOOK . Endpoints::$AUTHENTICATE_USER );23 ->create_comment( self::get_site_url() . Endpoints::$HOOK . "/" . Endpoints::$CREATE_COMMENT ) 24 ->authenticate_user( self::get_site_url() . Endpoints::$HOOK . "/" . Endpoints::$AUTHENTICATE_USER ); 25 25 } 26 26 -
appful-app/tags/3.1.0/includes/wp/WPPostManager.php
r2907312 r2920184 86 86 } 87 87 88 /** 89 * @param int[] $ids 90 * 91 * @return PostContent[] 92 */ 93 public static function get_post_contents_by_id( array $ids ): array { 94 return self::pullPostByIds( $ids ); 95 } 96 97 /** 98 * @param int[] $ids 99 * 100 * @return PostContent[] 101 */ 102 private static function pullPostByIds( array $ids ): array { 88 public static function get_post_content_by_id( int $id ): ?PostContent { 103 89 global $wp_query; 104 105 $postContents = [];106 90 107 91 do_action( 'template_redirect' ); 108 92 109 foreach ( $ids as $post_id ) { 110 $args = [ 111 "posts_per_page" => 1, 112 "post_type" => "post", 113 "p" => $post_id, 114 "post_status" => self::get_allowed_post_stati() 115 ]; 93 $args = [ 94 "posts_per_page" => 1, 95 "post_type" => "post", 96 "p" => $id, 97 "post_status" => self::get_allowed_post_stati() 98 ]; 116 99 117 $wp_query = new \WP_Query( $args );118 while( have_posts() ) {119 the_post();100 $wp_query = new \WP_Query( $args ); 101 if ( have_posts() ) { 102 the_post(); 120 103 121 ob_start();122 wp_head();123 $head = ob_get_clean();104 ob_start(); 105 wp_head(); 106 $head = ob_get_clean(); 124 107 125 ob_start();126 the_content();127 $content = ob_get_clean();108 ob_start(); 109 the_content(); 110 $content = ob_get_clean(); 128 111 129 ob_start();130 wp_footer();131 $footer = ob_get_clean();112 ob_start(); 113 wp_footer(); 114 $footer = ob_get_clean(); 132 115 133 ob_start(); 134 body_class(); 135 $body_class = ob_get_clean(); 136 137 $postContents[] = PostContent::postContent() 138 ->id( get_the_ID() ) 139 ->content( $content ) 140 ->head( $head ) 141 ->footer( $footer ) 142 ->body_class( $body_class ); 143 } 116 ob_start(); 117 body_class(); 118 $body_class = ob_get_clean(); 144 119 145 120 wp_reset_postdata(); 121 122 return PostContent::postContent() 123 ->id( get_the_ID() ) 124 ->content( $content ) 125 ->head( $head ) 126 ->footer( $footer ) 127 ->body_class( $body_class ); 146 128 } 147 129 148 return $postContents;130 return null; 149 131 } 150 132 -
appful-app/tags/3.1.0/lib/vendor/composer/autoload_classmap.php
r2920030 r2920184 9 9 'AppfulPlugin\\Api\\Api' => $baseDir . '/../includes/api/Api.php', 10 10 'AppfulPlugin\\Api\\Client\\BackendClient' => $baseDir . '/../includes/api/client/BackendClient.php', 11 'AppfulPlugin\\Api\\Client\\SelfClient' => $baseDir . '/../includes/api/client/SelfClient.php', 11 12 'AppfulPlugin\\Api\\Dtos\\AttachmentDto' => $baseDir . '/../includes/api/dtos/AttachmentDto.php', 12 13 'AppfulPlugin\\Api\\Dtos\\BlogHooksDto' => $baseDir . '/../includes/api/dtos/BlogHooksDto.php', … … 39 40 'AppfulPlugin\\Api\\Handlers\\LogRequestHandler' => $baseDir . '/../includes/api/handlers/LogRequestHandler.php', 40 41 'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => $baseDir . '/../includes/api/handlers/PostSyncRequestHandler.php', 42 'AppfulPlugin\\Api\\Handlers\\PullLocalPostContentRequestHandler' => $baseDir . '/../includes/api/handlers/PullLocalPostContentRequestHandler.php', 41 43 'AppfulPlugin\\Api\\Handlers\\RequestHandler' => $baseDir . '/../includes/api/handlers/RequestHandler.php', 42 44 'AppfulPlugin\\Api\\Handlers\\SyncRequestHandler' => $baseDir . '/../includes/api/handlers/SyncRequestHandler.php', … … 55 57 'AppfulPlugin\\Api\\Mapper\\UserMapper' => $baseDir . '/../includes/api/mapper/UserMapper.php', 56 58 'AppfulPlugin\\Api\\ReqHandler' => $baseDir . '/../includes/api/ReqHandler.php', 57 'AppfulPlugin\\Api\\Requests\\ BackendRequest' => $baseDir . '/../includes/api/requests/BackendRequest.php',59 'AppfulPlugin\\Api\\Requests\\HttpRequest' => $baseDir . '/../includes/api/requests/HttpRequest.php', 58 60 'AppfulPlugin\\Api\\Requests\\PluginRequest' => $baseDir . '/../includes/api/requests/PluginRequest.php', 59 'AppfulPlugin\\Api\\Responses\\ BackendResponse' => $baseDir . '/../includes/api/reponses/BackendResponse.php',61 'AppfulPlugin\\Api\\Responses\\HttpResponse' => $baseDir . '/../includes/api/reponses/HttpResponse.php', 60 62 'AppfulPlugin\\Api\\Responses\\PluginResponse' => $baseDir . '/../includes/api/reponses/PluginResponse.php', 61 63 'AppfulPlugin\\Api\\Rewrites' => $baseDir . '/../includes/api/Rewrites.php', … … 111 113 'AppfulPlugin\\UseCases\\GetCommentSyncDataUseCase' => $baseDir . '/../includes/use_cases/GetCommentSyncDataUseCase.php', 112 114 'AppfulPlugin\\UseCases\\GetCommentsByIdUseCase' => $baseDir . '/../includes/use_cases/GetCommentsByIdUseCase.php', 115 'AppfulPlugin\\UseCases\\GetLocalPostContentByIdUseCase' => $baseDir . '/../includes/use_cases/GetLocalPostContentByIdUseCase.php', 113 116 'AppfulPlugin\\UseCases\\GetLogsUseCase' => $baseDir . '/../includes/use_cases/GetLogsUseCase.php', 114 117 'AppfulPlugin\\UseCases\\GetPostContentsByIdUseCase' => $baseDir . '/../includes/use_cases/GetPostContentsByIdUseCase.php', … … 123 126 'AppfulPlugin\\UseCases\\PostDeleteUseCase' => $baseDir . '/../includes/use_cases/PostDeleteUseCase.php', 124 127 'AppfulPlugin\\UseCases\\PostSaveUseCase' => $baseDir . '/../includes/use_cases/PostSaveUseCase.php', 128 'AppfulPlugin\\UseCases\\PullLocalPostContentUseCase' => $baseDir . '/../includes/use_cases/PullLocalPostContentUseCase.php', 125 129 'AppfulPlugin\\UseCases\\RegisterBlogUseCase' => $baseDir . '/../includes/use_cases/RegisterBlogUseCase.php', 126 130 'AppfulPlugin\\UseCases\\SendAttachmentChunkSyncUseCase' => $baseDir . '/../includes/use_cases/SendAttachmentChunkSyncUseCase.php', -
appful-app/tags/3.1.0/lib/vendor/composer/autoload_static.php
r2920030 r2920184 176 176 'AppfulPlugin\\Api\\Api' => __DIR__ . '/../..' . '/../includes/api/Api.php', 177 177 'AppfulPlugin\\Api\\Client\\BackendClient' => __DIR__ . '/../..' . '/../includes/api/client/BackendClient.php', 178 'AppfulPlugin\\Api\\Client\\SelfClient' => __DIR__ . '/../..' . '/../includes/api/client/SelfClient.php', 178 179 'AppfulPlugin\\Api\\Dtos\\AttachmentDto' => __DIR__ . '/../..' . '/../includes/api/dtos/AttachmentDto.php', 179 180 'AppfulPlugin\\Api\\Dtos\\BlogHooksDto' => __DIR__ . '/../..' . '/../includes/api/dtos/BlogHooksDto.php', … … 206 207 'AppfulPlugin\\Api\\Handlers\\LogRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/LogRequestHandler.php', 207 208 'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PostSyncRequestHandler.php', 209 'AppfulPlugin\\Api\\Handlers\\PullLocalPostContentRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PullLocalPostContentRequestHandler.php', 208 210 'AppfulPlugin\\Api\\Handlers\\RequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/RequestHandler.php', 209 211 'AppfulPlugin\\Api\\Handlers\\SyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/SyncRequestHandler.php', … … 222 224 'AppfulPlugin\\Api\\Mapper\\UserMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/UserMapper.php', 223 225 'AppfulPlugin\\Api\\ReqHandler' => __DIR__ . '/../..' . '/../includes/api/ReqHandler.php', 224 'AppfulPlugin\\Api\\Requests\\ BackendRequest' => __DIR__ . '/../..' . '/../includes/api/requests/BackendRequest.php',226 'AppfulPlugin\\Api\\Requests\\HttpRequest' => __DIR__ . '/../..' . '/../includes/api/requests/HttpRequest.php', 225 227 'AppfulPlugin\\Api\\Requests\\PluginRequest' => __DIR__ . '/../..' . '/../includes/api/requests/PluginRequest.php', 226 'AppfulPlugin\\Api\\Responses\\ BackendResponse' => __DIR__ . '/../..' . '/../includes/api/reponses/BackendResponse.php',228 'AppfulPlugin\\Api\\Responses\\HttpResponse' => __DIR__ . '/../..' . '/../includes/api/reponses/HttpResponse.php', 227 229 'AppfulPlugin\\Api\\Responses\\PluginResponse' => __DIR__ . '/../..' . '/../includes/api/reponses/PluginResponse.php', 228 230 'AppfulPlugin\\Api\\Rewrites' => __DIR__ . '/../..' . '/../includes/api/Rewrites.php', … … 278 280 'AppfulPlugin\\UseCases\\GetCommentSyncDataUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetCommentSyncDataUseCase.php', 279 281 'AppfulPlugin\\UseCases\\GetCommentsByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetCommentsByIdUseCase.php', 282 'AppfulPlugin\\UseCases\\GetLocalPostContentByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetLocalPostContentByIdUseCase.php', 280 283 'AppfulPlugin\\UseCases\\GetLogsUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetLogsUseCase.php', 281 284 'AppfulPlugin\\UseCases\\GetPostContentsByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetPostContentsByIdUseCase.php', … … 290 293 'AppfulPlugin\\UseCases\\PostDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PostDeleteUseCase.php', 291 294 'AppfulPlugin\\UseCases\\PostSaveUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PostSaveUseCase.php', 295 'AppfulPlugin\\UseCases\\PullLocalPostContentUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PullLocalPostContentUseCase.php', 292 296 'AppfulPlugin\\UseCases\\RegisterBlogUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/RegisterBlogUseCase.php', 293 297 'AppfulPlugin\\UseCases\\SendAttachmentChunkSyncUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/SendAttachmentChunkSyncUseCase.php', -
appful-app/tags/3.1.0/readme.txt
r2920030 r2920184 6 6 Tested up to: 6.2 7 7 Requires PHP: 7.4 8 Stable tag: 3. 0.08 Stable tag: 3.1.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
appful-app/trunk/appful-app.php
r2920030 r2920184 12 12 * Plugin URI: https://appful.io 13 13 * Description: Appful® is the number 1 plugin for turning your WordPress Content into a native, beautiful app on iOS & Android in under 5 minutes. 14 * Version: 3. 0.014 * Version: 3.1.0 15 15 * Requires at least: 5.8 16 16 * Requires PHP: 7.4 -
appful-app/trunk/includes/api/Endpoints.php
r2920030 r2920184 22 22 public static string $GET_POSTS = "get-post"; 23 23 public static string $GET_POST_CONTENTS = "get-post-content"; 24 public static string $GET_POST_CONTENT_LOCAL = "get-post-content-local"; 24 25 public static string $GET_USERS = "get-user"; 25 26 public static string $GET_TAGS = "get-tag"; … … 29 30 30 31 31 public static string $HOOK = "/appful/api /";32 public static string $HOOK = "/appful/api"; 32 33 public static string $CREATE_COMMENT = "create-comment"; 33 34 public static string $AUTHENTICATE_USER = "authenticate-user"; -
appful-app/trunk/includes/api/ReqHandler.php
r2920030 r2920184 20 20 use AppfulPlugin\Api\Handlers\LogRequestHandler; 21 21 use AppfulPlugin\Api\Handlers\PostSyncRequestHandler; 22 use AppfulPlugin\Api\Handlers\PullLocalPostContentRequestHandler; 22 23 use AppfulPlugin\Api\Handlers\RequestHandler; 23 24 use AppfulPlugin\Api\Handlers\SyncRequestHandler; … … 54 55 new ClearLogRequestHandler( $use_case_manager->get_clear_logs_use_case() ), 55 56 new AuthenticateUserRequestHandler( $use_case_manager->get_authenticate_user_use_case() ), 57 new PullLocalPostContentRequestHandler( $use_case_manager->get_get_local_post_content_by_id_use_case() ), 56 58 ]; 57 59 } -
appful-app/trunk/includes/api/client/BackendClient.php
r2907312 r2920184 3 3 namespace AppfulPlugin\Api\Client; 4 4 5 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Responses\ BackendResponse;5 use AppfulPlugin\Api\Requests\HttpRequest; 6 use AppfulPlugin\Api\Responses\HttpResponse; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 25 25 } 26 26 27 public function send_request( BackendRequest $backend_request ): BackendResponse {27 public function send_request( HttpRequest $backend_request ): HttpResponse { 28 28 try { 29 29 if ( ! $backend_request->has_header( "Authorization" ) ) { … … 42 42 } 43 43 44 return BackendResponse::backend_response()->body( json_decode( $response->getBody(), true ) )->status( $response->getStatusCode() );44 return HttpResponse::backend_response()->body( json_decode( $response->getBody(), true ) )->status( $response->getStatusCode() ); 45 45 } catch ( GuzzleException $e ) { 46 46 Logger::log( "Error happened when trying to execute backend request: " . $e->getMessage() ); 47 47 48 return BackendResponse::backend_response()->status( 500 );48 return HttpResponse::backend_response()->status( 500 ); 49 49 } 50 50 } -
appful-app/trunk/includes/helper/Constants.php
r2920030 r2920184 35 35 public static string $API_VERSION_1 = "/v1"; 36 36 37 public static int $POST_SYNC_CHUNK_SIZE = 200;37 public static int $POST_SYNC_CHUNK_SIZE = 70; 38 38 public static int $COMMENT_SYNC_CHUNK_SIZE = 100; 39 39 public static int $ATTACHMENT_SYNC_CHUNK_SIZE = 200; -
appful-app/trunk/includes/main/AppfulPlugin.php
r2920030 r2920184 5 5 use AppfulPlugin\Api\Api; 6 6 use AppfulPlugin\Api\Client\BackendClient; 7 use AppfulPlugin\Api\Client\SelfClient; 7 8 use AppfulPlugin\Api\ReqHandler; 8 9 use AppfulPlugin\Api\Rewrites; … … 27 28 $rewrites = new Rewrites(); 28 29 $backend_client = new BackendClient(); 29 $this->use_case_manager = new UseCaseManager( $backend_client ); 30 $self_client = new SelfClient(); 31 $this->use_case_manager = new UseCaseManager( $backend_client, $self_client ); 30 32 $api_request_handler = new ReqHandler( $this->use_case_manager ); 31 33 -
appful-app/trunk/includes/use_cases/AttachmentDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( string $attachment_id ) { 18 18 Logger::log( "Sending attachment delete request for: " . $attachment_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$ATTACHMENT_PATH . "/" . $attachment_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$ATTACHMENT_PATH . "/" . $attachment_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/AttachmentSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\AttachmentMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Attachment; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $attachment_dto = AttachmentMapper::to_dto( $attachment ); 21 21 Logger::log( "Sending attachment save request with data: " . json_encode( $attachment_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $attachment_dto )->path( Constants::$ATTACHMENT_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $attachment_dto )->path( Constants::$ATTACHMENT_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/trunk/includes/use_cases/CategoryDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( int $term_id ) { 18 18 Logger::log( "Sending category delete request for: " . $term_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/categories/" . $term_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/categories/" . $term_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/CategorySaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\CategoryMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Category; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $category_dto = CategoryMapper::to_dto( $category ); 21 21 Logger::log( "Sending category save request with data: " . json_encode( $category_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $category_dto )->path( Constants::$TAXONOMY_PATH . "/categories" );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $category_dto )->path( Constants::$TAXONOMY_PATH . "/categories" ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/trunk/includes/use_cases/CommentDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( string $comment_id ) { 18 18 Logger::log( "Sending comment delete request for: " . $comment_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$COMMENT_PATH . "/" . $comment_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$COMMENT_PATH . "/" . $comment_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/CommentSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\CommentMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Comment; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $comment_dto = CommentMapper::to_dto( $comment ); 21 21 Logger::log( "Sending comment save request with data: " . json_encode( $comment_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $comment_dto )->path( Constants::$COMMENT_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $comment_dto )->path( Constants::$COMMENT_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/trunk/includes/use_cases/DeleteSessionUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 18 18 public function invoke() { 19 19 Logger::log("Unregistering blog!"); 20 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$BLOG_PATH );20 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$BLOG_PATH ); 21 21 $this->backend_client->send_request( $request ); 22 22 } -
appful-app/trunk/includes/use_cases/GetPostContentsByIdUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Domain\PostContent; 6 use AppfulPlugin\Wp\WPPostManager;7 6 8 7 class GetPostContentsByIdUseCase { 8 private PullLocalPostContentUseCase $pull_local_post_content_use_case; 9 10 public function __construct( PullLocalPostContentUseCase $pull_local_post_content_use_case ) { 11 $this->pull_local_post_content_use_case = $pull_local_post_content_use_case; 12 } 13 14 9 15 /** 10 16 * @param int[] $ids … … 13 19 */ 14 20 public function invoke( array $ids ): array { 15 return WPPostManager::get_post_contents_by_id( $ids ); 21 $post_contents = []; 22 23 foreach ( $ids as $post_id ) { 24 $response = $this->pull_local_post_content_use_case->invoke( $post_id ); 25 if ( $response != null ) { 26 $post_contents[] = $response; 27 } 28 } 29 30 return $post_contents; 16 31 } 17 32 } -
appful-app/trunk/includes/use_cases/LogoutUserUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke() { 18 18 Logger::log( "Logout user!" ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$APPFUL_USER_PATH . "/logout" );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$APPFUL_USER_PATH . "/logout" ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/PostDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( int $post_id ) { 18 18 Logger::log( "Sending post delete request for: " . $post_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$POST_PATH . "/" . $post_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$POST_PATH . "/" . $post_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/PostSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\PostMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Post; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $post_dto = PostMapper::to_dto( $post ); 21 21 Logger::log( "Sending post save request with data: " . json_encode( $post_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $post_dto )->path( Constants::$POST_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $post_dto )->path( Constants::$POST_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/trunk/includes/use_cases/RegisterBlogUseCase.php
r2920030 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\BlogInfoMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Helper\Constants; 9 9 use AppfulPlugin\Helper\Logger; … … 22 22 $blog_info_dto = BlogInfoMapper::to_dto( $blog_info ); 23 23 Logger::log( "Registering blog with data: " . json_encode( $blog_info_dto ) ); 24 $request = BackendRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH );24 $request = HttpRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH ); 25 25 $body = $this->backend_client->send_request( $request )->get_body(); 26 26 if ( $body != null && isset( $body['blog_id'] ) ) { -
appful-app/trunk/includes/use_cases/SendAttachmentChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending attachment chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$ATTACHMENT_PATH . "/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$ATTACHMENT_PATH . "/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/trunk/includes/use_cases/SendCategoryChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending category chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/categories/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/categories/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/trunk/includes/use_cases/SendCommentChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending comment chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$COMMENT_PATH . "/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$COMMENT_PATH . "/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/trunk/includes/use_cases/SendPostChunkSyncUseCase.php
r2907312 r2920184 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 7 use AppfulPlugin\Api\Mapper\SyncItemMapper; 8 use AppfulPlugin\Api\Requests\ BackendRequest;8 use AppfulPlugin\Api\Requests\HttpRequest; 9 9 use AppfulPlugin\Domain\SyncChunk; 10 10 use AppfulPlugin\Domain\SyncItem; … … 23 23 24 24 Logger::log( "Sending post chunk to sync: " . json_encode( $sync_item_dtos ) ); 25 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$POST_PATH . "/sync" );25 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$POST_PATH . "/sync" ); 26 26 $this->backend_client->send_request( $request ); 27 27 } -
appful-app/trunk/includes/use_cases/SendTagChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending tag chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/tags/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$TAXONOMY_PATH . "/tags/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/trunk/includes/use_cases/SendUserChunkSyncUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\SyncChunkMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\SyncChunk; 9 9 use AppfulPlugin\Helper\Constants; … … 21 21 22 22 Logger::log( "Sending user chunk to sync: " . json_encode( $sync_item_dtos ) ); 23 $request = BackendRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$USER_PATH . "/sync" );23 $request = HttpRequest::backend_request()->method( "PATCH" )->body( $sync_item_dtos )->path( Constants::$USER_PATH . "/sync" ); 24 24 $this->backend_client->send_request( $request ); 25 25 } -
appful-app/trunk/includes/use_cases/TagDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( int $term_id ) { 18 18 Logger::log( "Sending tag delete request for: " . $term_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/tags/" . $term_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$TAXONOMY_PATH . "/tags/" . $term_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/TagSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\TagMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\Tag; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $tag_dto = TagMapper::to_dto( $tag ); 21 21 Logger::log( "Sending tag save request with data: " . json_encode( $tag_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $tag_dto )->path( Constants::$TAXONOMY_PATH . "/tags" );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $tag_dto )->path( Constants::$TAXONOMY_PATH . "/tags" ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/trunk/includes/use_cases/UseCaseManager.php
r2920030 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Client\SelfClient; 6 7 7 8 class UseCaseManager { … … 54 55 private ClearLogsUseCase $clear_logs_use_case; 55 56 private AuthenticateUserUseCase $authenticate_user_use_case; 56 57 public function __construct( BackendClient $backend_client ) { 57 private PullLocalPostContentUseCase $pull_local_post_content_use_case; 58 private GetLocalPostContentByIdUseCase $get_local_post_content_by_id_use_case; 59 60 public function __construct( BackendClient $backend_client, SelfClient $self_client ) { 58 61 $this->get_android_asset_link_use_case = new GetAndroidAssetLinkUseCase(); 59 62 $this->get_apple_app_site_association_use_case = new GetAppleAppSiteAssociationUseCase(); … … 101 104 $this->user_delete_use_case = new UserDeleteUseCase( $backend_client ); 102 105 $this->user_save_use_case = new UserSaveUseCase( $backend_client ); 103 $this->get_post_contents_by_id_use_case = new GetPostContentsByIdUseCase();104 106 $this->clear_logs_use_case = new ClearLogsUseCase(); 105 107 $this->authenticate_user_use_case = new AuthenticateUserUseCase(); 108 $this->pull_local_post_content_use_case = new PullLocalPostContentUseCase( $self_client ); 109 $this->get_local_post_content_by_id_use_case = new GetLocalPostContentByIdUseCase(); 110 $this->get_post_contents_by_id_use_case = new GetPostContentsByIdUseCase( $this->pull_local_post_content_use_case ); 106 111 } 107 112 … … 297 302 return $this->authenticate_user_use_case; 298 303 } 304 305 public function get_pull_local_post_content_use_case(): PullLocalPostContentUseCase { 306 return $this->pull_local_post_content_use_case; 307 } 308 309 public function get_get_local_post_content_by_id_use_case(): GetLocalPostContentByIdUseCase { 310 return $this->get_local_post_content_by_id_use_case; 311 } 299 312 } -
appful-app/trunk/includes/use_cases/UserDeleteUseCase.php
r2907312 r2920184 4 4 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 use AppfulPlugin\Api\Requests\ BackendRequest;6 use AppfulPlugin\Api\Requests\HttpRequest; 7 7 use AppfulPlugin\Helper\Constants; 8 8 use AppfulPlugin\Helper\Logger; … … 17 17 public function invoke( string $user_id ) { 18 18 Logger::log( "Sending user delete request for: " . $user_id ); 19 $request = BackendRequest::backend_request()->method( "DELETE" )->path( Constants::$USER_PATH . "/" . $user_id );19 $request = HttpRequest::backend_request()->method( "DELETE" )->path( Constants::$USER_PATH . "/" . $user_id ); 20 20 $this->backend_client->send_request( $request ); 21 21 } -
appful-app/trunk/includes/use_cases/UserSaveUseCase.php
r2907312 r2920184 5 5 use AppfulPlugin\Api\Client\BackendClient; 6 6 use AppfulPlugin\Api\Mapper\UserMapper; 7 use AppfulPlugin\Api\Requests\ BackendRequest;7 use AppfulPlugin\Api\Requests\HttpRequest; 8 8 use AppfulPlugin\Domain\User; 9 9 use AppfulPlugin\Helper\Constants; … … 20 20 $user_dto = UserMapper::to_dto( $user ); 21 21 Logger::log( "Sending user save request with data: " . json_encode( $user_dto ) ); 22 $request = BackendRequest::backend_request()->method( "POST" )->body( $user_dto )->path( Constants::$USER_PATH );22 $request = HttpRequest::backend_request()->method( "POST" )->body( $user_dto )->path( Constants::$USER_PATH ); 23 23 $this->backend_client->send_request( $request ); 24 24 } -
appful-app/trunk/includes/wp/WPBlogManager.php
r2920030 r2920184 21 21 private static function get_hooks(): BlogHooks { 22 22 return BlogHooks::blog_hooks() 23 ->create_comment( self::get_site_url() . Endpoints::$HOOK . Endpoints::$CREATE_COMMENT )24 ->authenticate_user( self::get_site_url() . Endpoints::$HOOK . Endpoints::$AUTHENTICATE_USER );23 ->create_comment( self::get_site_url() . Endpoints::$HOOK . "/" . Endpoints::$CREATE_COMMENT ) 24 ->authenticate_user( self::get_site_url() . Endpoints::$HOOK . "/" . Endpoints::$AUTHENTICATE_USER ); 25 25 } 26 26 -
appful-app/trunk/includes/wp/WPPostManager.php
r2907312 r2920184 86 86 } 87 87 88 /** 89 * @param int[] $ids 90 * 91 * @return PostContent[] 92 */ 93 public static function get_post_contents_by_id( array $ids ): array { 94 return self::pullPostByIds( $ids ); 95 } 96 97 /** 98 * @param int[] $ids 99 * 100 * @return PostContent[] 101 */ 102 private static function pullPostByIds( array $ids ): array { 88 public static function get_post_content_by_id( int $id ): ?PostContent { 103 89 global $wp_query; 104 105 $postContents = [];106 90 107 91 do_action( 'template_redirect' ); 108 92 109 foreach ( $ids as $post_id ) { 110 $args = [ 111 "posts_per_page" => 1, 112 "post_type" => "post", 113 "p" => $post_id, 114 "post_status" => self::get_allowed_post_stati() 115 ]; 93 $args = [ 94 "posts_per_page" => 1, 95 "post_type" => "post", 96 "p" => $id, 97 "post_status" => self::get_allowed_post_stati() 98 ]; 116 99 117 $wp_query = new \WP_Query( $args );118 while( have_posts() ) {119 the_post();100 $wp_query = new \WP_Query( $args ); 101 if ( have_posts() ) { 102 the_post(); 120 103 121 ob_start();122 wp_head();123 $head = ob_get_clean();104 ob_start(); 105 wp_head(); 106 $head = ob_get_clean(); 124 107 125 ob_start();126 the_content();127 $content = ob_get_clean();108 ob_start(); 109 the_content(); 110 $content = ob_get_clean(); 128 111 129 ob_start();130 wp_footer();131 $footer = ob_get_clean();112 ob_start(); 113 wp_footer(); 114 $footer = ob_get_clean(); 132 115 133 ob_start(); 134 body_class(); 135 $body_class = ob_get_clean(); 136 137 $postContents[] = PostContent::postContent() 138 ->id( get_the_ID() ) 139 ->content( $content ) 140 ->head( $head ) 141 ->footer( $footer ) 142 ->body_class( $body_class ); 143 } 116 ob_start(); 117 body_class(); 118 $body_class = ob_get_clean(); 144 119 145 120 wp_reset_postdata(); 121 122 return PostContent::postContent() 123 ->id( get_the_ID() ) 124 ->content( $content ) 125 ->head( $head ) 126 ->footer( $footer ) 127 ->body_class( $body_class ); 146 128 } 147 129 148 return $postContents;130 return null; 149 131 } 150 132 -
appful-app/trunk/lib/vendor/composer/autoload_classmap.php
r2920030 r2920184 9 9 'AppfulPlugin\\Api\\Api' => $baseDir . '/../includes/api/Api.php', 10 10 'AppfulPlugin\\Api\\Client\\BackendClient' => $baseDir . '/../includes/api/client/BackendClient.php', 11 'AppfulPlugin\\Api\\Client\\SelfClient' => $baseDir . '/../includes/api/client/SelfClient.php', 11 12 'AppfulPlugin\\Api\\Dtos\\AttachmentDto' => $baseDir . '/../includes/api/dtos/AttachmentDto.php', 12 13 'AppfulPlugin\\Api\\Dtos\\BlogHooksDto' => $baseDir . '/../includes/api/dtos/BlogHooksDto.php', … … 39 40 'AppfulPlugin\\Api\\Handlers\\LogRequestHandler' => $baseDir . '/../includes/api/handlers/LogRequestHandler.php', 40 41 'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => $baseDir . '/../includes/api/handlers/PostSyncRequestHandler.php', 42 'AppfulPlugin\\Api\\Handlers\\PullLocalPostContentRequestHandler' => $baseDir . '/../includes/api/handlers/PullLocalPostContentRequestHandler.php', 41 43 'AppfulPlugin\\Api\\Handlers\\RequestHandler' => $baseDir . '/../includes/api/handlers/RequestHandler.php', 42 44 'AppfulPlugin\\Api\\Handlers\\SyncRequestHandler' => $baseDir . '/../includes/api/handlers/SyncRequestHandler.php', … … 55 57 'AppfulPlugin\\Api\\Mapper\\UserMapper' => $baseDir . '/../includes/api/mapper/UserMapper.php', 56 58 'AppfulPlugin\\Api\\ReqHandler' => $baseDir . '/../includes/api/ReqHandler.php', 57 'AppfulPlugin\\Api\\Requests\\ BackendRequest' => $baseDir . '/../includes/api/requests/BackendRequest.php',59 'AppfulPlugin\\Api\\Requests\\HttpRequest' => $baseDir . '/../includes/api/requests/HttpRequest.php', 58 60 'AppfulPlugin\\Api\\Requests\\PluginRequest' => $baseDir . '/../includes/api/requests/PluginRequest.php', 59 'AppfulPlugin\\Api\\Responses\\ BackendResponse' => $baseDir . '/../includes/api/reponses/BackendResponse.php',61 'AppfulPlugin\\Api\\Responses\\HttpResponse' => $baseDir . '/../includes/api/reponses/HttpResponse.php', 60 62 'AppfulPlugin\\Api\\Responses\\PluginResponse' => $baseDir . '/../includes/api/reponses/PluginResponse.php', 61 63 'AppfulPlugin\\Api\\Rewrites' => $baseDir . '/../includes/api/Rewrites.php', … … 111 113 'AppfulPlugin\\UseCases\\GetCommentSyncDataUseCase' => $baseDir . '/../includes/use_cases/GetCommentSyncDataUseCase.php', 112 114 'AppfulPlugin\\UseCases\\GetCommentsByIdUseCase' => $baseDir . '/../includes/use_cases/GetCommentsByIdUseCase.php', 115 'AppfulPlugin\\UseCases\\GetLocalPostContentByIdUseCase' => $baseDir . '/../includes/use_cases/GetLocalPostContentByIdUseCase.php', 113 116 'AppfulPlugin\\UseCases\\GetLogsUseCase' => $baseDir . '/../includes/use_cases/GetLogsUseCase.php', 114 117 'AppfulPlugin\\UseCases\\GetPostContentsByIdUseCase' => $baseDir . '/../includes/use_cases/GetPostContentsByIdUseCase.php', … … 123 126 'AppfulPlugin\\UseCases\\PostDeleteUseCase' => $baseDir . '/../includes/use_cases/PostDeleteUseCase.php', 124 127 'AppfulPlugin\\UseCases\\PostSaveUseCase' => $baseDir . '/../includes/use_cases/PostSaveUseCase.php', 128 'AppfulPlugin\\UseCases\\PullLocalPostContentUseCase' => $baseDir . '/../includes/use_cases/PullLocalPostContentUseCase.php', 125 129 'AppfulPlugin\\UseCases\\RegisterBlogUseCase' => $baseDir . '/../includes/use_cases/RegisterBlogUseCase.php', 126 130 'AppfulPlugin\\UseCases\\SendAttachmentChunkSyncUseCase' => $baseDir . '/../includes/use_cases/SendAttachmentChunkSyncUseCase.php', -
appful-app/trunk/lib/vendor/composer/autoload_static.php
r2920030 r2920184 176 176 'AppfulPlugin\\Api\\Api' => __DIR__ . '/../..' . '/../includes/api/Api.php', 177 177 'AppfulPlugin\\Api\\Client\\BackendClient' => __DIR__ . '/../..' . '/../includes/api/client/BackendClient.php', 178 'AppfulPlugin\\Api\\Client\\SelfClient' => __DIR__ . '/../..' . '/../includes/api/client/SelfClient.php', 178 179 'AppfulPlugin\\Api\\Dtos\\AttachmentDto' => __DIR__ . '/../..' . '/../includes/api/dtos/AttachmentDto.php', 179 180 'AppfulPlugin\\Api\\Dtos\\BlogHooksDto' => __DIR__ . '/../..' . '/../includes/api/dtos/BlogHooksDto.php', … … 206 207 'AppfulPlugin\\Api\\Handlers\\LogRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/LogRequestHandler.php', 207 208 'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PostSyncRequestHandler.php', 209 'AppfulPlugin\\Api\\Handlers\\PullLocalPostContentRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PullLocalPostContentRequestHandler.php', 208 210 'AppfulPlugin\\Api\\Handlers\\RequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/RequestHandler.php', 209 211 'AppfulPlugin\\Api\\Handlers\\SyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/SyncRequestHandler.php', … … 222 224 'AppfulPlugin\\Api\\Mapper\\UserMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/UserMapper.php', 223 225 'AppfulPlugin\\Api\\ReqHandler' => __DIR__ . '/../..' . '/../includes/api/ReqHandler.php', 224 'AppfulPlugin\\Api\\Requests\\ BackendRequest' => __DIR__ . '/../..' . '/../includes/api/requests/BackendRequest.php',226 'AppfulPlugin\\Api\\Requests\\HttpRequest' => __DIR__ . '/../..' . '/../includes/api/requests/HttpRequest.php', 225 227 'AppfulPlugin\\Api\\Requests\\PluginRequest' => __DIR__ . '/../..' . '/../includes/api/requests/PluginRequest.php', 226 'AppfulPlugin\\Api\\Responses\\ BackendResponse' => __DIR__ . '/../..' . '/../includes/api/reponses/BackendResponse.php',228 'AppfulPlugin\\Api\\Responses\\HttpResponse' => __DIR__ . '/../..' . '/../includes/api/reponses/HttpResponse.php', 227 229 'AppfulPlugin\\Api\\Responses\\PluginResponse' => __DIR__ . '/../..' . '/../includes/api/reponses/PluginResponse.php', 228 230 'AppfulPlugin\\Api\\Rewrites' => __DIR__ . '/../..' . '/../includes/api/Rewrites.php', … … 278 280 'AppfulPlugin\\UseCases\\GetCommentSyncDataUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetCommentSyncDataUseCase.php', 279 281 'AppfulPlugin\\UseCases\\GetCommentsByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetCommentsByIdUseCase.php', 282 'AppfulPlugin\\UseCases\\GetLocalPostContentByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetLocalPostContentByIdUseCase.php', 280 283 'AppfulPlugin\\UseCases\\GetLogsUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetLogsUseCase.php', 281 284 'AppfulPlugin\\UseCases\\GetPostContentsByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/GetPostContentsByIdUseCase.php', … … 290 293 'AppfulPlugin\\UseCases\\PostDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PostDeleteUseCase.php', 291 294 'AppfulPlugin\\UseCases\\PostSaveUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PostSaveUseCase.php', 295 'AppfulPlugin\\UseCases\\PullLocalPostContentUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PullLocalPostContentUseCase.php', 292 296 'AppfulPlugin\\UseCases\\RegisterBlogUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/RegisterBlogUseCase.php', 293 297 'AppfulPlugin\\UseCases\\SendAttachmentChunkSyncUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/SendAttachmentChunkSyncUseCase.php', -
appful-app/trunk/readme.txt
r2920030 r2920184 6 6 Tested up to: 6.2 7 7 Requires PHP: 7.4 8 Stable tag: 3. 0.08 Stable tag: 3.1.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.