Plugin Directory

Changeset 3043568


Ignore:
Timestamp:
03/01/2024 10:37:33 AM (2 years ago)
Author:
appfulapp
Message:

Added support for points of interest

Location:
appful-app
Files:
50 added
7 deleted
30 edited
308 copied

Legend:

Unmodified
Added
Removed
  • appful-app/tags/3.1.23/appful-app.php

    r3039311 r3043568  
    1212 * Plugin URI:        https://appful.io
    1313 * 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.1.22
     14 * Version:           3.1.23
    1515 * Requires at least: 5.8
    1616 * Requires PHP:      7.4
  • appful-app/tags/3.1.23/includes/api/Endpoints.php

    r3039311 r3043568  
    1313    public static string $SYNC = "sync";
    1414    public static string $SYNC_POSTS = "sync-post";
    15 
     15    public static string $SYNC_POINTS_OF_INTEREST = "sync-points-of-interest";
    1616    public static string $SYNC_PAGES = "sync-page";
    1717    public static string $SYNC_COMMENTS = "sync-comment";
     
    2626    public static string $GET_CATEGORIES = "get-category";
    2727    public static string $GET_POSTS = "get-post";
     28    public static string $GET_POINTS_OF_INTEREST = "get-point-of-interest";
    2829    public static string $GET_PAGES = "get-page";
    2930    public static string $GET_POST_CONTENTS = "get-post-content";
  • appful-app/tags/3.1.23/includes/api/ReqHandler.php

    r3039311 r3043568  
    2525use AppfulPlugin\Api\Handlers\Page\GetPageContentRequestHandler;
    2626use AppfulPlugin\Api\Handlers\PageSyncRequestHandler;
     27use AppfulPlugin\Api\Handlers\PointOfInterest\GetPointsOfInterestRequestHandler;
     28use AppfulPlugin\Api\Handlers\PointOfInterest\PointOfInterestSyncRequestHandler;
    2729use AppfulPlugin\Api\Handlers\PostSyncRequestHandler;
    2830use AppfulPlugin\Api\Handlers\PullLocalPageContentRequestHandler;
     
    7375            new PullLocalPageContentRequestHandler( $use_case_manager->pages()->get_local_page_content_by_id_use_case() ),
    7476            new GetPageContentRequestHandler( $use_case_manager->pages()->get_page_contents_by_id_use_case() ),
     77            new PointOfInterestSyncRequestHandler( $use_case_manager->points_of_interest()->get_sync_points_of_interest_use_case() ),
     78            new GetPointsOfInterestRequestHandler( $use_case_manager->points_of_interest()->get_get_points_of_interest_by_id_use_case() ),
    7579            new SavePostSyncBatchSizeHandler( $use_case_manager->posts()->get_save_post_sync_batch_size_use_case() )
    7680        ];
  • appful-app/tags/3.1.23/includes/api/dtos/CommentDto.php

    r2907312 r3043568  
    2323        $this->parent      = $parent;
    2424    }
    25 
    26 
    2725}
  • appful-app/tags/3.1.23/includes/api/mapper/BlogInfoMapper.php

    r3039311 r3043568  
    3232            $blog_info->get_token(),
    3333            $hooks,
    34             "3.1.22",
     34            "3.1.23",
    3535            $stats,
    3636            $settings
  • appful-app/tags/3.1.23/includes/domain/BlogHooks.php

    r2978062 r3043568  
    44
    55class BlogHooks {
    6     private ?string $create_comment = null;
    7     private ?string $authenticate_user = null;
    8     private ?string $get_page_content = null;
     6    private ?string $create_comment = null;
     7    private ?string $authenticate_user = null;
     8    private ?string $get_page_content = null;
    99
    10     private function __construct() {
    11     }
     10    private function __construct() {
     11    }
    1212
    13     public static function init(): BlogHooks {
    14         return new BlogHooks();
    15     }
     13    public static function init(): BlogHooks {
     14        return new BlogHooks();
     15    }
    1616
    17     public function create_comment( ?string $create_comment ): BlogHooks {
    18         $this->create_comment = $create_comment;
     17    public function create_comment( ?string $create_comment ): BlogHooks {
     18        $this->create_comment = $create_comment;
    1919
    20         return $this;
    21     }
     20        return $this;
     21    }
    2222
    23     public function authenticate_user( ?string $authenticate_user ): BlogHooks {
    24         $this->authenticate_user = $authenticate_user;
     23    public function authenticate_user( ?string $authenticate_user ): BlogHooks {
     24        $this->authenticate_user = $authenticate_user;
    2525
    26         return $this;
    27     }
     26        return $this;
     27    }
    2828
    29     public function get_page_content( ?string $get_page_content ): BlogHooks {
    30         $this->get_page_content = $get_page_content;
     29    public function get_page_content( ?string $get_page_content ): BlogHooks {
     30        $this->get_page_content = $get_page_content;
    3131
    32         return $this;
    33     }
     32        return $this;
     33    }
    3434
    35     public function get_create_comment(): ?string {
    36         return $this->create_comment;
    37     }
     35    public function get_create_comment(): ?string {
     36        return $this->create_comment;
     37    }
    3838
    39     public function get_authenticate_user(): ?string {
    40         return $this->authenticate_user;
    41     }
     39    public function get_authenticate_user(): ?string {
     40        return $this->authenticate_user;
     41    }
    4242
    43     public function get_get_page_content(): ?string {
    44         return $this->get_page_content;
    45     }
     43    public function get_get_page_content(): ?string {
     44        return $this->get_page_content;
     45    }
    4646}
  • appful-app/tags/3.1.23/includes/domain/PostContent.php

    r3027388 r3043568  
    44
    55class PostContent {
    6     private int $id = - 1;
    7     private string $head = "";
    8     private string $footer = "";
    9     private string $body_class = "";
    10     private string $content = "";
     6    private int $id = - 1;
     7    private string $head = "";
     8    private string $footer = "";
     9    private string $body_class = "";
     10    private string $content = "";
    1111
    12     public static function postContent(
    13         int $id = - 1,
    14         string $head = "",
    15         string $footer = "",
    16         string $content = "",
    17         string $body_class = ""
    18     ): PostContent {
    19         return ( new PostContent() )
    20             ->id( $id )
    21             ->head( $head )
    22             ->footer( $footer )
    23             ->content( $content )
    24             ->body_class( $body_class );
    25     }
     12    private function __construct() {
     13    }
    2614
    27     public function id( int $id ): PostContent {
    28         $this->id = $id;
     15    public static function postContent(): PostContent {
     16        return new PostContent();
     17    }
    2918
    30         return $this;
    31     }
     19    public function id( int $id ): PostContent {
     20        $this->id = $id;
    3221
    33     public function head( string $head ): PostContent {
    34         $this->head = $head;
     22        return $this;
     23    }
    3524
    36         return $this;
    37     }
     25    public function head( string $head ): PostContent {
     26        $this->head = $head;
    3827
    39     public function footer( string $footer ): PostContent {
    40         $this->footer = $footer;
     28        return $this;
     29    }
    4130
    42         return $this;
    43     }
     31    public function footer( string $footer ): PostContent {
     32        $this->footer = $footer;
    4433
    45     public function content( string $content ): PostContent {
    46         $this->content = $content;
     34        return $this;
     35    }
    4736
    48         return $this;
    49     }
     37    public function content( string $content ): PostContent {
     38        $this->content = $content;
    5039
    51     public function body_class( string $body_class ): PostContent {
    52         $this->body_class = $body_class;
     40        return $this;
     41    }
    5342
    54         return $this;
    55     }
     43    public function body_class( string $body_class ): PostContent {
     44        $this->body_class = $body_class;
    5645
    57     public function get_id(): int {
    58         return $this->id;
    59     }
     46        return $this;
     47    }
    6048
    61     public function get_head(): string {
    62         return $this->head;
    63     }
     49    public function get_id(): int {
     50        return $this->id;
     51    }
    6452
    65     public function get_footer(): string {
    66         return $this->footer;
    67     }
     53    public function get_head(): string {
     54        return $this->head;
     55    }
    6856
    69     public function get_content(): string {
    70         return $this->content;
    71     }
     57    public function get_footer(): string {
     58        return $this->footer;
     59    }
    7260
    73     public function get_body_class(): string {
    74         return $this->body_class;
    75     }
     61    public function get_content(): string {
     62        return $this->content;
     63    }
     64
     65    public function get_body_class(): string {
     66        return $this->body_class;
     67    }
    7668}
  • appful-app/tags/3.1.23/includes/helper/Constants.php

    r3039311 r3043568  
    2525    public static string $APPFUL_TAXONOMY_PUSH_TERM_SLUG = "push";
    2626
    27     public static string $APPFUL_API_URL = "https://api.wordpress.appful.io";
     27    public static string $APPFUL_POST_META_COORDINATES_KEY = "_appful_post_meta_coordinates";
     28
     29    public static string $APPFUL_API_URL = "https://api.wordpress.appful.io";
    2830
    2931    public static string $BLOG_PATH = "/blogs";
     
    3739    public static string $TAXONOMY_PATH = "/taxonomies";
    3840    public static string $ROLE_PATH = "/roles";
     41    public static string $POINT_OF_INTEREST_PATH = "/points-of-interest";
    3942
    4043    public static string $API_VERSION_1 = "/v1";
  • appful-app/tags/3.1.23/includes/hooks/PostHook.php

    r3027388 r3043568  
    33namespace AppfulPlugin\Hooks;
    44
     5use AppfulPlugin\Helper\Constants;
    56use AppfulPlugin\Helper\Logger;
    67use AppfulPlugin\UseCases\UseCaseManager;
     
    89
    910class PostHook {
    10     private UseCaseManager $use_case_manager;
     11    private UseCaseManager $use_case_manager;
    1112
    12     public function __construct( UseCaseManager $use_case_manager ) {
    13         $this->use_case_manager = $use_case_manager;
    14     }
     13    public function __construct( UseCaseManager $use_case_manager ) {
     14        $this->use_case_manager = $use_case_manager;
     15    }
    1516
    16     public function init() {
    17         add_action(
    18             "wp_after_insert_post",
    19             function ( int $post_id, WP_Post $post, bool $update, ?WP_Post $post_before ) {
    20                 $this->after_save_post( $post, $post_before );
    21             },
    22             99,
    23             4,
    24         );
     17    public function init() {
     18        add_action(
     19            "wp_after_insert_post",
     20            function ( int $post_id, WP_Post $post, bool $update, ?WP_Post $post_before ) {
     21                $this->after_save_post( $post, $post_before );
     22            },
     23            99,
     24            4
     25        );
    2526
    26         add_action(
    27             "delete_post",
    28             function ( int $post_id, WP_Post $post ) {
    29                 $this->on_delete_post( $post_id, $post );
    30             },
    31             10,
    32             2
    33         );
     27//        add_action(
     28//            "updated_post_meta",
     29//            function ( int $meta_id, int $object_id, string $meta_key ) {
     30//                if ( $meta_key == Constants::$APPFUL_POST_META_COORDINATES_KEY ) {
     31//                    $this->after_save_post_meta( $object_id );
     32//                }
     33//            },
     34//            10,
     35//            3
     36//        );
    3437
    35         add_action(
    36             "appful_app_update_post",
    37             function ( int $post_id ) {
    38                 $this->on_appful_post_update( $post_id );
    39             },
    40             10,
    41             1
    42         );
     38        add_action(
     39            "delete_post",
     40            function ( int $post_id, WP_Post $post ) {
     41                $this->on_delete_post( $post_id, $post );
     42            },
     43            10,
     44            2
     45        );
    4346
    44         add_action(
    45             "appful_app_update_taxonomy_posts",
    46             function ( string $taxonomy, string $term_slug ) {
    47                 $this->on_appful_taxonomy_posts_update( $taxonomy, $term_slug );
    48             },
    49             10,
    50             2
    51         );
    52     }
     47        add_action(
     48            "delete_post_meta",
     49            function ( array $meta_ids, int $object_id, string $meta_key ) {
     50                if ( $meta_key == Constants::$APPFUL_POST_META_COORDINATES_KEY ) {
     51                    $this->on_delete_post_meta( $object_id );
     52                }
     53            },
     54            10,
     55            3
     56        );
    5357
    54     private function on_delete_post( int $post_id, WP_Post $post ) {
    55         if ( $post->post_type != "post" ) {
    56             return;
    57         }
     58        add_action(
     59            "appful_app_update_post",
     60            function ( int $post_id ) {
     61                $this->on_appful_post_update( $post_id );
     62            },
     63            10,
     64            1
     65        );
    5866
    59         Logger::debug( "Post with id " . $post->ID . " deleted!" );
     67        add_action(
     68            "appful_app_update_taxonomy_posts",
     69            function ( string $taxonomy, string $term_slug ) {
     70                $this->on_appful_taxonomy_posts_update( $taxonomy, $term_slug );
     71            },
     72            10,
     73            2
     74        );
     75    }
    6076
    61         $this->use_case_manager->post_delete_use_case()->invoke( $post_id );
    62     }
     77    private function on_delete_post( int $post_id, WP_Post $post ) {
     78        if ( $post->post_type != "post" ) {
     79            return;
     80        }
    6381
    64     private function after_save_post( WP_Post $post, ?WP_Post $post_before ) {
    65         if ( defined( "DOING_AUTOSAVE" ) && DOING_AUTOSAVE ) {
    66             return;
    67         }
     82        Logger::debug( "Post with id " . $post->ID . " deleted!" );
    6883
    69         if ( $post->post_type != "post" ) {
    70             return;
    71         }
     84        $this->use_case_manager->post_delete_use_case()->invoke( $post_id );
     85        $this->use_case_manager->points_of_interest()->get_point_of_interest_delete_use_case()->invoke( $post_id );
     86    }
    7287
    73         if ( $post->post_status == "auto-draft" || $post->post_status == "inherit" ) {
    74             return;
    75         }
     88    private function on_delete_post_meta( int $post_id ) {
     89        Logger::debug( "Post-coordinates-meta with id " . $post_id . " deleted!" );
    7690
    77         Logger::debug( "Post with id " . $post->ID . " inserted with status " . $post->post_status . "!" );
     91        $this->use_case_manager->points_of_interest()->get_point_of_interest_delete_use_case()->invoke( $post_id );
     92    }
    7893
    79         $old_post_status = "";
    80         if ( $post_before ) {
    81             $old_post_status = $post_before->post_status;
    82         }
     94    private function after_save_post_meta( int $post_id ) {
     95        Logger::debug( "Post-coordinate-meta with id " . $post_id . " updated!" );
    8396
    84         $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post->ID, $post->post_status != $old_post_status );
    85     }
     97        $this->use_case_manager->points_of_interest()->get_sync_point_of_interest_use_case()->invoke( $post_id );
     98    }
    8699
    87     private function on_appful_post_update( int $post_id ) {
    88         Logger::debug( "Manual appful post update for id " . $post_id );
     100    private function after_save_post( WP_Post $post, ?WP_Post $post_before ) {
     101        if ( (defined( "DOING_AUTOSAVE" ) && DOING_AUTOSAVE) || (defined( 'REST_REQUEST' ) && REST_REQUEST) ) {
     102            return;
     103        }
    89104
    90         $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post_id, true );
    91     }
     105        if ( wp_is_post_revision( $post->ID ) || wp_is_post_autosave( $post->ID ) ) {
     106            return;
     107        }
    92108
    93     private function on_appful_taxonomy_posts_update( string $taxonomy, string $term_slug ) {
    94         Logger::debug( "Manual appful taxonomy posts update for taxonomy " . $taxonomy . " and term " . $term_slug );
     109        if ( $post->post_type != "post" ) {
     110            return;
     111        }
    95112
    96         $this->use_case_manager->posts()->get_sync_taxonomy_posts_use_case()->invoke( $taxonomy, $term_slug );
    97     }
     113        if ( $post->post_status == "auto-draft" || $post->post_status == "inherit" ) {
     114            return;
     115        }
     116
     117        Logger::debug( "Post with id " . $post->ID . " inserted with status " . $post->post_status . "!" );
     118
     119        $old_post_status = "";
     120        if ( $post_before ) {
     121            $old_post_status = $post_before->post_status;
     122        }
     123
     124        $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post->ID, $post->post_status != $old_post_status );
     125        $this->after_save_post_meta( $post->ID );
     126    }
     127
     128    private function on_appful_post_update( int $post_id ) {
     129        Logger::debug( "Manual appful post update for id " . $post_id );
     130
     131        $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post_id, true );
     132        $this->use_case_manager->points_of_interest()->get_sync_point_of_interest_use_case()->invoke( $post_id, true );
     133    }
     134
     135    private function on_appful_taxonomy_posts_update( string $taxonomy, string $term_slug ) {
     136        Logger::debug( "Manual appful taxonomy posts update for taxonomy " . $taxonomy . " and term " . $term_slug );
     137
     138        $this->use_case_manager->posts()->get_sync_taxonomy_posts_use_case()->invoke( $taxonomy, $term_slug );
     139    }
    98140}
  • appful-app/tags/3.1.23/includes/main/AppfulPlugin.php

    r2920184 r3043568  
    1212use AppfulPlugin\Menu\Menu;
    1313use AppfulPlugin\Notice\Notice;
     14use AppfulPlugin\PostForm\PostForm;
    1415use AppfulPlugin\TermForm\TermForm;
    1516use AppfulPlugin\UseCases\UseCaseManager;
     
    1920    private Menu $menu;
    2021    private TermForm $term_form;
     22    private PostForm $post_form;
    2123    private Notice $notice;
    2224    private Hooks $hooks;
     
    3638        $this->menu      = new Menu( $this->use_case_manager->is_logged_in_use_case() );
    3739        $this->term_form = new TermForm();
     40        $this->post_form = new PostForm();
    3841        $this->notice    = new Notice( $this->use_case_manager->is_logged_in_use_case() );
    3942        $this->hooks     = new Hooks( $rewrites, $this->use_case_manager, $this->taxonomy_manager );
     
    5255        if ( $this->use_case_manager->is_logged_in_use_case()->invoke() ) {
    5356            $this->term_form->load();
     57            $this->post_form->load();
    5458            $this->taxonomy_manager->load();
    5559        }
  • appful-app/tags/3.1.23/includes/term_form/TermForm.php

    r2907312 r3043568  
    99
    1010class TermForm {
    11     public function __construct() {
    12     }
    13 
    1411    public function load(): void {
    1512        $this->setup_ui();
  • appful-app/tags/3.1.23/includes/use_cases/GetLocalPostContentByIdUseCase.php

    r3027388 r3043568  
    77
    88class GetLocalPostContentByIdUseCase {
    9     public function invoke( int $id ): ?PostContent {
    10         $this->configure_active_filter( true );
    11         $post_content = WPPostManager::get_post_content_by_id( $id );
    12         $this->configure_active_filter( false );
     9    public function invoke( int $id ): ?PostContent {
     10        $this->configure_active_filter( true );
     11        $post_content = WPPostManager::get_post_content_by_id( $id );
     12        $this->configure_active_filter( false );
    1313
    14         return $post_content;
    15     }
     14        return $post_content;
     15    }
    1616
    17     private function configure_active_filter( bool $on ) {
    18         add_filter(
    19             "appful_app_is_post_content_call",
    20             function ( bool $is_active ) use ( $on ) {
    21                 return $on;
    22             },
    23             10,
    24             1
    25         );
    26     }
     17    private function configure_active_filter( bool $on ): void {
     18        add_filter(
     19            "appful_app_is_post_content_call",
     20            function ( bool $is_active ) use ( $on ) {
     21                return $on;
     22            },
     23            10,
     24            1
     25        );
     26    }
    2727}
  • appful-app/tags/3.1.23/includes/use_cases/RegisterBlogUseCase.php

    r3018629 r3043568  
    1212
    1313class RegisterBlogUseCase {
    14     private BackendClient $backend_client;
     14    private BackendClient $backend_client;
    1515
    16     public function __construct( BackendClient $backend_client ) {
    17         $this->backend_client = $backend_client;
    18     }
     16    public function __construct( BackendClient $backend_client ) {
     17        $this->backend_client = $backend_client;
     18    }
    1919
    20     public function invoke(): bool {
    21         $blog_info     = WPBlogManager::get_blog_info();
    22         $blog_info_dto = BlogInfoMapper::to_dto( $blog_info );
     20    public function invoke(): bool {
     21        $blog_info     = WPBlogManager::get_blog_info();
     22        $blog_info_dto = BlogInfoMapper::to_dto( $blog_info );
    2323
    24         Logger::info( "Registering blog with data: " . json_encode( $blog_info_dto ) );
     24        Logger::info( "Registering blog with data: " . json_encode( $blog_info_dto ) );
    2525
    26         $request  = HttpRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH );
    27         $response = $this->backend_client->send_request( $request );
    28         $body     = $response->get_body();
     26        $request  = HttpRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH );
     27        $response = $this->backend_client->send_request( $request );
     28        $body     = $response->get_body();
    2929
    30         if ( $response->get_status() != 200 ) {
    31             if ( $body != null && isset( $body['error'] ) ) {
    32                 WPOptionsManager::save_last_sync_error( $body['error'] );
    33             }
     30        if ( $response->get_status() != 200 ) {
     31            if ( $body != null && isset( $body['error'] ) ) {
     32                WPOptionsManager::save_last_sync_error( $body['error'] );
     33            }
    3434
    35             return false;
    36         }
     35            return false;
     36        }
    3737
    38         if ( $body != null && isset( $body['blog_id'] ) ) {
    39             WPOptionsManager::save_blog_id( $body['blog_id'] );
    40         }
     38        if ( $body != null && isset( $body['blog_id'] ) ) {
     39            WPOptionsManager::save_blog_id( $body['blog_id'] );
     40        }
    4141
    42         return true;
    43     }
     42        return true;
     43    }
    4444}
  • appful-app/tags/3.1.23/includes/use_cases/SyncAllUseCase.php

    r3027388 r3043568  
    33namespace AppfulPlugin\UseCases;
    44
     5use AppfulPlugin\UseCases\PointOfInterest\SyncPointsOfInterestUseCase;
    56use AppfulPlugin\UseCases\Post\SyncPostsUseCase;
    67
    78class SyncAllUseCase {
    8     private SyncPostsUseCase $sync_posts_use_case;
    9     private SyncTagsUseCase $sync_tags_use_case;
    10     private SyncCategoriesUseCase $sync_categories_use_case;
    11     private SyncAttachmentsUseCase $sync_attachments_use_case;
    12     private SyncCommentsUseCase $sync_comments_use_case;
    13     private SyncUsersUseCase $sync_users_use_case;
    14     private SyncRolesUseCase $sync_roles_use_case;
    15     private SyncPagesUseCase $sync_pages_use_case;
     9    private SyncPostsUseCase $sync_posts_use_case;
     10    private SyncTagsUseCase $sync_tags_use_case;
     11    private SyncCategoriesUseCase $sync_categories_use_case;
     12    private SyncAttachmentsUseCase $sync_attachments_use_case;
     13    private SyncCommentsUseCase $sync_comments_use_case;
     14    private SyncUsersUseCase $sync_users_use_case;
     15    private SyncRolesUseCase $sync_roles_use_case;
     16    private SyncPagesUseCase $sync_pages_use_case;
     17    private SyncPointsOfInterestUseCase $sync_points_of_interest_use_case;
    1618
    17     public function __construct(
    18         SyncPostsUseCase $sync_posts_use_case,
    19         SyncTagsUseCase $sync_tags_use_case,
    20         SyncCategoriesUseCase $sync_categories_use_case,
    21         SyncAttachmentsUseCase $sync_attachments_use_case,
    22         SyncCommentsUseCase $sync_comments_use_case,
    23         SyncUsersUseCase $sync_users_use_case,
    24         SyncRolesUseCase $sync_roles_use_case,
    25         SyncPagesUseCase $sync_pages_use_case
    26     ) {
    27         $this->sync_posts_use_case       = $sync_posts_use_case;
    28         $this->sync_tags_use_case        = $sync_tags_use_case;
    29         $this->sync_categories_use_case  = $sync_categories_use_case;
    30         $this->sync_attachments_use_case = $sync_attachments_use_case;
    31         $this->sync_comments_use_case    = $sync_comments_use_case;
    32         $this->sync_users_use_case       = $sync_users_use_case;
    33         $this->sync_roles_use_case       = $sync_roles_use_case;
    34         $this->sync_pages_use_case       = $sync_pages_use_case;
    35     }
     19    public function __construct(
     20        SyncPostsUseCase $sync_posts_use_case,
     21        SyncTagsUseCase $sync_tags_use_case,
     22        SyncCategoriesUseCase $sync_categories_use_case,
     23        SyncAttachmentsUseCase $sync_attachments_use_case,
     24        SyncCommentsUseCase $sync_comments_use_case,
     25        SyncUsersUseCase $sync_users_use_case,
     26        SyncRolesUseCase $sync_roles_use_case,
     27        SyncPagesUseCase $sync_pages_use_case,
     28        SyncPointsOfInterestUseCase $sync_points_of_interest_use_case
     29    ) {
     30        $this->sync_posts_use_case              = $sync_posts_use_case;
     31        $this->sync_tags_use_case               = $sync_tags_use_case;
     32        $this->sync_categories_use_case         = $sync_categories_use_case;
     33        $this->sync_attachments_use_case        = $sync_attachments_use_case;
     34        $this->sync_comments_use_case           = $sync_comments_use_case;
     35        $this->sync_users_use_case              = $sync_users_use_case;
     36        $this->sync_roles_use_case              = $sync_roles_use_case;
     37        $this->sync_pages_use_case              = $sync_pages_use_case;
     38        $this->sync_points_of_interest_use_case = $sync_points_of_interest_use_case;
     39    }
    3640
    37     public function invoke() {
    38         $this->sync_users_use_case->invoke();
    39         $this->sync_roles_use_case->invoke();
    40         $this->sync_pages_use_case->invoke();
    41         $this->sync_categories_use_case->invoke();
    42         $this->sync_tags_use_case->invoke();
    43         $this->sync_attachments_use_case->invoke();
    44         $this->sync_posts_use_case->invoke();
    45         $this->sync_comments_use_case->invoke();
    46     }
     41    public function invoke() {
     42        $this->sync_users_use_case->invoke();
     43        $this->sync_roles_use_case->invoke();
     44        $this->sync_pages_use_case->invoke();
     45        $this->sync_categories_use_case->invoke();
     46        $this->sync_tags_use_case->invoke();
     47        $this->sync_attachments_use_case->invoke();
     48        $this->sync_posts_use_case->invoke();
     49        $this->sync_points_of_interest_use_case->invoke();
     50        $this->sync_comments_use_case->invoke();
     51    }
    4752}
  • appful-app/tags/3.1.23/includes/use_cases/UseCaseManager.php

    r3027388 r3043568  
    77use AppfulPlugin\UseCases\AppSettings\AppSettingsUseCaseManager;
    88use AppfulPlugin\UseCases\Page\PageUseCaseManager;
     9use AppfulPlugin\UseCases\PointOfInterest\PointOfInterestUseCaseManager;
    910use AppfulPlugin\UseCases\Post\PostUseCaseManager;
    1011
    1112class UseCaseManager {
    12     private GetAndroidAssetLinkUseCase $get_android_asset_link_use_case;
    13     private GetAppleAppSiteAssociationUseCase $get_apple_app_site_association_use_case;
    14     private GetLogsUseCase $get_logs_use_case;
    15     private GetBlogInfoUseCase $get_blog_info_use_case;
    16     private IsLoggedInUseCase $is_logged_in_use_case;
    17     private DeleteSessionUseCase $delete_session_use_case;
    18     private RegisterBlogUseCase $register_blog_use_case;
    19     private CategorySaveUseCase $category_save_use_case;
    20     private CategoryDeleteUseCase $category_delete_use_case;
    21     private TagDeleteUseCase $tag_delete_use_case;
    22     private TagSaveUseCase $tag_save_use_case;
    23     private GetPostsByIdUseCase $get_posts_by_id_use_case;
    24     private GetTagSyncDataUseCase $get_tag_sync_data_use_case;
    25     private SendTagChunkSyncUseCase $send_tag_chunk_sync_use_case;
    26     private GetTagsByIdUseCase $get_tags_by_id_use_case;
    27     private SendCategoryChunkSyncUseCase $send_category_chunk_sync_use_case;
    28     private GetCategorySyncDataUseCase $get_category_sync_data_use_case;
    29     private GetCategoriesByIdUseCase $get_categories_by_id_use_case;
    30     private SendAttachmentChunkSyncUseCase $send_attachment_chunk_sync_use_case;
    31     private GetAttachmentsByIdUseCase $get_attachments_by_id_use_case;
    32     private GetAttachmentSyncDataUseCase $get_attachment_sync_data_use_case;
    33     private GetCommentsByIdUseCase $get_comments_by_id_use_case;
    34     private SendCommentChunkSyncUseCase $send_comment_chunk_sync_use_case;
    35     private SyncCommentsUseCase $sync_comments_use_case;
    36     private CommentSaveUseCase $comment_save_use_case;
    37     private LogoutUserUseCase $logout_user_use_case;
    38     private SyncTagsUseCase $sync_tags_use_case;
    39     private GetCommentSyncDataUseCase $get_comment_sync_data_use_case;
    40     private SyncCategoriesUseCase $sync_categories_use_case;
    41     private SyncAttachmentsUseCase $sync_attachments_use_case;
    42     private SyncAllUseCase $sync_all_use_case;
    43     private PostDeleteUseCase $post_delete_use_case;
    44     private CommentDeleteUseCase $comment_delete_use_case;
    45     private AttachmentDeleteUseCase $attachment_delete_use_case;
    46     private AttachmentSaveUseCase $attachment_save_use_case;
    47     private GetUsersByIdUseCase $get_users_by_id_use_case;
    48     private GetUserSyncDataUseCase $get_user_sync_data_use_case;
    49     private SendUserChunkSyncUseCase $send_user_chunk_sync_use_case;
    50     private UserDeleteUseCase $user_delete_use_case;
    51     private UserSaveUseCase $user_save_use_case;
    52     private SyncUsersUseCase $sync_users_use_case;
    53     private GetPostContentsByIdUseCase $get_post_contents_by_id_use_case;
    54     private ClearLogsUseCase $clear_logs_use_case;
    55     private AuthenticateUserUseCase $authenticate_user_use_case;
    56     private PullLocalPostContentUseCase $pull_local_post_content_use_case;
    57     private GetLocalPostContentByIdUseCase $get_local_post_content_by_id_use_case;
    58     private CreateCommentUseCase $create_comment_use_case;
    59     private GetRolesByIdUseCase $get_roles_by_id_use_case;
    60     private SyncRolesUseCase $sync_roles_use_case;
    61     private GetRoleSyncDataUseCase $get_role_sync_data_use_case;
    62     private SendRoleChunkSyncUseCase $send_role_chunk_sync_use_case;
    63     private GetPagesByIdUseCase $get_pages_by_id_use_case;
    64     private GetPageSyncDataUseCase $get_page_sync_data_use_case;
    65     private PageDeleteUseCase $page_delete_use_case;
    66     private PageSaveUseCase $page_save_use_case;
    67     private SendPageChunkSyncUseCase $send_page_chunk_sync_use_case;
    68     private SyncPagesUseCase $sync_pages_use_case;
    69     private PageUseCaseManager $page_use_case_manager;
    70     private PostUseCaseManager $post_use_case_manager;
    71     private AppSettingsUseCaseManager $app_settings_use_case_manager;
    72 
    73     public function __construct( BackendClient $backend_client, SelfClient $self_client ) {
    74         $this->get_android_asset_link_use_case         = new GetAndroidAssetLinkUseCase();
    75         $this->get_apple_app_site_association_use_case = new GetAppleAppSiteAssociationUseCase();
    76         $this->get_logs_use_case                       = new GetLogsUseCase();
    77         $this->get_blog_info_use_case                  = new GetBlogInfoUseCase();
    78         $this->is_logged_in_use_case                   = new IsLoggedInUseCase();
    79         $this->delete_session_use_case                 = new DeleteSessionUseCase( $backend_client );
    80         $this->register_blog_use_case                  = new RegisterBlogUseCase( $backend_client );
    81         $this->category_save_use_case                  = new CategorySaveUseCase( $backend_client );
    82         $this->category_delete_use_case                = new CategoryDeleteUseCase( $backend_client );
    83         $this->tag_delete_use_case                     = new TagDeleteUseCase( $backend_client );
    84         $this->tag_save_use_case                       = new TagSaveUseCase( $backend_client );
    85         $this->get_posts_by_id_use_case                = new GetPostsByIdUseCase();
    86         $this->get_tag_sync_data_use_case              = new GetTagSyncDataUseCase();
    87         $this->send_tag_chunk_sync_use_case            = new SendTagChunkSyncUseCase( $backend_client );
    88         $this->get_tags_by_id_use_case                 = new GetTagsByIdUseCase();
    89         $this->send_category_chunk_sync_use_case       = new SendCategoryChunkSyncUseCase( $backend_client );
    90         $this->get_category_sync_data_use_case         = new GetCategorySyncDataUseCase();
    91         $this->get_categories_by_id_use_case           = new GetCategoriesByIdUseCase();
    92         $this->send_attachment_chunk_sync_use_case     = new SendAttachmentChunkSyncUseCase( $backend_client );
    93         $this->get_attachments_by_id_use_case          = new GetAttachmentsByIdUseCase();
    94         $this->get_attachment_sync_data_use_case       = new GetAttachmentSyncDataUseCase();
    95         $this->send_comment_chunk_sync_use_case        = new SendCommentChunkSyncUseCase( $backend_client );
    96         $this->get_comments_by_id_use_case             = new GetCommentsByIdUseCase();
    97         $this->comment_save_use_case                   = new CommentSaveUseCase( $backend_client );
    98         $this->get_comment_sync_data_use_case          = new GetCommentSyncDataUseCase();
    99         $this->logout_user_use_case                    = new LogoutUserUseCase( $backend_client );
    100         $this->get_users_by_id_use_case                = new GetUsersByIdUseCase();
    101         $this->get_user_sync_data_use_case             = new GetUserSyncDataUseCase();
    102         $this->send_user_chunk_sync_use_case           = new SendUserChunkSyncUseCase( $backend_client );
    103         $this->sync_users_use_case                     = new SyncUsersUseCase( $this->get_user_sync_data_use_case, $this->send_user_chunk_sync_use_case );
    104         $this->sync_comments_use_case                  = new SyncCommentsUseCase( $this->get_comment_sync_data_use_case, $this->send_comment_chunk_sync_use_case );
    105         $this->sync_tags_use_case                      = new SyncTagsUseCase( $this->get_tag_sync_data_use_case, $this->send_tag_chunk_sync_use_case );
    106         $this->sync_categories_use_case                = new SyncCategoriesUseCase( $this->get_category_sync_data_use_case, $this->send_category_chunk_sync_use_case );
    107         $this->sync_attachments_use_case               = new SyncAttachmentsUseCase( $this->get_attachment_sync_data_use_case, $this->send_attachment_chunk_sync_use_case );
    108         $this->post_delete_use_case                    = new PostDeleteUseCase( $backend_client );
    109         $this->comment_delete_use_case                 = new CommentDeleteUseCase( $backend_client );
    110         $this->attachment_delete_use_case              = new AttachmentDeleteUseCase( $backend_client );
    111         $this->attachment_save_use_case                = new AttachmentSaveUseCase( $backend_client );
    112         $this->user_delete_use_case                    = new UserDeleteUseCase( $backend_client );
    113         $this->user_save_use_case                      = new UserSaveUseCase( $backend_client );
    114         $this->clear_logs_use_case                     = new ClearLogsUseCase();
    115         $this->authenticate_user_use_case              = new AuthenticateUserUseCase();
    116         $this->pull_local_post_content_use_case        = new PullLocalPostContentUseCase( $self_client );
    117         $this->get_local_post_content_by_id_use_case   = new GetLocalPostContentByIdUseCase();
    118         $this->get_post_contents_by_id_use_case        = new GetPostContentsByIdUseCase( $this->pull_local_post_content_use_case );
    119         $this->create_comment_use_case                 = new CreateCommentUseCase();
    120         $this->get_roles_by_id_use_case                = new GetRolesByIdUseCase();
    121         $this->get_role_sync_data_use_case             = new GetRoleSyncDataUseCase();
    122         $this->send_role_chunk_sync_use_case           = new SendRoleChunkSyncUseCase( $backend_client );
    123         $this->sync_roles_use_case                     = new SyncRolesUseCase( $this->get_role_sync_data_use_case, $this->send_role_chunk_sync_use_case );
    124         $this->get_pages_by_id_use_case                = new GetPagesByIdUseCase();
    125         $this->get_page_sync_data_use_case             = new GetPageSyncDataUseCase();
    126         $this->page_delete_use_case                    = new PageDeleteUseCase( $backend_client );
    127         $this->page_save_use_case                      = new PageSaveUseCase( $backend_client );
    128         $this->send_page_chunk_sync_use_case           = new SendPageChunkSyncUseCase( $backend_client );
    129         $this->sync_pages_use_case                     = new SyncPagesUseCase( $this->get_page_sync_data_use_case, $this->send_page_chunk_sync_use_case );
    130         $this->page_use_case_manager                   = new PageUseCaseManager( $self_client );
    131         $this->post_use_case_manager                   = new PostUseCaseManager( $backend_client );
    132         $this->app_settings_use_case_manager           = new AppSettingsUseCaseManager( $backend_client );
    133         $this->sync_all_use_case                       = new SyncAllUseCase( $this->post_use_case_manager->get_sync_posts_use_case(), $this->sync_tags_use_case, $this->sync_categories_use_case, $this->sync_attachments_use_case, $this->sync_comments_use_case, $this->sync_users_use_case, $this->sync_roles_use_case, $this->sync_pages_use_case );
    134     }
    135 
    136     public function get_android_asset_link_use_case(): GetAndroidAssetLinkUseCase {
    137         return $this->get_android_asset_link_use_case;
    138     }
    139 
    140     public function get_apple_app_site_association_use_case(): GetAppleAppSiteAssociationUseCase {
    141         return $this->get_apple_app_site_association_use_case;
    142     }
    143 
    144     public function get_logs_use_case(): GetLogsUseCase {
    145         return $this->get_logs_use_case;
    146     }
    147 
    148     public function get_blog_info_use_case(): GetBlogInfoUseCase {
    149         return $this->get_blog_info_use_case;
    150     }
    151 
    152     public function is_logged_in_use_case(): IsLoggedInUseCase {
    153         return $this->is_logged_in_use_case;
    154     }
    155 
    156     public function delete_session_use_case(): DeleteSessionUseCase {
    157         return $this->delete_session_use_case;
    158     }
    159 
    160     public function register_blog_use_case(): RegisterBlogUseCase {
    161         return $this->register_blog_use_case;
    162     }
    163 
    164     public function category_save_use_case(): CategorySaveUseCase {
    165         return $this->category_save_use_case;
    166     }
    167 
    168     public function category_delete_use_case(): CategoryDeleteUseCase {
    169         return $this->category_delete_use_case;
    170     }
    171 
    172     public function tag_delete_use_case(): TagDeleteUseCase {
    173         return $this->tag_delete_use_case;
    174     }
    175 
    176     public function tag_save_use_case(): TagSaveUseCase {
    177         return $this->tag_save_use_case;
    178     }
    179 
    180     public function get_posts_by_id_use_case(): GetPostsByIdUseCase {
    181         return $this->get_posts_by_id_use_case;
    182     }
    183 
    184     public function get_tag_sync_data_use_case(): GetTagSyncDataUseCase {
    185         return $this->get_tag_sync_data_use_case;
    186     }
    187 
    188     public function send_tag_chunk_sync_use_case(): SendTagChunkSyncUseCase {
    189         return $this->send_tag_chunk_sync_use_case;
    190     }
    191 
    192     public function get_tags_by_id_use_case(): GetTagsByIdUseCase {
    193         return $this->get_tags_by_id_use_case;
    194     }
    195 
    196     public function send_category_chunk_sync_use_case(): SendCategoryChunkSyncUseCase {
    197         return $this->send_category_chunk_sync_use_case;
    198     }
    199 
    200     public function get_category_sync_data_use_case(): GetCategorySyncDataUseCase {
    201         return $this->get_category_sync_data_use_case;
    202     }
    203 
    204     public function get_categories_by_id_use_case(): GetCategoriesByIdUseCase {
    205         return $this->get_categories_by_id_use_case;
    206     }
    207 
    208     public function send_attachment_chunk_sync_use_case(): SendAttachmentChunkSyncUseCase {
    209         return $this->send_attachment_chunk_sync_use_case;
    210     }
    211 
    212     public function send_comment_chunk_sync_use_case(): SendCommentChunkSyncUseCase {
    213         return $this->send_comment_chunk_sync_use_case;
    214     }
    215 
    216     public function get_attachments_by_id_use_case(): GetAttachmentsByIdUseCase {
    217         return $this->get_attachments_by_id_use_case;
    218     }
    219 
    220     public function comment_save_use_case(): CommentSaveUseCase {
    221         return $this->comment_save_use_case;
    222     }
    223 
    224     public function get_comment_sync_data_use_case(): GetCommentSyncDataUseCase {
    225         return $this->get_comment_sync_data_use_case;
    226     }
    227 
    228     public function get_attachment_sync_data_use_case(): GetAttachmentSyncDataUseCase {
    229         return $this->get_attachment_sync_data_use_case;
    230     }
    231 
    232     public function get_comments_by_id_use_case(): GetCommentsByIdUseCase {
    233         return $this->get_comments_by_id_use_case;
    234     }
    235 
    236     public function logout_user_use_case(): LogoutUserUseCase {
    237         return $this->logout_user_use_case;
    238     }
    239 
    240     public function sync_comments_use_case(): SyncCommentsUseCase {
    241         return $this->sync_comments_use_case;
    242     }
    243 
    244     public function sync_tags_use_case(): SyncTagsUseCase {
    245         return $this->sync_tags_use_case;
    246     }
    247 
    248     public function sync_categories_use_case(): SyncCategoriesUseCase {
    249         return $this->sync_categories_use_case;
    250     }
    251 
    252     public function sync_attachments_use_case(): SyncAttachmentsUseCase {
    253         return $this->sync_attachments_use_case;
    254     }
    255 
    256     public function sync_all_use_case(): SyncAllUseCase {
    257         return $this->sync_all_use_case;
    258     }
    259 
    260     public function post_delete_use_case(): PostDeleteUseCase {
    261         return $this->post_delete_use_case;
    262     }
    263 
    264     public function comment_delete_use_case(): CommentDeleteUseCase {
    265         return $this->comment_delete_use_case;
    266     }
    267 
    268     public function attachment_delete_use_case(): AttachmentDeleteUseCase {
    269         return $this->attachment_delete_use_case;
    270     }
    271 
    272     public function attachment_save_use_case(): AttachmentSaveUseCase {
    273         return $this->attachment_save_use_case;
    274     }
    275 
    276     public function get_users_by_id_use_case(): GetUsersByIdUseCase {
    277         return $this->get_users_by_id_use_case;
    278     }
    279 
    280     public function get_user_sync_data_use_case(): GetUserSyncDataUseCase {
    281         return $this->get_user_sync_data_use_case;
    282     }
    283 
    284     public function send_user_chunk_sync_use_case(): SendUserChunkSyncUseCase {
    285         return $this->send_user_chunk_sync_use_case;
    286     }
    287 
    288     public function user_delete_use_case(): UserDeleteUseCase {
    289         return $this->user_delete_use_case;
    290     }
    291 
    292     public function user_save_use_case(): UserSaveUseCase {
    293         return $this->user_save_use_case;
    294     }
    295 
    296     public function sync_users_use_case(): SyncUsersUseCase {
    297         return $this->sync_users_use_case;
    298     }
    299 
    300     public function get_post_contents_by_id_use_case(): GetPostContentsByIdUseCase {
    301         return $this->get_post_contents_by_id_use_case;
    302     }
    303 
    304     public function get_clear_logs_use_case(): ClearLogsUseCase {
    305         return $this->clear_logs_use_case;
    306     }
    307 
    308     public function get_authenticate_user_use_case(): AuthenticateUserUseCase {
    309         return $this->authenticate_user_use_case;
    310     }
    311 
    312     public function get_pull_local_post_content_use_case(): PullLocalPostContentUseCase {
    313         return $this->pull_local_post_content_use_case;
    314     }
    315 
    316     public function get_get_local_post_content_by_id_use_case(): GetLocalPostContentByIdUseCase {
    317         return $this->get_local_post_content_by_id_use_case;
    318     }
    319 
    320     public function create_comment_use_case(): CreateCommentUseCase {
    321         return $this->create_comment_use_case;
    322     }
    323 
    324     public function get_roles_by_id_use_case(): GetRolesByIdUseCase {
    325         return $this->get_roles_by_id_use_case;
    326     }
    327 
    328     public function get_role_sync_data_use_case(): GetRoleSyncDataUseCase {
    329         return $this->get_role_sync_data_use_case;
    330     }
    331 
    332     public function send_role_chunk_sync_use_case(): SendRoleChunkSyncUseCase {
    333         return $this->send_role_chunk_sync_use_case;
    334     }
    335 
    336     public function sync_roles_use_case(): SyncRolesUseCase {
    337         return $this->sync_roles_use_case;
    338     }
    339 
    340     public function get_pages_by_id_use_case(): GetPagesByIdUseCase {
    341         return $this->get_pages_by_id_use_case;
    342     }
    343 
    344     public function get_page_sync_data_use_case(): GetPageSyncDataUseCase {
    345         return $this->get_page_sync_data_use_case;
    346     }
    347 
    348     public function page_delete_use_case(): PageDeleteUseCase {
    349         return $this->page_delete_use_case;
    350     }
    351 
    352     public function page_save_use_case(): PageSaveUseCase {
    353         return $this->page_save_use_case;
    354     }
    355 
    356     public function send_page_chunk_sync_use_case(): SendPageChunkSyncUseCase {
    357         return $this->send_page_chunk_sync_use_case;
    358     }
    359 
    360     public function sync_pages_use_case(): SyncPagesUseCase {
    361         return $this->sync_pages_use_case;
    362     }
    363 
    364     public function pages(): PageUseCaseManager {
    365         return $this->page_use_case_manager;
    366     }
    367 
    368     public function posts(): PostUseCaseManager {
    369         return $this->post_use_case_manager;
    370     }
    371 
    372     public function app_settings(): AppSettingsUseCaseManager {
    373         return $this->app_settings_use_case_manager;
    374     }
     13    private GetAndroidAssetLinkUseCase $get_android_asset_link_use_case;
     14    private GetAppleAppSiteAssociationUseCase $get_apple_app_site_association_use_case;
     15    private GetLogsUseCase $get_logs_use_case;
     16    private GetBlogInfoUseCase $get_blog_info_use_case;
     17    private IsLoggedInUseCase $is_logged_in_use_case;
     18    private DeleteSessionUseCase $delete_session_use_case;
     19    private RegisterBlogUseCase $register_blog_use_case;
     20    private CategorySaveUseCase $category_save_use_case;
     21    private CategoryDeleteUseCase $category_delete_use_case;
     22    private TagDeleteUseCase $tag_delete_use_case;
     23    private TagSaveUseCase $tag_save_use_case;
     24    private GetPostsByIdUseCase $get_posts_by_id_use_case;
     25    private GetTagSyncDataUseCase $get_tag_sync_data_use_case;
     26    private SendTagChunkSyncUseCase $send_tag_chunk_sync_use_case;
     27    private GetTagsByIdUseCase $get_tags_by_id_use_case;
     28    private SendCategoryChunkSyncUseCase $send_category_chunk_sync_use_case;
     29    private GetCategorySyncDataUseCase $get_category_sync_data_use_case;
     30    private GetCategoriesByIdUseCase $get_categories_by_id_use_case;
     31    private SendAttachmentChunkSyncUseCase $send_attachment_chunk_sync_use_case;
     32    private GetAttachmentsByIdUseCase $get_attachments_by_id_use_case;
     33    private GetAttachmentSyncDataUseCase $get_attachment_sync_data_use_case;
     34    private GetCommentsByIdUseCase $get_comments_by_id_use_case;
     35    private SendCommentChunkSyncUseCase $send_comment_chunk_sync_use_case;
     36    private SyncCommentsUseCase $sync_comments_use_case;
     37    private CommentSaveUseCase $comment_save_use_case;
     38    private LogoutUserUseCase $logout_user_use_case;
     39    private SyncTagsUseCase $sync_tags_use_case;
     40    private GetCommentSyncDataUseCase $get_comment_sync_data_use_case;
     41    private SyncCategoriesUseCase $sync_categories_use_case;
     42    private SyncAttachmentsUseCase $sync_attachments_use_case;
     43    private SyncAllUseCase $sync_all_use_case;
     44    private PostDeleteUseCase $post_delete_use_case;
     45    private CommentDeleteUseCase $comment_delete_use_case;
     46    private AttachmentDeleteUseCase $attachment_delete_use_case;
     47    private AttachmentSaveUseCase $attachment_save_use_case;
     48    private GetUsersByIdUseCase $get_users_by_id_use_case;
     49    private GetUserSyncDataUseCase $get_user_sync_data_use_case;
     50    private SendUserChunkSyncUseCase $send_user_chunk_sync_use_case;
     51    private UserDeleteUseCase $user_delete_use_case;
     52    private UserSaveUseCase $user_save_use_case;
     53    private SyncUsersUseCase $sync_users_use_case;
     54    private GetPostContentsByIdUseCase $get_post_contents_by_id_use_case;
     55    private ClearLogsUseCase $clear_logs_use_case;
     56    private AuthenticateUserUseCase $authenticate_user_use_case;
     57    private PullLocalPostContentUseCase $pull_local_post_content_use_case;
     58    private GetLocalPostContentByIdUseCase $get_local_post_content_by_id_use_case;
     59    private CreateCommentUseCase $create_comment_use_case;
     60    private GetRolesByIdUseCase $get_roles_by_id_use_case;
     61    private SyncRolesUseCase $sync_roles_use_case;
     62    private GetRoleSyncDataUseCase $get_role_sync_data_use_case;
     63    private SendRoleChunkSyncUseCase $send_role_chunk_sync_use_case;
     64    private GetPagesByIdUseCase $get_pages_by_id_use_case;
     65    private GetPageSyncDataUseCase $get_page_sync_data_use_case;
     66    private PageDeleteUseCase $page_delete_use_case;
     67    private PageSaveUseCase $page_save_use_case;
     68    private SendPageChunkSyncUseCase $send_page_chunk_sync_use_case;
     69    private SyncPagesUseCase $sync_pages_use_case;
     70    private PageUseCaseManager $page_use_case_manager;
     71    private PostUseCaseManager $post_use_case_manager;
     72    private AppSettingsUseCaseManager $app_settings_use_case_manager;
     73    private PointOfInterestUseCaseManager $point_of_interest_use_case_manager;
     74
     75    public function __construct( BackendClient $backend_client, SelfClient $self_client ) {
     76        $this->get_android_asset_link_use_case         = new GetAndroidAssetLinkUseCase();
     77        $this->get_apple_app_site_association_use_case = new GetAppleAppSiteAssociationUseCase();
     78        $this->get_logs_use_case                       = new GetLogsUseCase();
     79        $this->get_blog_info_use_case                  = new GetBlogInfoUseCase();
     80        $this->is_logged_in_use_case                   = new IsLoggedInUseCase();
     81        $this->delete_session_use_case                 = new DeleteSessionUseCase( $backend_client );
     82        $this->register_blog_use_case                  = new RegisterBlogUseCase( $backend_client );
     83        $this->category_save_use_case                  = new CategorySaveUseCase( $backend_client );
     84        $this->category_delete_use_case                = new CategoryDeleteUseCase( $backend_client );
     85        $this->tag_delete_use_case                     = new TagDeleteUseCase( $backend_client );
     86        $this->tag_save_use_case                       = new TagSaveUseCase( $backend_client );
     87        $this->get_posts_by_id_use_case                = new GetPostsByIdUseCase();
     88        $this->get_tag_sync_data_use_case              = new GetTagSyncDataUseCase();
     89        $this->send_tag_chunk_sync_use_case            = new SendTagChunkSyncUseCase( $backend_client );
     90        $this->get_tags_by_id_use_case                 = new GetTagsByIdUseCase();
     91        $this->send_category_chunk_sync_use_case       = new SendCategoryChunkSyncUseCase( $backend_client );
     92        $this->get_category_sync_data_use_case         = new GetCategorySyncDataUseCase();
     93        $this->get_categories_by_id_use_case           = new GetCategoriesByIdUseCase();
     94        $this->send_attachment_chunk_sync_use_case     = new SendAttachmentChunkSyncUseCase( $backend_client );
     95        $this->get_attachments_by_id_use_case          = new GetAttachmentsByIdUseCase();
     96        $this->get_attachment_sync_data_use_case       = new GetAttachmentSyncDataUseCase();
     97        $this->send_comment_chunk_sync_use_case        = new SendCommentChunkSyncUseCase( $backend_client );
     98        $this->get_comments_by_id_use_case             = new GetCommentsByIdUseCase();
     99        $this->comment_save_use_case                   = new CommentSaveUseCase( $backend_client );
     100        $this->get_comment_sync_data_use_case          = new GetCommentSyncDataUseCase();
     101        $this->logout_user_use_case                    = new LogoutUserUseCase( $backend_client );
     102        $this->get_users_by_id_use_case                = new GetUsersByIdUseCase();
     103        $this->get_user_sync_data_use_case             = new GetUserSyncDataUseCase();
     104        $this->send_user_chunk_sync_use_case           = new SendUserChunkSyncUseCase( $backend_client );
     105        $this->sync_users_use_case                     = new SyncUsersUseCase( $this->get_user_sync_data_use_case, $this->send_user_chunk_sync_use_case );
     106        $this->sync_comments_use_case                  = new SyncCommentsUseCase( $this->get_comment_sync_data_use_case, $this->send_comment_chunk_sync_use_case );
     107        $this->sync_tags_use_case                      = new SyncTagsUseCase( $this->get_tag_sync_data_use_case, $this->send_tag_chunk_sync_use_case );
     108        $this->sync_categories_use_case                = new SyncCategoriesUseCase( $this->get_category_sync_data_use_case, $this->send_category_chunk_sync_use_case );
     109        $this->sync_attachments_use_case               = new SyncAttachmentsUseCase( $this->get_attachment_sync_data_use_case, $this->send_attachment_chunk_sync_use_case );
     110        $this->post_delete_use_case                    = new PostDeleteUseCase( $backend_client );
     111        $this->comment_delete_use_case                 = new CommentDeleteUseCase( $backend_client );
     112        $this->attachment_delete_use_case              = new AttachmentDeleteUseCase( $backend_client );
     113        $this->attachment_save_use_case                = new AttachmentSaveUseCase( $backend_client );
     114        $this->user_delete_use_case                    = new UserDeleteUseCase( $backend_client );
     115        $this->user_save_use_case                      = new UserSaveUseCase( $backend_client );
     116        $this->clear_logs_use_case                     = new ClearLogsUseCase();
     117        $this->authenticate_user_use_case              = new AuthenticateUserUseCase();
     118        $this->pull_local_post_content_use_case        = new PullLocalPostContentUseCase( $self_client );
     119        $this->get_local_post_content_by_id_use_case   = new GetLocalPostContentByIdUseCase();
     120        $this->get_post_contents_by_id_use_case        = new GetPostContentsByIdUseCase( $this->pull_local_post_content_use_case );
     121        $this->create_comment_use_case                 = new CreateCommentUseCase();
     122        $this->get_roles_by_id_use_case                = new GetRolesByIdUseCase();
     123        $this->get_role_sync_data_use_case             = new GetRoleSyncDataUseCase();
     124        $this->send_role_chunk_sync_use_case           = new SendRoleChunkSyncUseCase( $backend_client );
     125        $this->sync_roles_use_case                     = new SyncRolesUseCase( $this->get_role_sync_data_use_case, $this->send_role_chunk_sync_use_case );
     126        $this->get_pages_by_id_use_case                = new GetPagesByIdUseCase();
     127        $this->get_page_sync_data_use_case             = new GetPageSyncDataUseCase();
     128        $this->page_delete_use_case                    = new PageDeleteUseCase( $backend_client );
     129        $this->page_save_use_case                      = new PageSaveUseCase( $backend_client );
     130        $this->send_page_chunk_sync_use_case           = new SendPageChunkSyncUseCase( $backend_client );
     131        $this->sync_pages_use_case                     = new SyncPagesUseCase( $this->get_page_sync_data_use_case, $this->send_page_chunk_sync_use_case );
     132        $this->page_use_case_manager                   = new PageUseCaseManager( $self_client );
     133        $this->post_use_case_manager                   = new PostUseCaseManager( $backend_client );
     134        $this->app_settings_use_case_manager           = new AppSettingsUseCaseManager( $backend_client );
     135        $this->point_of_interest_use_case_manager      = new PointOfInterestUseCaseManager( $backend_client );
     136        $this->sync_all_use_case                       = new SyncAllUseCase( $this->post_use_case_manager->get_sync_posts_use_case(), $this->sync_tags_use_case, $this->sync_categories_use_case, $this->sync_attachments_use_case, $this->sync_comments_use_case, $this->sync_users_use_case, $this->sync_roles_use_case, $this->sync_pages_use_case, $this->points_of_interest()->get_sync_points_of_interest_use_case() );
     137    }
     138
     139    public function get_android_asset_link_use_case(): GetAndroidAssetLinkUseCase {
     140        return $this->get_android_asset_link_use_case;
     141    }
     142
     143    public function get_apple_app_site_association_use_case(): GetAppleAppSiteAssociationUseCase {
     144        return $this->get_apple_app_site_association_use_case;
     145    }
     146
     147    public function get_logs_use_case(): GetLogsUseCase {
     148        return $this->get_logs_use_case;
     149    }
     150
     151    public function get_blog_info_use_case(): GetBlogInfoUseCase {
     152        return $this->get_blog_info_use_case;
     153    }
     154
     155    public function is_logged_in_use_case(): IsLoggedInUseCase {
     156        return $this->is_logged_in_use_case;
     157    }
     158
     159    public function delete_session_use_case(): DeleteSessionUseCase {
     160        return $this->delete_session_use_case;
     161    }
     162
     163    public function register_blog_use_case(): RegisterBlogUseCase {
     164        return $this->register_blog_use_case;
     165    }
     166
     167    public function category_save_use_case(): CategorySaveUseCase {
     168        return $this->category_save_use_case;
     169    }
     170
     171    public function category_delete_use_case(): CategoryDeleteUseCase {
     172        return $this->category_delete_use_case;
     173    }
     174
     175    public function tag_delete_use_case(): TagDeleteUseCase {
     176        return $this->tag_delete_use_case;
     177    }
     178
     179    public function tag_save_use_case(): TagSaveUseCase {
     180        return $this->tag_save_use_case;
     181    }
     182
     183    public function get_posts_by_id_use_case(): GetPostsByIdUseCase {
     184        return $this->get_posts_by_id_use_case;
     185    }
     186
     187    public function get_tag_sync_data_use_case(): GetTagSyncDataUseCase {
     188        return $this->get_tag_sync_data_use_case;
     189    }
     190
     191    public function send_tag_chunk_sync_use_case(): SendTagChunkSyncUseCase {
     192        return $this->send_tag_chunk_sync_use_case;
     193    }
     194
     195    public function get_tags_by_id_use_case(): GetTagsByIdUseCase {
     196        return $this->get_tags_by_id_use_case;
     197    }
     198
     199    public function send_category_chunk_sync_use_case(): SendCategoryChunkSyncUseCase {
     200        return $this->send_category_chunk_sync_use_case;
     201    }
     202
     203    public function get_category_sync_data_use_case(): GetCategorySyncDataUseCase {
     204        return $this->get_category_sync_data_use_case;
     205    }
     206
     207    public function get_categories_by_id_use_case(): GetCategoriesByIdUseCase {
     208        return $this->get_categories_by_id_use_case;
     209    }
     210
     211    public function send_attachment_chunk_sync_use_case(): SendAttachmentChunkSyncUseCase {
     212        return $this->send_attachment_chunk_sync_use_case;
     213    }
     214
     215    public function send_comment_chunk_sync_use_case(): SendCommentChunkSyncUseCase {
     216        return $this->send_comment_chunk_sync_use_case;
     217    }
     218
     219    public function get_attachments_by_id_use_case(): GetAttachmentsByIdUseCase {
     220        return $this->get_attachments_by_id_use_case;
     221    }
     222
     223    public function comment_save_use_case(): CommentSaveUseCase {
     224        return $this->comment_save_use_case;
     225    }
     226
     227    public function get_comment_sync_data_use_case(): GetCommentSyncDataUseCase {
     228        return $this->get_comment_sync_data_use_case;
     229    }
     230
     231    public function get_attachment_sync_data_use_case(): GetAttachmentSyncDataUseCase {
     232        return $this->get_attachment_sync_data_use_case;
     233    }
     234
     235    public function get_comments_by_id_use_case(): GetCommentsByIdUseCase {
     236        return $this->get_comments_by_id_use_case;
     237    }
     238
     239    public function logout_user_use_case(): LogoutUserUseCase {
     240        return $this->logout_user_use_case;
     241    }
     242
     243    public function sync_comments_use_case(): SyncCommentsUseCase {
     244        return $this->sync_comments_use_case;
     245    }
     246
     247    public function sync_tags_use_case(): SyncTagsUseCase {
     248        return $this->sync_tags_use_case;
     249    }
     250
     251    public function sync_categories_use_case(): SyncCategoriesUseCase {
     252        return $this->sync_categories_use_case;
     253    }
     254
     255    public function sync_attachments_use_case(): SyncAttachmentsUseCase {
     256        return $this->sync_attachments_use_case;
     257    }
     258
     259    public function sync_all_use_case(): SyncAllUseCase {
     260        return $this->sync_all_use_case;
     261    }
     262
     263    public function post_delete_use_case(): PostDeleteUseCase {
     264        return $this->post_delete_use_case;
     265    }
     266
     267    public function comment_delete_use_case(): CommentDeleteUseCase {
     268        return $this->comment_delete_use_case;
     269    }
     270
     271    public function attachment_delete_use_case(): AttachmentDeleteUseCase {
     272        return $this->attachment_delete_use_case;
     273    }
     274
     275    public function attachment_save_use_case(): AttachmentSaveUseCase {
     276        return $this->attachment_save_use_case;
     277    }
     278
     279    public function get_users_by_id_use_case(): GetUsersByIdUseCase {
     280        return $this->get_users_by_id_use_case;
     281    }
     282
     283    public function get_user_sync_data_use_case(): GetUserSyncDataUseCase {
     284        return $this->get_user_sync_data_use_case;
     285    }
     286
     287    public function send_user_chunk_sync_use_case(): SendUserChunkSyncUseCase {
     288        return $this->send_user_chunk_sync_use_case;
     289    }
     290
     291    public function user_delete_use_case(): UserDeleteUseCase {
     292        return $this->user_delete_use_case;
     293    }
     294
     295    public function user_save_use_case(): UserSaveUseCase {
     296        return $this->user_save_use_case;
     297    }
     298
     299    public function sync_users_use_case(): SyncUsersUseCase {
     300        return $this->sync_users_use_case;
     301    }
     302
     303    public function get_post_contents_by_id_use_case(): GetPostContentsByIdUseCase {
     304        return $this->get_post_contents_by_id_use_case;
     305    }
     306
     307    public function get_clear_logs_use_case(): ClearLogsUseCase {
     308        return $this->clear_logs_use_case;
     309    }
     310
     311    public function get_authenticate_user_use_case(): AuthenticateUserUseCase {
     312        return $this->authenticate_user_use_case;
     313    }
     314
     315    public function get_pull_local_post_content_use_case(): PullLocalPostContentUseCase {
     316        return $this->pull_local_post_content_use_case;
     317    }
     318
     319    public function get_get_local_post_content_by_id_use_case(): GetLocalPostContentByIdUseCase {
     320        return $this->get_local_post_content_by_id_use_case;
     321    }
     322
     323    public function create_comment_use_case(): CreateCommentUseCase {
     324        return $this->create_comment_use_case;
     325    }
     326
     327    public function get_roles_by_id_use_case(): GetRolesByIdUseCase {
     328        return $this->get_roles_by_id_use_case;
     329    }
     330
     331    public function get_role_sync_data_use_case(): GetRoleSyncDataUseCase {
     332        return $this->get_role_sync_data_use_case;
     333    }
     334
     335    public function send_role_chunk_sync_use_case(): SendRoleChunkSyncUseCase {
     336        return $this->send_role_chunk_sync_use_case;
     337    }
     338
     339    public function sync_roles_use_case(): SyncRolesUseCase {
     340        return $this->sync_roles_use_case;
     341    }
     342
     343    public function get_pages_by_id_use_case(): GetPagesByIdUseCase {
     344        return $this->get_pages_by_id_use_case;
     345    }
     346
     347    public function get_page_sync_data_use_case(): GetPageSyncDataUseCase {
     348        return $this->get_page_sync_data_use_case;
     349    }
     350
     351    public function page_delete_use_case(): PageDeleteUseCase {
     352        return $this->page_delete_use_case;
     353    }
     354
     355    public function page_save_use_case(): PageSaveUseCase {
     356        return $this->page_save_use_case;
     357    }
     358
     359    public function send_page_chunk_sync_use_case(): SendPageChunkSyncUseCase {
     360        return $this->send_page_chunk_sync_use_case;
     361    }
     362
     363    public function sync_pages_use_case(): SyncPagesUseCase {
     364        return $this->sync_pages_use_case;
     365    }
     366
     367    public function pages(): PageUseCaseManager {
     368        return $this->page_use_case_manager;
     369    }
     370
     371    public function posts(): PostUseCaseManager {
     372        return $this->post_use_case_manager;
     373    }
     374
     375    public function app_settings(): AppSettingsUseCaseManager {
     376        return $this->app_settings_use_case_manager;
     377    }
     378
     379    public function points_of_interest(): PointOfInterestUseCaseManager {
     380        return $this->point_of_interest_use_case_manager;
     381    }
    375382}
  • appful-app/tags/3.1.23/includes/use_cases/post/SyncPostUseCase.php

    r3027388 r3043568  
    44
    55class SyncPostUseCase {
    6     private GetPostSyncItemUseCase $get_post_sync_item_use_case;
    7     private SendPostSyncUseCase $send_post_sync_use_case;
     6    private GetPostSyncItemUseCase $get_post_sync_item_use_case;
     7    private SendPostSyncUseCase $send_post_sync_use_case;
    88
    9     public function __construct(
    10         GetPostSyncItemUseCase $get_post_sync_item_use_case,
    11         SendPostSyncUseCase $send_post_sync_use_case
    12     ) {
    13         $this->get_post_sync_item_use_case = $get_post_sync_item_use_case;
    14         $this->send_post_sync_use_case     = $send_post_sync_use_case;
    15     }
     9    public function __construct(
     10        GetPostSyncItemUseCase $get_post_sync_item_use_case,
     11        SendPostSyncUseCase $send_post_sync_use_case
     12    ) {
     13        $this->get_post_sync_item_use_case = $get_post_sync_item_use_case;
     14        $this->send_post_sync_use_case     = $send_post_sync_use_case;
     15    }
    1616
    17     public function invoke( int $post_id, bool $force ) {
    18         $post = $this->get_post_sync_item_use_case->invoke( $post_id );
    19         $post = $post->force_update( $force );
    20         $this->send_post_sync_use_case->invoke( $post );
    21     }
     17    public function invoke( int $post_id, bool $force = false ): void {
     18        $post = $this->get_post_sync_item_use_case->invoke( $post_id );
     19        $post = $post->force_update( $force );
     20        $this->send_post_sync_use_case->invoke( $post );
     21    }
    2222}
  • appful-app/tags/3.1.23/includes/wp/WPPostDatabaseManager.php

    r3027388 r3043568  
    33namespace AppfulPlugin\Wp;
    44
     5use AppfulPlugin\Domain\PointOfInterest\PointOfInterest;
     6use AppfulPlugin\Domain\PointOfInterest\PostPointOfInterest;
    57use AppfulPlugin\Domain\SyncItem;
     8use AppfulPlugin\Helper\Constants;
    69use AppfulPlugin\Helper\DateParser;
     10use AppfulPlugin\Wp\Entities\PostCoordinatesEntity;
    711
    812class WPPostDatabaseManager {
     
    6771        return $wpdb->get_var( $query );
    6872    }
     73
     74    /**
     75     * @param int[] $ids
     76     *
     77     * @return PointOfInterest[]
     78     */
     79    public static function get_points_of_interest_for_ids( array $ids ): array {
     80        global $wpdb;
     81
     82        if ( empty( $ids ) ) {
     83            return [];
     84        }
     85
     86        $commaDelimitedIds = implode( ',', array_fill( 0, count( $ids ), '%d' ) );
     87        $query             = $wpdb->prepare( "SELECT post.ID, post.post_title, post.post_modified_gmt, meta.meta_value FROM $wpdb->posts AS post INNER JOIN $wpdb->postmeta AS meta ON post.ID = meta.post_id WHERE post.ID IN($commaDelimitedIds) AND meta.meta_key = %s ORDER BY post.ID DESC", array_merge( $ids, [ Constants::$APPFUL_POST_META_COORDINATES_KEY ] ) );
     88        $results           = $wpdb->get_results( $query );
     89
     90        return array_map(
     91            function ( $item ) {
     92                $coordinates_object = json_decode( $item->meta_value );
     93                $coordinates        = new PostCoordinatesEntity(null, 0, 0 );
     94                if ( $coordinates_object ) {
     95                    $coordinates = new PostCoordinatesEntity( $coordinates_object->name, $coordinates_object->latitude, $coordinates_object->longitude );
     96                }
     97
     98                return new PostPointOfInterest(
     99                    $item->ID,
     100                    $coordinates->name ?? $item->post_title,
     101                    $coordinates->longitude,
     102                    $coordinates->latitude,
     103                    DateParser::fromGmtDate( $item->post_modified_gmt ),
     104                    $item->ID
     105                );
     106            },
     107            $results
     108        );
     109    }
    69110}
  • appful-app/tags/3.1.23/includes/wp/WPPostManager.php

    r3028218 r3043568  
    33namespace AppfulPlugin\Wp;
    44
     5use AppfulPlugin\Domain\PointOfInterest\PointOfInterest;
    56use AppfulPlugin\Domain\Post;
    67use AppfulPlugin\Domain\PostContent;
     
    89use AppfulPlugin\Helper\Constants;
    910use AppfulPlugin\Helper\Logger;
     11use AppfulPlugin\Wp\Entities\PostCoordinatesEntity;
    1012use AppfulPlugin\Wp\Mapper\PostMapper;
    1113use AppfulPlugin\Wp\Plugins\LanguageHelper;
     
    1315
    1416class WPPostManager {
    15     public static function get_post_permalink( WP_Post $post ): ?string {
    16         return get_permalink( $post );
    17     }
    18 
    19     public static function is_post_sticky( int $post_id ): bool {
    20         return is_sticky( $post_id );
    21     }
    22 
    23     public static function should_send_push( int $post_id ): bool {
    24         $push_term = get_term_by( "slug", Constants::$APPFUL_TAXONOMY_PUSH_TERM_SLUG, Constants::$APPFUL_TAXONOMY_NAME );
    25 
    26         if ( $push_term ) {
    27             return has_term( $push_term->term_id, Constants::$APPFUL_TAXONOMY_NAME, $post_id ) == false;
    28         }
    29 
    30         return true;
    31     }
    32 
    33     public static function get_post_language( int $post_id ): string {
    34         return LanguageHelper::get_post_language( $post_id );
    35     }
    36 
    37     public static function get_post_for_id( int $post_id ): ?Post {
    38         $post = get_post( $post_id );
    39         if ( $post != null ) {
    40             return PostMapper::to_domain( $post );
    41         } else {
    42             return null;
    43         }
    44     }
    45 
    46     public static function get_post_count(): int {
    47         return WPPostDatabaseManager::get_count_for_type( "post" );
    48     }
    49 
    50     public static function get_taxonomy_post_count( string $taxonomy, string $term_slug ): int {
    51         return WPPostDatabaseManager::get_count_for_type_and_taxonomy( "post", $taxonomy, $term_slug );
    52     }
    53 
    54     /** @return SyncItem[] */
    55     public static function get_post_sync_items( int $offset, int $count ): array {
    56         return WPPostDatabaseManager::get_sync_items_for_type( "post", $count, $offset );
    57     }
    58 
    59     /** @return SyncItem[] */
    60     public static function get_taxonomy_post_sync_items( string $taxonomy, string $term_slug, int $offset, int $count ): array {
    61         return WPPostDatabaseManager::get_sync_items_for_type_and_taxonomy( "post", $taxonomy, $term_slug, $count, $offset );
    62     }
    63 
    64     public static function get_post_sync_item( int $post_id ): SyncItem {
    65         return WPPostDatabaseManager::get_sync_item_for_type( "post", $post_id );
    66     }
    67 
    68     /**
    69      * @param int[] $ids
    70      *
    71      * @return Post[]
    72      */
    73     public static function get_posts_by_id( array $ids ): array {
    74         $args = [
    75             "numberposts" => - 1,
    76             "include"     => $ids,
    77             "post_status" => self::get_allowed_post_stati()
    78         ];
    79 
    80         $all_posts = get_posts( $args );
    81 
    82         $all_posts = array_values(
    83             array_filter( $all_posts, function ( WP_Post $post ) use ( $ids ) {
    84                 return in_array( $post->ID, $ids );
    85             } )
    86         );
    87 
    88         return array_map(
    89             function ( WP_Post $post ) {
    90                 return PostMapper::to_domain( $post );
    91             },
    92             $all_posts
    93         );
    94     }
    95 
    96     public static function get_post_content_by_id( int $id ): ?PostContent {
    97         global $wp_query;
    98 
    99         $args = [
    100             "post_type"   => "post",
    101             "p"           => $id,
    102             "post_status" => self::get_allowed_post_stati()
    103         ];
    104 
    105         $wp_query = new \WP_Query( $args );
    106 
    107         self::setup_wp_call();
    108 
    109         if ( have_posts() ) {
    110             the_post();
    111 
    112             Logger::debug( "Getting head!" );
    113             $head = self::get_data_code( 'wp_head' );
    114             Logger::debug( "Getting content!" );
    115             $content = self::get_data_code( 'the_content' );
    116             Logger::debug( "Getting footer!" );
    117             $footer = self::get_data_code( 'wp_footer' );
    118             Logger::debug( "Getting body classes!" );
    119             $body_class = self::get_data_code( 'body_class' );
    120 
    121             wp_reset_postdata();
    122 
    123             return PostContent::postContent()
    124                               ->id( get_the_ID() )
    125                               ->content( $content )
    126                               ->head( $head )
    127                               ->footer( $footer )
    128                               ->body_class( $body_class );
    129         }
    130 
    131         return null;
    132     }
    133 
    134     private static function get_data_code( callable $data_callback ): string {
    135         // The original buffer level before our handling
    136         $buffer_level_original = ob_get_level();
    137 
    138         // Start our custom buffer which we want to use to get the content
    139         ob_start();
    140 
    141         // Open some extra buffers in case somehow there is a
    142         // buffer closed which wasn't opened before
    143         for ( $i = 0; $i < 100; $i ++ ) {
    144             ob_start();
    145         }
    146 
    147         // Amount of buffers with our custom output buffers opened
    148         $buffer_level_fill = ob_get_level();
    149 
    150         call_user_func( $data_callback );
    151 
    152         // This is the level after the content call, if it is different from the one before
    153         // we have buffers which weren't closed correctly or were closed too much
    154         // We can't correctly detect what happened when buffers where closed and
    155         // opened at the same time, so we just hope that in one call only one of the both happens
    156         $buffer_level_end = ob_get_level();
    157 
    158         if ( $buffer_level_end > $buffer_level_fill ) {
    159             Logger::debug( "Buffers where opened too much, getting data with adjustment" );
    160 
    161             // New buffers were opened inside the head
    162             // We can just proceed by closing the buffers and accumulating their content
    163 
    164             // Get the information how much more buffers we have to close
    165             $opened_buffer_count = $buffer_level_end - $buffer_level_fill;
    166             Logger::debug( "Closing " . $opened_buffer_count . " extra buffers to get content" );
    167 
    168             return self::accumulate_buffer_data( $buffer_level_original );
    169         } else if ( $buffer_level_end < $buffer_level_fill ) {
    170             Logger::debug( "Buffers where closed too much, getting data with adjustment" );
    171 
    172             // Unknown buffers were closed inside the head
    173             // We have to reset our buffers and call the function again
    174 
    175             // Even tho there were more buffers closed than opened before, we assume that
    176             // there are not more than 100 and accumulate all the output
    177             $output = self::accumulate_buffer_data( $buffer_level_original );
    178 
    179             // Open the correct amount of buffers which are closed in the call
    180             $closed_buffer_count = $buffer_level_fill - $buffer_level_end;
    181             Logger::debug( $closed_buffer_count . " extra buffers where closed" );
    182 
    183             return $output;
    184         } else {
    185             Logger::debug( "Buffer level normal, getting data without adjustment" );
    186 
    187             // If we don't have a malicious actor in the content call we can use the normal method
    188 
    189             return self::accumulate_buffer_data( $buffer_level_original );
    190         }
    191     }
    192 
    193     // Close all buffers until the target level is reached and return the accumulated data
    194     private static function accumulate_buffer_data( int $target_level ): string {
    195         $data = "";
    196         // The first condition is a safety measure in case the target level is negative
    197         while ( ob_get_level() > 0 && ob_get_level() > $target_level ) {
    198             $data .= ob_get_clean();
    199         }
    200 
    201         return $data;
    202     }
    203 
    204     private static function setup_wp_call() {
    205         // This should trick "smart" plugins to stop posting their spam
    206         // bc. some plugins register a shutdown function, but rightfully don't
    207         // do it when it's a cron. So let's pretend we are.
    208         if ( ! defined( 'DOING_CRON' ) ) {
    209             define( 'DOING_CRON', true );
    210         }
    211 
    212         // We try to initialize a "frontend" theme so that all hooks etc.
    213         // by plugins are setup correctly
    214         do_action( 'template_redirect' );
    215     }
    216 
    217     /**
    218      * @return string[]
    219      */
    220     private static function get_allowed_post_stati(): array {
    221         return array_filter( get_post_stati(), function ( string $status ) {
    222             return $status != "auto-draft";
    223         } );
    224     }
     17    public static function get_post_permalink( WP_Post $post ): ?string {
     18        return get_permalink( $post );
     19    }
     20
     21    public static function is_post_sticky( int $post_id ): bool {
     22        return is_sticky( $post_id );
     23    }
     24
     25    public static function should_send_push( int $post_id ): bool {
     26        $push_term = get_term_by( "slug", Constants::$APPFUL_TAXONOMY_PUSH_TERM_SLUG, Constants::$APPFUL_TAXONOMY_NAME );
     27
     28        if ( $push_term ) {
     29            return has_term( $push_term->term_id, Constants::$APPFUL_TAXONOMY_NAME, $post_id ) == false;
     30        }
     31
     32        return true;
     33    }
     34
     35    public static function get_post_language( int $post_id ): string {
     36        return LanguageHelper::get_post_language( $post_id );
     37    }
     38
     39    public static function get_post_for_id( int $post_id ): ?Post {
     40        $post = get_post( $post_id );
     41        if ( $post != null ) {
     42            return PostMapper::to_domain( $post );
     43        } else {
     44            return null;
     45        }
     46    }
     47
     48    public static function get_post_count(): int {
     49        return WPPostDatabaseManager::get_count_for_type( "post" );
     50    }
     51
     52    public static function get_taxonomy_post_count( string $taxonomy, string $term_slug ): int {
     53        return WPPostDatabaseManager::get_count_for_type_and_taxonomy( "post", $taxonomy, $term_slug );
     54    }
     55
     56    /** @return SyncItem[] */
     57    public static function get_post_sync_items( int $offset, int $count ): array {
     58        return WPPostDatabaseManager::get_sync_items_for_type( "post", $count, $offset );
     59    }
     60
     61    /** @return SyncItem[] */
     62    public static function get_taxonomy_post_sync_items( string $taxonomy, string $term_slug, int $offset, int $count ): array {
     63        return WPPostDatabaseManager::get_sync_items_for_type_and_taxonomy( "post", $taxonomy, $term_slug, $count, $offset );
     64    }
     65
     66    public static function get_post_sync_item( int $post_id ): SyncItem {
     67        return WPPostDatabaseManager::get_sync_item_for_type( "post", $post_id );
     68    }
     69
     70    public static function get_post_coordinates( int $post_id ): ?PostCoordinatesEntity {
     71        $meta = get_post_meta( $post_id, Constants::$APPFUL_POST_META_COORDINATES_KEY, true );
     72        if ( ! $meta ) {
     73            return null;
     74        }
     75
     76        $meta_value = json_decode( $meta );
     77        if ( $meta_value ) {
     78            return new PostCoordinatesEntity( $meta_value->name, $meta_value->latitude, $meta_value->longitude );
     79        }
     80
     81        return null;
     82    }
     83
     84    public static function save_coordinates( int $post_id, ?string $name, string $long, string $lat ) {
     85        $longitude = floatval( $long );
     86        $latitude  = floatval( $lat );
     87        $data = json_encode( new PostCoordinatesEntity( $name, $latitude, $longitude ) );
     88        update_post_meta( $post_id, Constants::$APPFUL_POST_META_COORDINATES_KEY, $data );
     89    }
     90
     91    public static function delete_coordinates( int $post_id ) {
     92        delete_post_meta( $post_id, Constants::$APPFUL_POST_META_COORDINATES_KEY );
     93    }
     94
     95    /**
     96     * @param int[] $ids
     97     *
     98     * @return PointOfInterest[]
     99     */
     100    public static function get_points_of_interest_by_id( array $ids ): array {
     101        return WPPostDatabaseManager::get_points_of_interest_for_ids( $ids );
     102    }
     103
     104    /**
     105     * @param int[] $ids
     106     *
     107     * @return Post[]
     108     */
     109    public static function get_posts_by_id( array $ids ): array {
     110        $args = [
     111            "numberposts" => - 1,
     112            "include"     => $ids,
     113            "post_status" => self::get_allowed_post_stati()
     114        ];
     115
     116        $all_posts = get_posts( $args );
     117
     118        $all_posts = array_values(
     119            array_filter( $all_posts, function ( WP_Post $post ) use ( $ids ) {
     120                return in_array( $post->ID, $ids );
     121            } )
     122        );
     123
     124        return array_map(
     125            function ( WP_Post $post ) {
     126                return PostMapper::to_domain( $post );
     127            },
     128            $all_posts
     129        );
     130    }
     131
     132    public static function get_post_content_by_id( int $id ): ?PostContent {
     133        global $wp_query;
     134
     135        $args = [
     136            "post_type"   => "post",
     137            "p"           => $id,
     138            "post_status" => self::get_allowed_post_stati()
     139        ];
     140
     141        $wp_query = new \WP_Query( $args );
     142
     143        self::setup_wp_call();
     144
     145        if ( have_posts() ) {
     146            the_post();
     147
     148            Logger::debug( "Getting head!" );
     149            $head = self::get_data_code( 'wp_head' );
     150            Logger::debug( "Getting content!" );
     151            $content = self::get_data_code( 'the_content' );
     152            Logger::debug( "Getting footer!" );
     153            $footer = self::get_data_code( 'wp_footer' );
     154            Logger::debug( "Getting body classes!" );
     155            $body_class = self::get_data_code( 'body_class' );
     156
     157            wp_reset_postdata();
     158
     159            return PostContent::postContent()
     160                              ->id( get_the_ID() )
     161                              ->content( $content )
     162                              ->head( $head )
     163                              ->footer( $footer )
     164                              ->body_class( $body_class );
     165        }
     166
     167        return null;
     168    }
     169
     170    private static function get_data_code( callable $data_callback ): string {
     171        // The original buffer level before our handling
     172        $buffer_level_original = ob_get_level();
     173
     174        // Start our custom buffer which we want to use to get the content
     175        ob_start();
     176
     177        // Open some extra buffers in case somehow there is a
     178        // buffer closed which wasn't opened before
     179        for ( $i = 0; $i < 100; $i ++ ) {
     180            ob_start();
     181        }
     182
     183        // Amount of buffers with our custom output buffers opened
     184        $buffer_level_fill = ob_get_level();
     185
     186        call_user_func( $data_callback );
     187
     188        // This is the level after the content call, if it is different from the one before
     189        // we have buffers which weren't closed correctly or were closed too much
     190        // We can't correctly detect what happened when buffers where closed and
     191        // opened at the same time, so we just hope that in one call only one of the both happens
     192        $buffer_level_end = ob_get_level();
     193
     194        if ( $buffer_level_end > $buffer_level_fill ) {
     195            Logger::debug( "Buffers where opened too much, getting data with adjustment" );
     196
     197            // New buffers were opened inside the head
     198            // We can just proceed by closing the buffers and accumulating their content
     199
     200            // Get the information how much more buffers we have to close
     201            $opened_buffer_count = $buffer_level_end - $buffer_level_fill;
     202            Logger::debug( "Closing " . $opened_buffer_count . " extra buffers to get content" );
     203
     204            return self::accumulate_buffer_data( $buffer_level_original );
     205        } else if ( $buffer_level_end < $buffer_level_fill ) {
     206            Logger::debug( "Buffers where closed too much, getting data with adjustment" );
     207
     208            // Unknown buffers were closed inside the head
     209            // We have to reset our buffers and call the function again
     210
     211            // Even tho there were more buffers closed than opened before, we assume that
     212            // there are not more than 100 and accumulate all the output
     213            $output = self::accumulate_buffer_data( $buffer_level_original );
     214
     215            // Open the correct amount of buffers which are closed in the call
     216            $closed_buffer_count = $buffer_level_fill - $buffer_level_end;
     217            Logger::debug( $closed_buffer_count . " extra buffers where closed" );
     218
     219            return $output;
     220        } else {
     221            Logger::debug( "Buffer level normal, getting data without adjustment" );
     222
     223            // If we don't have a malicious actor in the content call we can use the normal method
     224
     225            return self::accumulate_buffer_data( $buffer_level_original );
     226        }
     227    }
     228
     229    // Close all buffers until the target level is reached and return the accumulated data
     230    private static function accumulate_buffer_data( int $target_level ): string {
     231        $data = "";
     232        // The first condition is a safety measure in case the target level is negative
     233        while ( ob_get_level() > 0 && ob_get_level() > $target_level ) {
     234            $data .= ob_get_clean();
     235        }
     236
     237        return $data;
     238    }
     239
     240    private static function setup_wp_call() {
     241        // We try to initialize a "frontend" theme so that all hooks etc.
     242        // by plugins are setup correctly
     243        do_action( 'template_redirect' );
     244    }
     245
     246    /**
     247     * @return string[]
     248     */
     249    private static function get_allowed_post_stati(): array {
     250        return array_filter( get_post_stati(), function ( string $status ) {
     251            return $status != "auto-draft";
     252        } );
     253    }
    225254}
  • appful-app/tags/3.1.23/includes/wp/mapper/CategoryMapper.php

    r2907312 r3043568  
    1515                       ->description( $category->description )
    1616                       ->slug( $category->slug )
    17                        ->title( $category->name )
     17                       ->title( html_entity_decode($category->name) )
    1818                       ->parent( ( $category->parent != 0 ) ? self::to_domain( get_term( $category->parent ) ) : null )
    1919                       ->language( WPCategoryManager::get_category_language( $category->term_id ) )
  • appful-app/tags/3.1.23/includes/wp/mapper/TagMapper.php

    r2907312 r3043568  
    1414                  ->description( $tag->description )
    1515                  ->slug( $tag->slug )
    16                   ->title( $tag->name )
     16                  ->title( html_entity_decode($tag->name) )
    1717                  ->language( WPTagManager::get_tag_language( $tag->term_id ) )
    1818                  ->image( WPAttachmentManager::get_image_for_term_id( $tag->term_id ) );
  • appful-app/tags/3.1.23/lib/vendor/composer/autoload_classmap.php

    r3039311 r3043568  
    2121    'AppfulPlugin\\Api\\Dtos\\PageContentDto' => $baseDir . '/../includes/api/dtos/PageContentDto.php',
    2222    'AppfulPlugin\\Api\\Dtos\\PageDto' => $baseDir . '/../includes/api/dtos/PageDto.php',
     23    'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PointOfInterestDto' => $baseDir . '/../includes/api/dtos/point_of_interest/PointOfInterestDto.php',
     24    'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PostPointOfInterestDto' => $baseDir . '/../includes/api/dtos/point_of_interest/PostPointOfInterestDto.php',
    2325    'AppfulPlugin\\Api\\Dtos\\PostContentDto' => $baseDir . '/../includes/api/dtos/PostContentDto.php',
    2426    'AppfulPlugin\\Api\\Dtos\\PostDto' => $baseDir . '/../includes/api/dtos/PostDto.php',
     
    5254    'AppfulPlugin\\Api\\Handlers\\PageSyncRequestHandler' => $baseDir . '/../includes/api/handlers/PageSyncRequestHandler.php',
    5355    'AppfulPlugin\\Api\\Handlers\\Page\\GetPageContentRequestHandler' => $baseDir . '/../includes/api/handlers/page/GetPageContentRequestHandler.php',
     56    'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\GetPointsOfInterestRequestHandler' => $baseDir . '/../includes/api/handlers/point_of_interest/GetPointsOfInterestRequestHandler.php',
     57    'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\PointOfInterestSyncRequestHandler' => $baseDir . '/../includes/api/handlers/point_of_interest/PointOfInterestSyncRequestHandler.php',
    5458    'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => $baseDir . '/../includes/api/handlers/PostSyncRequestHandler.php',
    5559    'AppfulPlugin\\Api\\Handlers\\PullLocalPageContentRequestHandler' => $baseDir . '/../includes/api/handlers/PullLocalPageContentRequestHandler.php',
     
    7175    'AppfulPlugin\\Api\\Mapper\\PageContentMapper' => $baseDir . '/../includes/api/mapper/PageContentMapper.php',
    7276    'AppfulPlugin\\Api\\Mapper\\PageMapper' => $baseDir . '/../includes/api/mapper/PageMapper.php',
     77    'AppfulPlugin\\Api\\Mapper\\PointOfInterestMapper' => $baseDir . '/../includes/api/mapper/PointOfInterestMapper.php',
    7378    'AppfulPlugin\\Api\\Mapper\\PostContentMapper' => $baseDir . '/../includes/api/mapper/PostContentMapper.php',
    7479    'AppfulPlugin\\Api\\Mapper\\PostMapper' => $baseDir . '/../includes/api/mapper/PostMapper.php',
     
    98103    'AppfulPlugin\\Domain\\Page' => $baseDir . '/../includes/domain/Page.php',
    99104    'AppfulPlugin\\Domain\\PageContent' => $baseDir . '/../includes/domain/PageContent.php',
     105    'AppfulPlugin\\Domain\\PointOfInterest\\PointOfInterest' => $baseDir . '/../includes/domain/point_of_interest/PointOfInterest.php',
     106    'AppfulPlugin\\Domain\\PointOfInterest\\PostPointOfInterest' => $baseDir . '/../includes/domain/point_of_interest/PostPointOfInterest.php',
    100107    'AppfulPlugin\\Domain\\Post' => $baseDir . '/../includes/domain/Post.php',
    101108    'AppfulPlugin\\Domain\\PostContent' => $baseDir . '/../includes/domain/PostContent.php',
     
    127134    'AppfulPlugin\\Menu\\Menu' => $baseDir . '/../includes/menu/Menu.php',
    128135    'AppfulPlugin\\Notice\\Notice' => $baseDir . '/../includes/notice/Notice.php',
     136    'AppfulPlugin\\PostForm\\PostForm' => $baseDir . '/../includes/post_form/PostForm.php',
    129137    'AppfulPlugin\\TermForm\\TermForm' => $baseDir . '/../includes/term_form/TermForm.php',
    130138    'AppfulPlugin\\UseCases\\AppSettings\\AppSettingsUseCaseManager' => $baseDir . '/../includes/use_cases/app_settings/AppSettingsUseCaseManager.php',
     
    169177    'AppfulPlugin\\UseCases\\Page\\PageUseCaseManager' => $baseDir . '/../includes/use_cases/page/PageUseCaseManager.php',
    170178    'AppfulPlugin\\UseCases\\Page\\PullLocalPageContentUseCase' => $baseDir . '/../includes/use_cases/page/PullLocalPageContentUseCase.php',
     179    'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemUseCase.php',
     180    'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemsUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemsUseCase.php',
     181    'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointsOfInterestByIdUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/GetPointsOfInterestByIdUseCase.php',
     182    'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestDeleteUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/PointOfInterestDeleteUseCase.php',
     183    'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestUseCaseManager' => $baseDir . '/../includes/use_cases/point_of_interest/PointOfInterestUseCaseManager.php',
     184    'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestChunkSyncUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SendPointOfInterestChunkSyncUseCase.php',
     185    'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestSyncUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SendPointOfInterestSyncUseCase.php',
     186    'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointOfInterestUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SyncPointOfInterestUseCase.php',
     187    'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointsOfInterestUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SyncPointsOfInterestUseCase.php',
    171188    'AppfulPlugin\\UseCases\\PostDeleteUseCase' => $baseDir . '/../includes/use_cases/PostDeleteUseCase.php',
    172189    'AppfulPlugin\\UseCases\\Post\\GetPostSyncBatchSizeUseCase' => $baseDir . '/../includes/use_cases/post/GetPostSyncBatchSizeUseCase.php',
     
    203220    'AppfulPlugin\\UseCases\\UserDeleteUseCase' => $baseDir . '/../includes/use_cases/UserDeleteUseCase.php',
    204221    'AppfulPlugin\\UseCases\\UserSaveUseCase' => $baseDir . '/../includes/use_cases/UserSaveUseCase.php',
     222    'AppfulPlugin\\Wp\\Entities\\PostCoordinatesEntity' => $baseDir . '/../includes/wp/entities/PostCoordinatesEntity.php',
    205223    'AppfulPlugin\\Wp\\Mapper\\AttachmentMapper' => $baseDir . '/../includes/wp/mapper/AttachmentMapper.php',
    206224    'AppfulPlugin\\Wp\\Mapper\\CategoryMapper' => $baseDir . '/../includes/wp/mapper/CategoryMapper.php',
  • appful-app/tags/3.1.23/lib/vendor/composer/autoload_psr4.php

    r3027388 r3043568  
    1717    'AppfulPlugin\\Wp\\Plugins\\' => array($baseDir . '/../includes/wp/plugins'),
    1818    'AppfulPlugin\\Wp\\Mapper\\' => array($baseDir . '/../includes/wp/mapper'),
     19    'AppfulPlugin\\Wp\\Entities\\' => array($baseDir . '/../includes/wp/entities'),
    1920    'AppfulPlugin\\Wp\\' => array($baseDir . '/../includes/wp'),
    2021    'AppfulPlugin\\UseCases\\Post\\' => array($baseDir . '/../includes/use_cases/post'),
     22    'AppfulPlugin\\UseCases\\PointOfInterest\\' => array($baseDir . '/../includes/use_cases/point_of_interest'),
    2123    'AppfulPlugin\\UseCases\\Page\\' => array($baseDir . '/../includes/use_cases/page'),
    2224    'AppfulPlugin\\UseCases\\AppSettings\\' => array($baseDir . '/../includes/use_cases/app_settings'),
    2325    'AppfulPlugin\\UseCases\\' => array($baseDir . '/../includes/use_cases'),
    2426    'AppfulPlugin\\TermForm\\' => array($baseDir . '/../includes/term_form'),
     27    'AppfulPlugin\\PostForm\\' => array($baseDir . '/../includes/post_form'),
    2528    'AppfulPlugin\\Notice\\' => array($baseDir . '/../includes/notice'),
    2629    'AppfulPlugin\\Menu\\' => array($baseDir . '/../includes/menu'),
     
    2831    'AppfulPlugin\\Hooks\\' => array($baseDir . '/../includes/hooks'),
    2932    'AppfulPlugin\\Helper\\' => array($baseDir . '/../includes/helper'),
     33    'AppfulPlugin\\Domain\\PointOfInterest\\' => array($baseDir . '/../includes/domain/point_of_interest'),
    3034    'AppfulPlugin\\Domain\\App\\' => array($baseDir . '/../includes/domain/app'),
    3135    'AppfulPlugin\\Domain\\' => array($baseDir . '/../includes/domain'),
     
    3438    'AppfulPlugin\\Api\\Requests\\' => array($baseDir . '/../includes/api/requests'),
    3539    'AppfulPlugin\\Api\\Mapper\\' => array($baseDir . '/../includes/api/mapper'),
     40    'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\' => array($baseDir . '/../includes/api/handlers/point_of_interest'),
    3641    'AppfulPlugin\\Api\\Handlers\\Page\\' => array($baseDir . '/../includes/api/handlers/page'),
    3742    'AppfulPlugin\\Api\\Handlers\\' => array($baseDir . '/../includes/api/handlers'),
     43    'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\' => array($baseDir . '/../includes/api/dtos/point_of_interest'),
    3844    'AppfulPlugin\\Api\\Dtos\\App\\' => array($baseDir . '/../includes/api/dtos/app'),
    3945    'AppfulPlugin\\Api\\Dtos\\' => array($baseDir . '/../includes/api/dtos'),
  • appful-app/tags/3.1.23/lib/vendor/composer/autoload_static.php

    r3039311 r3043568  
    4141            'AppfulPlugin\\Wp\\Plugins\\' => 24,
    4242            'AppfulPlugin\\Wp\\Mapper\\' => 23,
     43            'AppfulPlugin\\Wp\\Entities\\' => 25,
    4344            'AppfulPlugin\\Wp\\' => 16,
    4445            'AppfulPlugin\\UseCases\\Post\\' => 27,
     46            'AppfulPlugin\\UseCases\\PointOfInterest\\' => 38,
    4547            'AppfulPlugin\\UseCases\\Page\\' => 27,
    4648            'AppfulPlugin\\UseCases\\AppSettings\\' => 34,
    4749            'AppfulPlugin\\UseCases\\' => 22,
    4850            'AppfulPlugin\\TermForm\\' => 22,
     51            'AppfulPlugin\\PostForm\\' => 22,
    4952            'AppfulPlugin\\Notice\\' => 20,
    5053            'AppfulPlugin\\Menu\\' => 18,
     
    5255            'AppfulPlugin\\Hooks\\' => 19,
    5356            'AppfulPlugin\\Helper\\' => 20,
     57            'AppfulPlugin\\Domain\\PointOfInterest\\' => 36,
    5458            'AppfulPlugin\\Domain\\App\\' => 24,
    5559            'AppfulPlugin\\Domain\\' => 20,
     
    5862            'AppfulPlugin\\Api\\Requests\\' => 26,
    5963            'AppfulPlugin\\Api\\Mapper\\' => 24,
     64            'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\' => 42,
    6065            'AppfulPlugin\\Api\\Handlers\\Page\\' => 31,
    6166            'AppfulPlugin\\Api\\Handlers\\' => 26,
     67            'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\' => 38,
    6268            'AppfulPlugin\\Api\\Dtos\\App\\' => 26,
    6369            'AppfulPlugin\\Api\\Dtos\\' => 22,
     
    109115            0 => __DIR__ . '/../..' . '/../includes/wp/mapper',
    110116        ),
     117        'AppfulPlugin\\Wp\\Entities\\' =>
     118        array (
     119            0 => __DIR__ . '/../..' . '/../includes/wp/entities',
     120        ),
    111121        'AppfulPlugin\\Wp\\' =>
    112122        array (
     
    117127            0 => __DIR__ . '/../..' . '/../includes/use_cases/post',
    118128        ),
     129        'AppfulPlugin\\UseCases\\PointOfInterest\\' =>
     130        array (
     131            0 => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest',
     132        ),
    119133        'AppfulPlugin\\UseCases\\Page\\' =>
    120134        array (
     
    133147            0 => __DIR__ . '/../..' . '/../includes/term_form',
    134148        ),
     149        'AppfulPlugin\\PostForm\\' =>
     150        array (
     151            0 => __DIR__ . '/../..' . '/../includes/post_form',
     152        ),
    135153        'AppfulPlugin\\Notice\\' =>
    136154        array (
     
    153171            0 => __DIR__ . '/../..' . '/../includes/helper',
    154172        ),
     173        'AppfulPlugin\\Domain\\PointOfInterest\\' =>
     174        array (
     175            0 => __DIR__ . '/../..' . '/../includes/domain/point_of_interest',
     176        ),
    155177        'AppfulPlugin\\Domain\\App\\' =>
    156178        array (
     
    177199            0 => __DIR__ . '/../..' . '/../includes/api/mapper',
    178200        ),
     201        'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\' =>
     202        array (
     203            0 => __DIR__ . '/../..' . '/../includes/api/handlers/point_of_interest',
     204        ),
    179205        'AppfulPlugin\\Api\\Handlers\\Page\\' =>
    180206        array (
     
    184210        array (
    185211            0 => __DIR__ . '/../..' . '/../includes/api/handlers',
     212        ),
     213        'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\' =>
     214        array (
     215            0 => __DIR__ . '/../..' . '/../includes/api/dtos/point_of_interest',
    186216        ),
    187217        'AppfulPlugin\\Api\\Dtos\\App\\' =>
     
    218248        'AppfulPlugin\\Api\\Dtos\\PageContentDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PageContentDto.php',
    219249        'AppfulPlugin\\Api\\Dtos\\PageDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PageDto.php',
     250        'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PointOfInterestDto' => __DIR__ . '/../..' . '/../includes/api/dtos/point_of_interest/PointOfInterestDto.php',
     251        'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PostPointOfInterestDto' => __DIR__ . '/../..' . '/../includes/api/dtos/point_of_interest/PostPointOfInterestDto.php',
    220252        'AppfulPlugin\\Api\\Dtos\\PostContentDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PostContentDto.php',
    221253        'AppfulPlugin\\Api\\Dtos\\PostDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PostDto.php',
     
    249281        'AppfulPlugin\\Api\\Handlers\\PageSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PageSyncRequestHandler.php',
    250282        'AppfulPlugin\\Api\\Handlers\\Page\\GetPageContentRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/page/GetPageContentRequestHandler.php',
     283        'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\GetPointsOfInterestRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/point_of_interest/GetPointsOfInterestRequestHandler.php',
     284        'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\PointOfInterestSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/point_of_interest/PointOfInterestSyncRequestHandler.php',
    251285        'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PostSyncRequestHandler.php',
    252286        'AppfulPlugin\\Api\\Handlers\\PullLocalPageContentRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PullLocalPageContentRequestHandler.php',
     
    268302        'AppfulPlugin\\Api\\Mapper\\PageContentMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PageContentMapper.php',
    269303        'AppfulPlugin\\Api\\Mapper\\PageMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PageMapper.php',
     304        'AppfulPlugin\\Api\\Mapper\\PointOfInterestMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PointOfInterestMapper.php',
    270305        'AppfulPlugin\\Api\\Mapper\\PostContentMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PostContentMapper.php',
    271306        'AppfulPlugin\\Api\\Mapper\\PostMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PostMapper.php',
     
    295330        'AppfulPlugin\\Domain\\Page' => __DIR__ . '/../..' . '/../includes/domain/Page.php',
    296331        'AppfulPlugin\\Domain\\PageContent' => __DIR__ . '/../..' . '/../includes/domain/PageContent.php',
     332        'AppfulPlugin\\Domain\\PointOfInterest\\PointOfInterest' => __DIR__ . '/../..' . '/../includes/domain/point_of_interest/PointOfInterest.php',
     333        'AppfulPlugin\\Domain\\PointOfInterest\\PostPointOfInterest' => __DIR__ . '/../..' . '/../includes/domain/point_of_interest/PostPointOfInterest.php',
    297334        'AppfulPlugin\\Domain\\Post' => __DIR__ . '/../..' . '/../includes/domain/Post.php',
    298335        'AppfulPlugin\\Domain\\PostContent' => __DIR__ . '/../..' . '/../includes/domain/PostContent.php',
     
    324361        'AppfulPlugin\\Menu\\Menu' => __DIR__ . '/../..' . '/../includes/menu/Menu.php',
    325362        'AppfulPlugin\\Notice\\Notice' => __DIR__ . '/../..' . '/../includes/notice/Notice.php',
     363        'AppfulPlugin\\PostForm\\PostForm' => __DIR__ . '/../..' . '/../includes/post_form/PostForm.php',
    326364        'AppfulPlugin\\TermForm\\TermForm' => __DIR__ . '/../..' . '/../includes/term_form/TermForm.php',
    327365        'AppfulPlugin\\UseCases\\AppSettings\\AppSettingsUseCaseManager' => __DIR__ . '/../..' . '/../includes/use_cases/app_settings/AppSettingsUseCaseManager.php',
     
    366404        'AppfulPlugin\\UseCases\\Page\\PageUseCaseManager' => __DIR__ . '/../..' . '/../includes/use_cases/page/PageUseCaseManager.php',
    367405        'AppfulPlugin\\UseCases\\Page\\PullLocalPageContentUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/page/PullLocalPageContentUseCase.php',
     406        'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemUseCase.php',
     407        'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemsUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemsUseCase.php',
     408        'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointsOfInterestByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/GetPointsOfInterestByIdUseCase.php',
     409        'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/PointOfInterestDeleteUseCase.php',
     410        'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestUseCaseManager' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/PointOfInterestUseCaseManager.php',
     411        'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestChunkSyncUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SendPointOfInterestChunkSyncUseCase.php',
     412        'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestSyncUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SendPointOfInterestSyncUseCase.php',
     413        'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointOfInterestUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SyncPointOfInterestUseCase.php',
     414        'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointsOfInterestUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SyncPointsOfInterestUseCase.php',
    368415        'AppfulPlugin\\UseCases\\PostDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PostDeleteUseCase.php',
    369416        'AppfulPlugin\\UseCases\\Post\\GetPostSyncBatchSizeUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/post/GetPostSyncBatchSizeUseCase.php',
     
    400447        'AppfulPlugin\\UseCases\\UserDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/UserDeleteUseCase.php',
    401448        'AppfulPlugin\\UseCases\\UserSaveUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/UserSaveUseCase.php',
     449        'AppfulPlugin\\Wp\\Entities\\PostCoordinatesEntity' => __DIR__ . '/../..' . '/../includes/wp/entities/PostCoordinatesEntity.php',
    402450        'AppfulPlugin\\Wp\\Mapper\\AttachmentMapper' => __DIR__ . '/../..' . '/../includes/wp/mapper/AttachmentMapper.php',
    403451        'AppfulPlugin\\Wp\\Mapper\\CategoryMapper' => __DIR__ . '/../..' . '/../includes/wp/mapper/CategoryMapper.php',
  • appful-app/tags/3.1.23/lib/vendor/composer/installed.php

    r3028218 r3043568  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '8a33ea6e2270e3e3016ee76d676b39b857c3c1f9',
     6        'reference' => '6f0d2c0f0f21f2ca2550d7a07d32827d416dc20c',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '8a33ea6e2270e3e3016ee76d676b39b857c3c1f9',
     16            'reference' => '6f0d2c0f0f21f2ca2550d7a07d32827d416dc20c',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • appful-app/tags/3.1.23/readme.txt

    r3039311 r3043568  
    66Tested up to: 6.4
    77Requires PHP: 7.4
    8 Stable tag: 3.1.22
     8Stable tag: 3.1.23
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • appful-app/trunk/appful-app.php

    r3039311 r3043568  
    1212 * Plugin URI:        https://appful.io
    1313 * 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.1.22
     14 * Version:           3.1.23
    1515 * Requires at least: 5.8
    1616 * Requires PHP:      7.4
  • appful-app/trunk/includes/api/Endpoints.php

    r3039311 r3043568  
    1313    public static string $SYNC = "sync";
    1414    public static string $SYNC_POSTS = "sync-post";
    15 
     15    public static string $SYNC_POINTS_OF_INTEREST = "sync-points-of-interest";
    1616    public static string $SYNC_PAGES = "sync-page";
    1717    public static string $SYNC_COMMENTS = "sync-comment";
     
    2626    public static string $GET_CATEGORIES = "get-category";
    2727    public static string $GET_POSTS = "get-post";
     28    public static string $GET_POINTS_OF_INTEREST = "get-point-of-interest";
    2829    public static string $GET_PAGES = "get-page";
    2930    public static string $GET_POST_CONTENTS = "get-post-content";
  • appful-app/trunk/includes/api/ReqHandler.php

    r3039311 r3043568  
    2525use AppfulPlugin\Api\Handlers\Page\GetPageContentRequestHandler;
    2626use AppfulPlugin\Api\Handlers\PageSyncRequestHandler;
     27use AppfulPlugin\Api\Handlers\PointOfInterest\GetPointsOfInterestRequestHandler;
     28use AppfulPlugin\Api\Handlers\PointOfInterest\PointOfInterestSyncRequestHandler;
    2729use AppfulPlugin\Api\Handlers\PostSyncRequestHandler;
    2830use AppfulPlugin\Api\Handlers\PullLocalPageContentRequestHandler;
     
    7375            new PullLocalPageContentRequestHandler( $use_case_manager->pages()->get_local_page_content_by_id_use_case() ),
    7476            new GetPageContentRequestHandler( $use_case_manager->pages()->get_page_contents_by_id_use_case() ),
     77            new PointOfInterestSyncRequestHandler( $use_case_manager->points_of_interest()->get_sync_points_of_interest_use_case() ),
     78            new GetPointsOfInterestRequestHandler( $use_case_manager->points_of_interest()->get_get_points_of_interest_by_id_use_case() ),
    7579            new SavePostSyncBatchSizeHandler( $use_case_manager->posts()->get_save_post_sync_batch_size_use_case() )
    7680        ];
  • appful-app/trunk/includes/api/dtos/CommentDto.php

    r2907312 r3043568  
    2323        $this->parent      = $parent;
    2424    }
    25 
    26 
    2725}
  • appful-app/trunk/includes/api/mapper/BlogInfoMapper.php

    r3039311 r3043568  
    3232            $blog_info->get_token(),
    3333            $hooks,
    34             "3.1.22",
     34            "3.1.23",
    3535            $stats,
    3636            $settings
  • appful-app/trunk/includes/domain/BlogHooks.php

    r2978062 r3043568  
    44
    55class BlogHooks {
    6     private ?string $create_comment = null;
    7     private ?string $authenticate_user = null;
    8     private ?string $get_page_content = null;
     6    private ?string $create_comment = null;
     7    private ?string $authenticate_user = null;
     8    private ?string $get_page_content = null;
    99
    10     private function __construct() {
    11     }
     10    private function __construct() {
     11    }
    1212
    13     public static function init(): BlogHooks {
    14         return new BlogHooks();
    15     }
     13    public static function init(): BlogHooks {
     14        return new BlogHooks();
     15    }
    1616
    17     public function create_comment( ?string $create_comment ): BlogHooks {
    18         $this->create_comment = $create_comment;
     17    public function create_comment( ?string $create_comment ): BlogHooks {
     18        $this->create_comment = $create_comment;
    1919
    20         return $this;
    21     }
     20        return $this;
     21    }
    2222
    23     public function authenticate_user( ?string $authenticate_user ): BlogHooks {
    24         $this->authenticate_user = $authenticate_user;
     23    public function authenticate_user( ?string $authenticate_user ): BlogHooks {
     24        $this->authenticate_user = $authenticate_user;
    2525
    26         return $this;
    27     }
     26        return $this;
     27    }
    2828
    29     public function get_page_content( ?string $get_page_content ): BlogHooks {
    30         $this->get_page_content = $get_page_content;
     29    public function get_page_content( ?string $get_page_content ): BlogHooks {
     30        $this->get_page_content = $get_page_content;
    3131
    32         return $this;
    33     }
     32        return $this;
     33    }
    3434
    35     public function get_create_comment(): ?string {
    36         return $this->create_comment;
    37     }
     35    public function get_create_comment(): ?string {
     36        return $this->create_comment;
     37    }
    3838
    39     public function get_authenticate_user(): ?string {
    40         return $this->authenticate_user;
    41     }
     39    public function get_authenticate_user(): ?string {
     40        return $this->authenticate_user;
     41    }
    4242
    43     public function get_get_page_content(): ?string {
    44         return $this->get_page_content;
    45     }
     43    public function get_get_page_content(): ?string {
     44        return $this->get_page_content;
     45    }
    4646}
  • appful-app/trunk/includes/domain/PostContent.php

    r3027388 r3043568  
    44
    55class PostContent {
    6     private int $id = - 1;
    7     private string $head = "";
    8     private string $footer = "";
    9     private string $body_class = "";
    10     private string $content = "";
     6    private int $id = - 1;
     7    private string $head = "";
     8    private string $footer = "";
     9    private string $body_class = "";
     10    private string $content = "";
    1111
    12     public static function postContent(
    13         int $id = - 1,
    14         string $head = "",
    15         string $footer = "",
    16         string $content = "",
    17         string $body_class = ""
    18     ): PostContent {
    19         return ( new PostContent() )
    20             ->id( $id )
    21             ->head( $head )
    22             ->footer( $footer )
    23             ->content( $content )
    24             ->body_class( $body_class );
    25     }
     12    private function __construct() {
     13    }
    2614
    27     public function id( int $id ): PostContent {
    28         $this->id = $id;
     15    public static function postContent(): PostContent {
     16        return new PostContent();
     17    }
    2918
    30         return $this;
    31     }
     19    public function id( int $id ): PostContent {
     20        $this->id = $id;
    3221
    33     public function head( string $head ): PostContent {
    34         $this->head = $head;
     22        return $this;
     23    }
    3524
    36         return $this;
    37     }
     25    public function head( string $head ): PostContent {
     26        $this->head = $head;
    3827
    39     public function footer( string $footer ): PostContent {
    40         $this->footer = $footer;
     28        return $this;
     29    }
    4130
    42         return $this;
    43     }
     31    public function footer( string $footer ): PostContent {
     32        $this->footer = $footer;
    4433
    45     public function content( string $content ): PostContent {
    46         $this->content = $content;
     34        return $this;
     35    }
    4736
    48         return $this;
    49     }
     37    public function content( string $content ): PostContent {
     38        $this->content = $content;
    5039
    51     public function body_class( string $body_class ): PostContent {
    52         $this->body_class = $body_class;
     40        return $this;
     41    }
    5342
    54         return $this;
    55     }
     43    public function body_class( string $body_class ): PostContent {
     44        $this->body_class = $body_class;
    5645
    57     public function get_id(): int {
    58         return $this->id;
    59     }
     46        return $this;
     47    }
    6048
    61     public function get_head(): string {
    62         return $this->head;
    63     }
     49    public function get_id(): int {
     50        return $this->id;
     51    }
    6452
    65     public function get_footer(): string {
    66         return $this->footer;
    67     }
     53    public function get_head(): string {
     54        return $this->head;
     55    }
    6856
    69     public function get_content(): string {
    70         return $this->content;
    71     }
     57    public function get_footer(): string {
     58        return $this->footer;
     59    }
    7260
    73     public function get_body_class(): string {
    74         return $this->body_class;
    75     }
     61    public function get_content(): string {
     62        return $this->content;
     63    }
     64
     65    public function get_body_class(): string {
     66        return $this->body_class;
     67    }
    7668}
  • appful-app/trunk/includes/helper/Constants.php

    r3039311 r3043568  
    2525    public static string $APPFUL_TAXONOMY_PUSH_TERM_SLUG = "push";
    2626
    27     public static string $APPFUL_API_URL = "https://api.wordpress.appful.io";
     27    public static string $APPFUL_POST_META_COORDINATES_KEY = "_appful_post_meta_coordinates";
     28
     29    public static string $APPFUL_API_URL = "https://api.wordpress.appful.io";
    2830
    2931    public static string $BLOG_PATH = "/blogs";
     
    3739    public static string $TAXONOMY_PATH = "/taxonomies";
    3840    public static string $ROLE_PATH = "/roles";
     41    public static string $POINT_OF_INTEREST_PATH = "/points-of-interest";
    3942
    4043    public static string $API_VERSION_1 = "/v1";
  • appful-app/trunk/includes/hooks/PostHook.php

    r3027388 r3043568  
    33namespace AppfulPlugin\Hooks;
    44
     5use AppfulPlugin\Helper\Constants;
    56use AppfulPlugin\Helper\Logger;
    67use AppfulPlugin\UseCases\UseCaseManager;
     
    89
    910class PostHook {
    10     private UseCaseManager $use_case_manager;
     11    private UseCaseManager $use_case_manager;
    1112
    12     public function __construct( UseCaseManager $use_case_manager ) {
    13         $this->use_case_manager = $use_case_manager;
    14     }
     13    public function __construct( UseCaseManager $use_case_manager ) {
     14        $this->use_case_manager = $use_case_manager;
     15    }
    1516
    16     public function init() {
    17         add_action(
    18             "wp_after_insert_post",
    19             function ( int $post_id, WP_Post $post, bool $update, ?WP_Post $post_before ) {
    20                 $this->after_save_post( $post, $post_before );
    21             },
    22             99,
    23             4,
    24         );
     17    public function init() {
     18        add_action(
     19            "wp_after_insert_post",
     20            function ( int $post_id, WP_Post $post, bool $update, ?WP_Post $post_before ) {
     21                $this->after_save_post( $post, $post_before );
     22            },
     23            99,
     24            4
     25        );
    2526
    26         add_action(
    27             "delete_post",
    28             function ( int $post_id, WP_Post $post ) {
    29                 $this->on_delete_post( $post_id, $post );
    30             },
    31             10,
    32             2
    33         );
     27//        add_action(
     28//            "updated_post_meta",
     29//            function ( int $meta_id, int $object_id, string $meta_key ) {
     30//                if ( $meta_key == Constants::$APPFUL_POST_META_COORDINATES_KEY ) {
     31//                    $this->after_save_post_meta( $object_id );
     32//                }
     33//            },
     34//            10,
     35//            3
     36//        );
    3437
    35         add_action(
    36             "appful_app_update_post",
    37             function ( int $post_id ) {
    38                 $this->on_appful_post_update( $post_id );
    39             },
    40             10,
    41             1
    42         );
     38        add_action(
     39            "delete_post",
     40            function ( int $post_id, WP_Post $post ) {
     41                $this->on_delete_post( $post_id, $post );
     42            },
     43            10,
     44            2
     45        );
    4346
    44         add_action(
    45             "appful_app_update_taxonomy_posts",
    46             function ( string $taxonomy, string $term_slug ) {
    47                 $this->on_appful_taxonomy_posts_update( $taxonomy, $term_slug );
    48             },
    49             10,
    50             2
    51         );
    52     }
     47        add_action(
     48            "delete_post_meta",
     49            function ( array $meta_ids, int $object_id, string $meta_key ) {
     50                if ( $meta_key == Constants::$APPFUL_POST_META_COORDINATES_KEY ) {
     51                    $this->on_delete_post_meta( $object_id );
     52                }
     53            },
     54            10,
     55            3
     56        );
    5357
    54     private function on_delete_post( int $post_id, WP_Post $post ) {
    55         if ( $post->post_type != "post" ) {
    56             return;
    57         }
     58        add_action(
     59            "appful_app_update_post",
     60            function ( int $post_id ) {
     61                $this->on_appful_post_update( $post_id );
     62            },
     63            10,
     64            1
     65        );
    5866
    59         Logger::debug( "Post with id " . $post->ID . " deleted!" );
     67        add_action(
     68            "appful_app_update_taxonomy_posts",
     69            function ( string $taxonomy, string $term_slug ) {
     70                $this->on_appful_taxonomy_posts_update( $taxonomy, $term_slug );
     71            },
     72            10,
     73            2
     74        );
     75    }
    6076
    61         $this->use_case_manager->post_delete_use_case()->invoke( $post_id );
    62     }
     77    private function on_delete_post( int $post_id, WP_Post $post ) {
     78        if ( $post->post_type != "post" ) {
     79            return;
     80        }
    6381
    64     private function after_save_post( WP_Post $post, ?WP_Post $post_before ) {
    65         if ( defined( "DOING_AUTOSAVE" ) && DOING_AUTOSAVE ) {
    66             return;
    67         }
     82        Logger::debug( "Post with id " . $post->ID . " deleted!" );
    6883
    69         if ( $post->post_type != "post" ) {
    70             return;
    71         }
     84        $this->use_case_manager->post_delete_use_case()->invoke( $post_id );
     85        $this->use_case_manager->points_of_interest()->get_point_of_interest_delete_use_case()->invoke( $post_id );
     86    }
    7287
    73         if ( $post->post_status == "auto-draft" || $post->post_status == "inherit" ) {
    74             return;
    75         }
     88    private function on_delete_post_meta( int $post_id ) {
     89        Logger::debug( "Post-coordinates-meta with id " . $post_id . " deleted!" );
    7690
    77         Logger::debug( "Post with id " . $post->ID . " inserted with status " . $post->post_status . "!" );
     91        $this->use_case_manager->points_of_interest()->get_point_of_interest_delete_use_case()->invoke( $post_id );
     92    }
    7893
    79         $old_post_status = "";
    80         if ( $post_before ) {
    81             $old_post_status = $post_before->post_status;
    82         }
     94    private function after_save_post_meta( int $post_id ) {
     95        Logger::debug( "Post-coordinate-meta with id " . $post_id . " updated!" );
    8396
    84         $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post->ID, $post->post_status != $old_post_status );
    85     }
     97        $this->use_case_manager->points_of_interest()->get_sync_point_of_interest_use_case()->invoke( $post_id );
     98    }
    8699
    87     private function on_appful_post_update( int $post_id ) {
    88         Logger::debug( "Manual appful post update for id " . $post_id );
     100    private function after_save_post( WP_Post $post, ?WP_Post $post_before ) {
     101        if ( (defined( "DOING_AUTOSAVE" ) && DOING_AUTOSAVE) || (defined( 'REST_REQUEST' ) && REST_REQUEST) ) {
     102            return;
     103        }
    89104
    90         $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post_id, true );
    91     }
     105        if ( wp_is_post_revision( $post->ID ) || wp_is_post_autosave( $post->ID ) ) {
     106            return;
     107        }
    92108
    93     private function on_appful_taxonomy_posts_update( string $taxonomy, string $term_slug ) {
    94         Logger::debug( "Manual appful taxonomy posts update for taxonomy " . $taxonomy . " and term " . $term_slug );
     109        if ( $post->post_type != "post" ) {
     110            return;
     111        }
    95112
    96         $this->use_case_manager->posts()->get_sync_taxonomy_posts_use_case()->invoke( $taxonomy, $term_slug );
    97     }
     113        if ( $post->post_status == "auto-draft" || $post->post_status == "inherit" ) {
     114            return;
     115        }
     116
     117        Logger::debug( "Post with id " . $post->ID . " inserted with status " . $post->post_status . "!" );
     118
     119        $old_post_status = "";
     120        if ( $post_before ) {
     121            $old_post_status = $post_before->post_status;
     122        }
     123
     124        $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post->ID, $post->post_status != $old_post_status );
     125        $this->after_save_post_meta( $post->ID );
     126    }
     127
     128    private function on_appful_post_update( int $post_id ) {
     129        Logger::debug( "Manual appful post update for id " . $post_id );
     130
     131        $this->use_case_manager->posts()->get_sync_post_use_case()->invoke( $post_id, true );
     132        $this->use_case_manager->points_of_interest()->get_sync_point_of_interest_use_case()->invoke( $post_id, true );
     133    }
     134
     135    private function on_appful_taxonomy_posts_update( string $taxonomy, string $term_slug ) {
     136        Logger::debug( "Manual appful taxonomy posts update for taxonomy " . $taxonomy . " and term " . $term_slug );
     137
     138        $this->use_case_manager->posts()->get_sync_taxonomy_posts_use_case()->invoke( $taxonomy, $term_slug );
     139    }
    98140}
  • appful-app/trunk/includes/main/AppfulPlugin.php

    r2920184 r3043568  
    1212use AppfulPlugin\Menu\Menu;
    1313use AppfulPlugin\Notice\Notice;
     14use AppfulPlugin\PostForm\PostForm;
    1415use AppfulPlugin\TermForm\TermForm;
    1516use AppfulPlugin\UseCases\UseCaseManager;
     
    1920    private Menu $menu;
    2021    private TermForm $term_form;
     22    private PostForm $post_form;
    2123    private Notice $notice;
    2224    private Hooks $hooks;
     
    3638        $this->menu      = new Menu( $this->use_case_manager->is_logged_in_use_case() );
    3739        $this->term_form = new TermForm();
     40        $this->post_form = new PostForm();
    3841        $this->notice    = new Notice( $this->use_case_manager->is_logged_in_use_case() );
    3942        $this->hooks     = new Hooks( $rewrites, $this->use_case_manager, $this->taxonomy_manager );
     
    5255        if ( $this->use_case_manager->is_logged_in_use_case()->invoke() ) {
    5356            $this->term_form->load();
     57            $this->post_form->load();
    5458            $this->taxonomy_manager->load();
    5559        }
  • appful-app/trunk/includes/term_form/TermForm.php

    r2907312 r3043568  
    99
    1010class TermForm {
    11     public function __construct() {
    12     }
    13 
    1411    public function load(): void {
    1512        $this->setup_ui();
  • appful-app/trunk/includes/use_cases/GetLocalPostContentByIdUseCase.php

    r3027388 r3043568  
    77
    88class GetLocalPostContentByIdUseCase {
    9     public function invoke( int $id ): ?PostContent {
    10         $this->configure_active_filter( true );
    11         $post_content = WPPostManager::get_post_content_by_id( $id );
    12         $this->configure_active_filter( false );
     9    public function invoke( int $id ): ?PostContent {
     10        $this->configure_active_filter( true );
     11        $post_content = WPPostManager::get_post_content_by_id( $id );
     12        $this->configure_active_filter( false );
    1313
    14         return $post_content;
    15     }
     14        return $post_content;
     15    }
    1616
    17     private function configure_active_filter( bool $on ) {
    18         add_filter(
    19             "appful_app_is_post_content_call",
    20             function ( bool $is_active ) use ( $on ) {
    21                 return $on;
    22             },
    23             10,
    24             1
    25         );
    26     }
     17    private function configure_active_filter( bool $on ): void {
     18        add_filter(
     19            "appful_app_is_post_content_call",
     20            function ( bool $is_active ) use ( $on ) {
     21                return $on;
     22            },
     23            10,
     24            1
     25        );
     26    }
    2727}
  • appful-app/trunk/includes/use_cases/RegisterBlogUseCase.php

    r3018629 r3043568  
    1212
    1313class RegisterBlogUseCase {
    14     private BackendClient $backend_client;
     14    private BackendClient $backend_client;
    1515
    16     public function __construct( BackendClient $backend_client ) {
    17         $this->backend_client = $backend_client;
    18     }
     16    public function __construct( BackendClient $backend_client ) {
     17        $this->backend_client = $backend_client;
     18    }
    1919
    20     public function invoke(): bool {
    21         $blog_info     = WPBlogManager::get_blog_info();
    22         $blog_info_dto = BlogInfoMapper::to_dto( $blog_info );
     20    public function invoke(): bool {
     21        $blog_info     = WPBlogManager::get_blog_info();
     22        $blog_info_dto = BlogInfoMapper::to_dto( $blog_info );
    2323
    24         Logger::info( "Registering blog with data: " . json_encode( $blog_info_dto ) );
     24        Logger::info( "Registering blog with data: " . json_encode( $blog_info_dto ) );
    2525
    26         $request  = HttpRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH );
    27         $response = $this->backend_client->send_request( $request );
    28         $body     = $response->get_body();
     26        $request  = HttpRequest::backend_request()->method( "POST" )->body( $blog_info_dto )->path( Constants::$BLOG_PATH );
     27        $response = $this->backend_client->send_request( $request );
     28        $body     = $response->get_body();
    2929
    30         if ( $response->get_status() != 200 ) {
    31             if ( $body != null && isset( $body['error'] ) ) {
    32                 WPOptionsManager::save_last_sync_error( $body['error'] );
    33             }
     30        if ( $response->get_status() != 200 ) {
     31            if ( $body != null && isset( $body['error'] ) ) {
     32                WPOptionsManager::save_last_sync_error( $body['error'] );
     33            }
    3434
    35             return false;
    36         }
     35            return false;
     36        }
    3737
    38         if ( $body != null && isset( $body['blog_id'] ) ) {
    39             WPOptionsManager::save_blog_id( $body['blog_id'] );
    40         }
     38        if ( $body != null && isset( $body['blog_id'] ) ) {
     39            WPOptionsManager::save_blog_id( $body['blog_id'] );
     40        }
    4141
    42         return true;
    43     }
     42        return true;
     43    }
    4444}
  • appful-app/trunk/includes/use_cases/SyncAllUseCase.php

    r3027388 r3043568  
    33namespace AppfulPlugin\UseCases;
    44
     5use AppfulPlugin\UseCases\PointOfInterest\SyncPointsOfInterestUseCase;
    56use AppfulPlugin\UseCases\Post\SyncPostsUseCase;
    67
    78class SyncAllUseCase {
    8     private SyncPostsUseCase $sync_posts_use_case;
    9     private SyncTagsUseCase $sync_tags_use_case;
    10     private SyncCategoriesUseCase $sync_categories_use_case;
    11     private SyncAttachmentsUseCase $sync_attachments_use_case;
    12     private SyncCommentsUseCase $sync_comments_use_case;
    13     private SyncUsersUseCase $sync_users_use_case;
    14     private SyncRolesUseCase $sync_roles_use_case;
    15     private SyncPagesUseCase $sync_pages_use_case;
     9    private SyncPostsUseCase $sync_posts_use_case;
     10    private SyncTagsUseCase $sync_tags_use_case;
     11    private SyncCategoriesUseCase $sync_categories_use_case;
     12    private SyncAttachmentsUseCase $sync_attachments_use_case;
     13    private SyncCommentsUseCase $sync_comments_use_case;
     14    private SyncUsersUseCase $sync_users_use_case;
     15    private SyncRolesUseCase $sync_roles_use_case;
     16    private SyncPagesUseCase $sync_pages_use_case;
     17    private SyncPointsOfInterestUseCase $sync_points_of_interest_use_case;
    1618
    17     public function __construct(
    18         SyncPostsUseCase $sync_posts_use_case,
    19         SyncTagsUseCase $sync_tags_use_case,
    20         SyncCategoriesUseCase $sync_categories_use_case,
    21         SyncAttachmentsUseCase $sync_attachments_use_case,
    22         SyncCommentsUseCase $sync_comments_use_case,
    23         SyncUsersUseCase $sync_users_use_case,
    24         SyncRolesUseCase $sync_roles_use_case,
    25         SyncPagesUseCase $sync_pages_use_case
    26     ) {
    27         $this->sync_posts_use_case       = $sync_posts_use_case;
    28         $this->sync_tags_use_case        = $sync_tags_use_case;
    29         $this->sync_categories_use_case  = $sync_categories_use_case;
    30         $this->sync_attachments_use_case = $sync_attachments_use_case;
    31         $this->sync_comments_use_case    = $sync_comments_use_case;
    32         $this->sync_users_use_case       = $sync_users_use_case;
    33         $this->sync_roles_use_case       = $sync_roles_use_case;
    34         $this->sync_pages_use_case       = $sync_pages_use_case;
    35     }
     19    public function __construct(
     20        SyncPostsUseCase $sync_posts_use_case,
     21        SyncTagsUseCase $sync_tags_use_case,
     22        SyncCategoriesUseCase $sync_categories_use_case,
     23        SyncAttachmentsUseCase $sync_attachments_use_case,
     24        SyncCommentsUseCase $sync_comments_use_case,
     25        SyncUsersUseCase $sync_users_use_case,
     26        SyncRolesUseCase $sync_roles_use_case,
     27        SyncPagesUseCase $sync_pages_use_case,
     28        SyncPointsOfInterestUseCase $sync_points_of_interest_use_case
     29    ) {
     30        $this->sync_posts_use_case              = $sync_posts_use_case;
     31        $this->sync_tags_use_case               = $sync_tags_use_case;
     32        $this->sync_categories_use_case         = $sync_categories_use_case;
     33        $this->sync_attachments_use_case        = $sync_attachments_use_case;
     34        $this->sync_comments_use_case           = $sync_comments_use_case;
     35        $this->sync_users_use_case              = $sync_users_use_case;
     36        $this->sync_roles_use_case              = $sync_roles_use_case;
     37        $this->sync_pages_use_case              = $sync_pages_use_case;
     38        $this->sync_points_of_interest_use_case = $sync_points_of_interest_use_case;
     39    }
    3640
    37     public function invoke() {
    38         $this->sync_users_use_case->invoke();
    39         $this->sync_roles_use_case->invoke();
    40         $this->sync_pages_use_case->invoke();
    41         $this->sync_categories_use_case->invoke();
    42         $this->sync_tags_use_case->invoke();
    43         $this->sync_attachments_use_case->invoke();
    44         $this->sync_posts_use_case->invoke();
    45         $this->sync_comments_use_case->invoke();
    46     }
     41    public function invoke() {
     42        $this->sync_users_use_case->invoke();
     43        $this->sync_roles_use_case->invoke();
     44        $this->sync_pages_use_case->invoke();
     45        $this->sync_categories_use_case->invoke();
     46        $this->sync_tags_use_case->invoke();
     47        $this->sync_attachments_use_case->invoke();
     48        $this->sync_posts_use_case->invoke();
     49        $this->sync_points_of_interest_use_case->invoke();
     50        $this->sync_comments_use_case->invoke();
     51    }
    4752}
  • appful-app/trunk/includes/use_cases/UseCaseManager.php

    r3027388 r3043568  
    77use AppfulPlugin\UseCases\AppSettings\AppSettingsUseCaseManager;
    88use AppfulPlugin\UseCases\Page\PageUseCaseManager;
     9use AppfulPlugin\UseCases\PointOfInterest\PointOfInterestUseCaseManager;
    910use AppfulPlugin\UseCases\Post\PostUseCaseManager;
    1011
    1112class UseCaseManager {
    12     private GetAndroidAssetLinkUseCase $get_android_asset_link_use_case;
    13     private GetAppleAppSiteAssociationUseCase $get_apple_app_site_association_use_case;
    14     private GetLogsUseCase $get_logs_use_case;
    15     private GetBlogInfoUseCase $get_blog_info_use_case;
    16     private IsLoggedInUseCase $is_logged_in_use_case;
    17     private DeleteSessionUseCase $delete_session_use_case;
    18     private RegisterBlogUseCase $register_blog_use_case;
    19     private CategorySaveUseCase $category_save_use_case;
    20     private CategoryDeleteUseCase $category_delete_use_case;
    21     private TagDeleteUseCase $tag_delete_use_case;
    22     private TagSaveUseCase $tag_save_use_case;
    23     private GetPostsByIdUseCase $get_posts_by_id_use_case;
    24     private GetTagSyncDataUseCase $get_tag_sync_data_use_case;
    25     private SendTagChunkSyncUseCase $send_tag_chunk_sync_use_case;
    26     private GetTagsByIdUseCase $get_tags_by_id_use_case;
    27     private SendCategoryChunkSyncUseCase $send_category_chunk_sync_use_case;
    28     private GetCategorySyncDataUseCase $get_category_sync_data_use_case;
    29     private GetCategoriesByIdUseCase $get_categories_by_id_use_case;
    30     private SendAttachmentChunkSyncUseCase $send_attachment_chunk_sync_use_case;
    31     private GetAttachmentsByIdUseCase $get_attachments_by_id_use_case;
    32     private GetAttachmentSyncDataUseCase $get_attachment_sync_data_use_case;
    33     private GetCommentsByIdUseCase $get_comments_by_id_use_case;
    34     private SendCommentChunkSyncUseCase $send_comment_chunk_sync_use_case;
    35     private SyncCommentsUseCase $sync_comments_use_case;
    36     private CommentSaveUseCase $comment_save_use_case;
    37     private LogoutUserUseCase $logout_user_use_case;
    38     private SyncTagsUseCase $sync_tags_use_case;
    39     private GetCommentSyncDataUseCase $get_comment_sync_data_use_case;
    40     private SyncCategoriesUseCase $sync_categories_use_case;
    41     private SyncAttachmentsUseCase $sync_attachments_use_case;
    42     private SyncAllUseCase $sync_all_use_case;
    43     private PostDeleteUseCase $post_delete_use_case;
    44     private CommentDeleteUseCase $comment_delete_use_case;
    45     private AttachmentDeleteUseCase $attachment_delete_use_case;
    46     private AttachmentSaveUseCase $attachment_save_use_case;
    47     private GetUsersByIdUseCase $get_users_by_id_use_case;
    48     private GetUserSyncDataUseCase $get_user_sync_data_use_case;
    49     private SendUserChunkSyncUseCase $send_user_chunk_sync_use_case;
    50     private UserDeleteUseCase $user_delete_use_case;
    51     private UserSaveUseCase $user_save_use_case;
    52     private SyncUsersUseCase $sync_users_use_case;
    53     private GetPostContentsByIdUseCase $get_post_contents_by_id_use_case;
    54     private ClearLogsUseCase $clear_logs_use_case;
    55     private AuthenticateUserUseCase $authenticate_user_use_case;
    56     private PullLocalPostContentUseCase $pull_local_post_content_use_case;
    57     private GetLocalPostContentByIdUseCase $get_local_post_content_by_id_use_case;
    58     private CreateCommentUseCase $create_comment_use_case;
    59     private GetRolesByIdUseCase $get_roles_by_id_use_case;
    60     private SyncRolesUseCase $sync_roles_use_case;
    61     private GetRoleSyncDataUseCase $get_role_sync_data_use_case;
    62     private SendRoleChunkSyncUseCase $send_role_chunk_sync_use_case;
    63     private GetPagesByIdUseCase $get_pages_by_id_use_case;
    64     private GetPageSyncDataUseCase $get_page_sync_data_use_case;
    65     private PageDeleteUseCase $page_delete_use_case;
    66     private PageSaveUseCase $page_save_use_case;
    67     private SendPageChunkSyncUseCase $send_page_chunk_sync_use_case;
    68     private SyncPagesUseCase $sync_pages_use_case;
    69     private PageUseCaseManager $page_use_case_manager;
    70     private PostUseCaseManager $post_use_case_manager;
    71     private AppSettingsUseCaseManager $app_settings_use_case_manager;
    72 
    73     public function __construct( BackendClient $backend_client, SelfClient $self_client ) {
    74         $this->get_android_asset_link_use_case         = new GetAndroidAssetLinkUseCase();
    75         $this->get_apple_app_site_association_use_case = new GetAppleAppSiteAssociationUseCase();
    76         $this->get_logs_use_case                       = new GetLogsUseCase();
    77         $this->get_blog_info_use_case                  = new GetBlogInfoUseCase();
    78         $this->is_logged_in_use_case                   = new IsLoggedInUseCase();
    79         $this->delete_session_use_case                 = new DeleteSessionUseCase( $backend_client );
    80         $this->register_blog_use_case                  = new RegisterBlogUseCase( $backend_client );
    81         $this->category_save_use_case                  = new CategorySaveUseCase( $backend_client );
    82         $this->category_delete_use_case                = new CategoryDeleteUseCase( $backend_client );
    83         $this->tag_delete_use_case                     = new TagDeleteUseCase( $backend_client );
    84         $this->tag_save_use_case                       = new TagSaveUseCase( $backend_client );
    85         $this->get_posts_by_id_use_case                = new GetPostsByIdUseCase();
    86         $this->get_tag_sync_data_use_case              = new GetTagSyncDataUseCase();
    87         $this->send_tag_chunk_sync_use_case            = new SendTagChunkSyncUseCase( $backend_client );
    88         $this->get_tags_by_id_use_case                 = new GetTagsByIdUseCase();
    89         $this->send_category_chunk_sync_use_case       = new SendCategoryChunkSyncUseCase( $backend_client );
    90         $this->get_category_sync_data_use_case         = new GetCategorySyncDataUseCase();
    91         $this->get_categories_by_id_use_case           = new GetCategoriesByIdUseCase();
    92         $this->send_attachment_chunk_sync_use_case     = new SendAttachmentChunkSyncUseCase( $backend_client );
    93         $this->get_attachments_by_id_use_case          = new GetAttachmentsByIdUseCase();
    94         $this->get_attachment_sync_data_use_case       = new GetAttachmentSyncDataUseCase();
    95         $this->send_comment_chunk_sync_use_case        = new SendCommentChunkSyncUseCase( $backend_client );
    96         $this->get_comments_by_id_use_case             = new GetCommentsByIdUseCase();
    97         $this->comment_save_use_case                   = new CommentSaveUseCase( $backend_client );
    98         $this->get_comment_sync_data_use_case          = new GetCommentSyncDataUseCase();
    99         $this->logout_user_use_case                    = new LogoutUserUseCase( $backend_client );
    100         $this->get_users_by_id_use_case                = new GetUsersByIdUseCase();
    101         $this->get_user_sync_data_use_case             = new GetUserSyncDataUseCase();
    102         $this->send_user_chunk_sync_use_case           = new SendUserChunkSyncUseCase( $backend_client );
    103         $this->sync_users_use_case                     = new SyncUsersUseCase( $this->get_user_sync_data_use_case, $this->send_user_chunk_sync_use_case );
    104         $this->sync_comments_use_case                  = new SyncCommentsUseCase( $this->get_comment_sync_data_use_case, $this->send_comment_chunk_sync_use_case );
    105         $this->sync_tags_use_case                      = new SyncTagsUseCase( $this->get_tag_sync_data_use_case, $this->send_tag_chunk_sync_use_case );
    106         $this->sync_categories_use_case                = new SyncCategoriesUseCase( $this->get_category_sync_data_use_case, $this->send_category_chunk_sync_use_case );
    107         $this->sync_attachments_use_case               = new SyncAttachmentsUseCase( $this->get_attachment_sync_data_use_case, $this->send_attachment_chunk_sync_use_case );
    108         $this->post_delete_use_case                    = new PostDeleteUseCase( $backend_client );
    109         $this->comment_delete_use_case                 = new CommentDeleteUseCase( $backend_client );
    110         $this->attachment_delete_use_case              = new AttachmentDeleteUseCase( $backend_client );
    111         $this->attachment_save_use_case                = new AttachmentSaveUseCase( $backend_client );
    112         $this->user_delete_use_case                    = new UserDeleteUseCase( $backend_client );
    113         $this->user_save_use_case                      = new UserSaveUseCase( $backend_client );
    114         $this->clear_logs_use_case                     = new ClearLogsUseCase();
    115         $this->authenticate_user_use_case              = new AuthenticateUserUseCase();
    116         $this->pull_local_post_content_use_case        = new PullLocalPostContentUseCase( $self_client );
    117         $this->get_local_post_content_by_id_use_case   = new GetLocalPostContentByIdUseCase();
    118         $this->get_post_contents_by_id_use_case        = new GetPostContentsByIdUseCase( $this->pull_local_post_content_use_case );
    119         $this->create_comment_use_case                 = new CreateCommentUseCase();
    120         $this->get_roles_by_id_use_case                = new GetRolesByIdUseCase();
    121         $this->get_role_sync_data_use_case             = new GetRoleSyncDataUseCase();
    122         $this->send_role_chunk_sync_use_case           = new SendRoleChunkSyncUseCase( $backend_client );
    123         $this->sync_roles_use_case                     = new SyncRolesUseCase( $this->get_role_sync_data_use_case, $this->send_role_chunk_sync_use_case );
    124         $this->get_pages_by_id_use_case                = new GetPagesByIdUseCase();
    125         $this->get_page_sync_data_use_case             = new GetPageSyncDataUseCase();
    126         $this->page_delete_use_case                    = new PageDeleteUseCase( $backend_client );
    127         $this->page_save_use_case                      = new PageSaveUseCase( $backend_client );
    128         $this->send_page_chunk_sync_use_case           = new SendPageChunkSyncUseCase( $backend_client );
    129         $this->sync_pages_use_case                     = new SyncPagesUseCase( $this->get_page_sync_data_use_case, $this->send_page_chunk_sync_use_case );
    130         $this->page_use_case_manager                   = new PageUseCaseManager( $self_client );
    131         $this->post_use_case_manager                   = new PostUseCaseManager( $backend_client );
    132         $this->app_settings_use_case_manager           = new AppSettingsUseCaseManager( $backend_client );
    133         $this->sync_all_use_case                       = new SyncAllUseCase( $this->post_use_case_manager->get_sync_posts_use_case(), $this->sync_tags_use_case, $this->sync_categories_use_case, $this->sync_attachments_use_case, $this->sync_comments_use_case, $this->sync_users_use_case, $this->sync_roles_use_case, $this->sync_pages_use_case );
    134     }
    135 
    136     public function get_android_asset_link_use_case(): GetAndroidAssetLinkUseCase {
    137         return $this->get_android_asset_link_use_case;
    138     }
    139 
    140     public function get_apple_app_site_association_use_case(): GetAppleAppSiteAssociationUseCase {
    141         return $this->get_apple_app_site_association_use_case;
    142     }
    143 
    144     public function get_logs_use_case(): GetLogsUseCase {
    145         return $this->get_logs_use_case;
    146     }
    147 
    148     public function get_blog_info_use_case(): GetBlogInfoUseCase {
    149         return $this->get_blog_info_use_case;
    150     }
    151 
    152     public function is_logged_in_use_case(): IsLoggedInUseCase {
    153         return $this->is_logged_in_use_case;
    154     }
    155 
    156     public function delete_session_use_case(): DeleteSessionUseCase {
    157         return $this->delete_session_use_case;
    158     }
    159 
    160     public function register_blog_use_case(): RegisterBlogUseCase {
    161         return $this->register_blog_use_case;
    162     }
    163 
    164     public function category_save_use_case(): CategorySaveUseCase {
    165         return $this->category_save_use_case;
    166     }
    167 
    168     public function category_delete_use_case(): CategoryDeleteUseCase {
    169         return $this->category_delete_use_case;
    170     }
    171 
    172     public function tag_delete_use_case(): TagDeleteUseCase {
    173         return $this->tag_delete_use_case;
    174     }
    175 
    176     public function tag_save_use_case(): TagSaveUseCase {
    177         return $this->tag_save_use_case;
    178     }
    179 
    180     public function get_posts_by_id_use_case(): GetPostsByIdUseCase {
    181         return $this->get_posts_by_id_use_case;
    182     }
    183 
    184     public function get_tag_sync_data_use_case(): GetTagSyncDataUseCase {
    185         return $this->get_tag_sync_data_use_case;
    186     }
    187 
    188     public function send_tag_chunk_sync_use_case(): SendTagChunkSyncUseCase {
    189         return $this->send_tag_chunk_sync_use_case;
    190     }
    191 
    192     public function get_tags_by_id_use_case(): GetTagsByIdUseCase {
    193         return $this->get_tags_by_id_use_case;
    194     }
    195 
    196     public function send_category_chunk_sync_use_case(): SendCategoryChunkSyncUseCase {
    197         return $this->send_category_chunk_sync_use_case;
    198     }
    199 
    200     public function get_category_sync_data_use_case(): GetCategorySyncDataUseCase {
    201         return $this->get_category_sync_data_use_case;
    202     }
    203 
    204     public function get_categories_by_id_use_case(): GetCategoriesByIdUseCase {
    205         return $this->get_categories_by_id_use_case;
    206     }
    207 
    208     public function send_attachment_chunk_sync_use_case(): SendAttachmentChunkSyncUseCase {
    209         return $this->send_attachment_chunk_sync_use_case;
    210     }
    211 
    212     public function send_comment_chunk_sync_use_case(): SendCommentChunkSyncUseCase {
    213         return $this->send_comment_chunk_sync_use_case;
    214     }
    215 
    216     public function get_attachments_by_id_use_case(): GetAttachmentsByIdUseCase {
    217         return $this->get_attachments_by_id_use_case;
    218     }
    219 
    220     public function comment_save_use_case(): CommentSaveUseCase {
    221         return $this->comment_save_use_case;
    222     }
    223 
    224     public function get_comment_sync_data_use_case(): GetCommentSyncDataUseCase {
    225         return $this->get_comment_sync_data_use_case;
    226     }
    227 
    228     public function get_attachment_sync_data_use_case(): GetAttachmentSyncDataUseCase {
    229         return $this->get_attachment_sync_data_use_case;
    230     }
    231 
    232     public function get_comments_by_id_use_case(): GetCommentsByIdUseCase {
    233         return $this->get_comments_by_id_use_case;
    234     }
    235 
    236     public function logout_user_use_case(): LogoutUserUseCase {
    237         return $this->logout_user_use_case;
    238     }
    239 
    240     public function sync_comments_use_case(): SyncCommentsUseCase {
    241         return $this->sync_comments_use_case;
    242     }
    243 
    244     public function sync_tags_use_case(): SyncTagsUseCase {
    245         return $this->sync_tags_use_case;
    246     }
    247 
    248     public function sync_categories_use_case(): SyncCategoriesUseCase {
    249         return $this->sync_categories_use_case;
    250     }
    251 
    252     public function sync_attachments_use_case(): SyncAttachmentsUseCase {
    253         return $this->sync_attachments_use_case;
    254     }
    255 
    256     public function sync_all_use_case(): SyncAllUseCase {
    257         return $this->sync_all_use_case;
    258     }
    259 
    260     public function post_delete_use_case(): PostDeleteUseCase {
    261         return $this->post_delete_use_case;
    262     }
    263 
    264     public function comment_delete_use_case(): CommentDeleteUseCase {
    265         return $this->comment_delete_use_case;
    266     }
    267 
    268     public function attachment_delete_use_case(): AttachmentDeleteUseCase {
    269         return $this->attachment_delete_use_case;
    270     }
    271 
    272     public function attachment_save_use_case(): AttachmentSaveUseCase {
    273         return $this->attachment_save_use_case;
    274     }
    275 
    276     public function get_users_by_id_use_case(): GetUsersByIdUseCase {
    277         return $this->get_users_by_id_use_case;
    278     }
    279 
    280     public function get_user_sync_data_use_case(): GetUserSyncDataUseCase {
    281         return $this->get_user_sync_data_use_case;
    282     }
    283 
    284     public function send_user_chunk_sync_use_case(): SendUserChunkSyncUseCase {
    285         return $this->send_user_chunk_sync_use_case;
    286     }
    287 
    288     public function user_delete_use_case(): UserDeleteUseCase {
    289         return $this->user_delete_use_case;
    290     }
    291 
    292     public function user_save_use_case(): UserSaveUseCase {
    293         return $this->user_save_use_case;
    294     }
    295 
    296     public function sync_users_use_case(): SyncUsersUseCase {
    297         return $this->sync_users_use_case;
    298     }
    299 
    300     public function get_post_contents_by_id_use_case(): GetPostContentsByIdUseCase {
    301         return $this->get_post_contents_by_id_use_case;
    302     }
    303 
    304     public function get_clear_logs_use_case(): ClearLogsUseCase {
    305         return $this->clear_logs_use_case;
    306     }
    307 
    308     public function get_authenticate_user_use_case(): AuthenticateUserUseCase {
    309         return $this->authenticate_user_use_case;
    310     }
    311 
    312     public function get_pull_local_post_content_use_case(): PullLocalPostContentUseCase {
    313         return $this->pull_local_post_content_use_case;
    314     }
    315 
    316     public function get_get_local_post_content_by_id_use_case(): GetLocalPostContentByIdUseCase {
    317         return $this->get_local_post_content_by_id_use_case;
    318     }
    319 
    320     public function create_comment_use_case(): CreateCommentUseCase {
    321         return $this->create_comment_use_case;
    322     }
    323 
    324     public function get_roles_by_id_use_case(): GetRolesByIdUseCase {
    325         return $this->get_roles_by_id_use_case;
    326     }
    327 
    328     public function get_role_sync_data_use_case(): GetRoleSyncDataUseCase {
    329         return $this->get_role_sync_data_use_case;
    330     }
    331 
    332     public function send_role_chunk_sync_use_case(): SendRoleChunkSyncUseCase {
    333         return $this->send_role_chunk_sync_use_case;
    334     }
    335 
    336     public function sync_roles_use_case(): SyncRolesUseCase {
    337         return $this->sync_roles_use_case;
    338     }
    339 
    340     public function get_pages_by_id_use_case(): GetPagesByIdUseCase {
    341         return $this->get_pages_by_id_use_case;
    342     }
    343 
    344     public function get_page_sync_data_use_case(): GetPageSyncDataUseCase {
    345         return $this->get_page_sync_data_use_case;
    346     }
    347 
    348     public function page_delete_use_case(): PageDeleteUseCase {
    349         return $this->page_delete_use_case;
    350     }
    351 
    352     public function page_save_use_case(): PageSaveUseCase {
    353         return $this->page_save_use_case;
    354     }
    355 
    356     public function send_page_chunk_sync_use_case(): SendPageChunkSyncUseCase {
    357         return $this->send_page_chunk_sync_use_case;
    358     }
    359 
    360     public function sync_pages_use_case(): SyncPagesUseCase {
    361         return $this->sync_pages_use_case;
    362     }
    363 
    364     public function pages(): PageUseCaseManager {
    365         return $this->page_use_case_manager;
    366     }
    367 
    368     public function posts(): PostUseCaseManager {
    369         return $this->post_use_case_manager;
    370     }
    371 
    372     public function app_settings(): AppSettingsUseCaseManager {
    373         return $this->app_settings_use_case_manager;
    374     }
     13    private GetAndroidAssetLinkUseCase $get_android_asset_link_use_case;
     14    private GetAppleAppSiteAssociationUseCase $get_apple_app_site_association_use_case;
     15    private GetLogsUseCase $get_logs_use_case;
     16    private GetBlogInfoUseCase $get_blog_info_use_case;
     17    private IsLoggedInUseCase $is_logged_in_use_case;
     18    private DeleteSessionUseCase $delete_session_use_case;
     19    private RegisterBlogUseCase $register_blog_use_case;
     20    private CategorySaveUseCase $category_save_use_case;
     21    private CategoryDeleteUseCase $category_delete_use_case;
     22    private TagDeleteUseCase $tag_delete_use_case;
     23    private TagSaveUseCase $tag_save_use_case;
     24    private GetPostsByIdUseCase $get_posts_by_id_use_case;
     25    private GetTagSyncDataUseCase $get_tag_sync_data_use_case;
     26    private SendTagChunkSyncUseCase $send_tag_chunk_sync_use_case;
     27    private GetTagsByIdUseCase $get_tags_by_id_use_case;
     28    private SendCategoryChunkSyncUseCase $send_category_chunk_sync_use_case;
     29    private GetCategorySyncDataUseCase $get_category_sync_data_use_case;
     30    private GetCategoriesByIdUseCase $get_categories_by_id_use_case;
     31    private SendAttachmentChunkSyncUseCase $send_attachment_chunk_sync_use_case;
     32    private GetAttachmentsByIdUseCase $get_attachments_by_id_use_case;
     33    private GetAttachmentSyncDataUseCase $get_attachment_sync_data_use_case;
     34    private GetCommentsByIdUseCase $get_comments_by_id_use_case;
     35    private SendCommentChunkSyncUseCase $send_comment_chunk_sync_use_case;
     36    private SyncCommentsUseCase $sync_comments_use_case;
     37    private CommentSaveUseCase $comment_save_use_case;
     38    private LogoutUserUseCase $logout_user_use_case;
     39    private SyncTagsUseCase $sync_tags_use_case;
     40    private GetCommentSyncDataUseCase $get_comment_sync_data_use_case;
     41    private SyncCategoriesUseCase $sync_categories_use_case;
     42    private SyncAttachmentsUseCase $sync_attachments_use_case;
     43    private SyncAllUseCase $sync_all_use_case;
     44    private PostDeleteUseCase $post_delete_use_case;
     45    private CommentDeleteUseCase $comment_delete_use_case;
     46    private AttachmentDeleteUseCase $attachment_delete_use_case;
     47    private AttachmentSaveUseCase $attachment_save_use_case;
     48    private GetUsersByIdUseCase $get_users_by_id_use_case;
     49    private GetUserSyncDataUseCase $get_user_sync_data_use_case;
     50    private SendUserChunkSyncUseCase $send_user_chunk_sync_use_case;
     51    private UserDeleteUseCase $user_delete_use_case;
     52    private UserSaveUseCase $user_save_use_case;
     53    private SyncUsersUseCase $sync_users_use_case;
     54    private GetPostContentsByIdUseCase $get_post_contents_by_id_use_case;
     55    private ClearLogsUseCase $clear_logs_use_case;
     56    private AuthenticateUserUseCase $authenticate_user_use_case;
     57    private PullLocalPostContentUseCase $pull_local_post_content_use_case;
     58    private GetLocalPostContentByIdUseCase $get_local_post_content_by_id_use_case;
     59    private CreateCommentUseCase $create_comment_use_case;
     60    private GetRolesByIdUseCase $get_roles_by_id_use_case;
     61    private SyncRolesUseCase $sync_roles_use_case;
     62    private GetRoleSyncDataUseCase $get_role_sync_data_use_case;
     63    private SendRoleChunkSyncUseCase $send_role_chunk_sync_use_case;
     64    private GetPagesByIdUseCase $get_pages_by_id_use_case;
     65    private GetPageSyncDataUseCase $get_page_sync_data_use_case;
     66    private PageDeleteUseCase $page_delete_use_case;
     67    private PageSaveUseCase $page_save_use_case;
     68    private SendPageChunkSyncUseCase $send_page_chunk_sync_use_case;
     69    private SyncPagesUseCase $sync_pages_use_case;
     70    private PageUseCaseManager $page_use_case_manager;
     71    private PostUseCaseManager $post_use_case_manager;
     72    private AppSettingsUseCaseManager $app_settings_use_case_manager;
     73    private PointOfInterestUseCaseManager $point_of_interest_use_case_manager;
     74
     75    public function __construct( BackendClient $backend_client, SelfClient $self_client ) {
     76        $this->get_android_asset_link_use_case         = new GetAndroidAssetLinkUseCase();
     77        $this->get_apple_app_site_association_use_case = new GetAppleAppSiteAssociationUseCase();
     78        $this->get_logs_use_case                       = new GetLogsUseCase();
     79        $this->get_blog_info_use_case                  = new GetBlogInfoUseCase();
     80        $this->is_logged_in_use_case                   = new IsLoggedInUseCase();
     81        $this->delete_session_use_case                 = new DeleteSessionUseCase( $backend_client );
     82        $this->register_blog_use_case                  = new RegisterBlogUseCase( $backend_client );
     83        $this->category_save_use_case                  = new CategorySaveUseCase( $backend_client );
     84        $this->category_delete_use_case                = new CategoryDeleteUseCase( $backend_client );
     85        $this->tag_delete_use_case                     = new TagDeleteUseCase( $backend_client );
     86        $this->tag_save_use_case                       = new TagSaveUseCase( $backend_client );
     87        $this->get_posts_by_id_use_case                = new GetPostsByIdUseCase();
     88        $this->get_tag_sync_data_use_case              = new GetTagSyncDataUseCase();
     89        $this->send_tag_chunk_sync_use_case            = new SendTagChunkSyncUseCase( $backend_client );
     90        $this->get_tags_by_id_use_case                 = new GetTagsByIdUseCase();
     91        $this->send_category_chunk_sync_use_case       = new SendCategoryChunkSyncUseCase( $backend_client );
     92        $this->get_category_sync_data_use_case         = new GetCategorySyncDataUseCase();
     93        $this->get_categories_by_id_use_case           = new GetCategoriesByIdUseCase();
     94        $this->send_attachment_chunk_sync_use_case     = new SendAttachmentChunkSyncUseCase( $backend_client );
     95        $this->get_attachments_by_id_use_case          = new GetAttachmentsByIdUseCase();
     96        $this->get_attachment_sync_data_use_case       = new GetAttachmentSyncDataUseCase();
     97        $this->send_comment_chunk_sync_use_case        = new SendCommentChunkSyncUseCase( $backend_client );
     98        $this->get_comments_by_id_use_case             = new GetCommentsByIdUseCase();
     99        $this->comment_save_use_case                   = new CommentSaveUseCase( $backend_client );
     100        $this->get_comment_sync_data_use_case          = new GetCommentSyncDataUseCase();
     101        $this->logout_user_use_case                    = new LogoutUserUseCase( $backend_client );
     102        $this->get_users_by_id_use_case                = new GetUsersByIdUseCase();
     103        $this->get_user_sync_data_use_case             = new GetUserSyncDataUseCase();
     104        $this->send_user_chunk_sync_use_case           = new SendUserChunkSyncUseCase( $backend_client );
     105        $this->sync_users_use_case                     = new SyncUsersUseCase( $this->get_user_sync_data_use_case, $this->send_user_chunk_sync_use_case );
     106        $this->sync_comments_use_case                  = new SyncCommentsUseCase( $this->get_comment_sync_data_use_case, $this->send_comment_chunk_sync_use_case );
     107        $this->sync_tags_use_case                      = new SyncTagsUseCase( $this->get_tag_sync_data_use_case, $this->send_tag_chunk_sync_use_case );
     108        $this->sync_categories_use_case                = new SyncCategoriesUseCase( $this->get_category_sync_data_use_case, $this->send_category_chunk_sync_use_case );
     109        $this->sync_attachments_use_case               = new SyncAttachmentsUseCase( $this->get_attachment_sync_data_use_case, $this->send_attachment_chunk_sync_use_case );
     110        $this->post_delete_use_case                    = new PostDeleteUseCase( $backend_client );
     111        $this->comment_delete_use_case                 = new CommentDeleteUseCase( $backend_client );
     112        $this->attachment_delete_use_case              = new AttachmentDeleteUseCase( $backend_client );
     113        $this->attachment_save_use_case                = new AttachmentSaveUseCase( $backend_client );
     114        $this->user_delete_use_case                    = new UserDeleteUseCase( $backend_client );
     115        $this->user_save_use_case                      = new UserSaveUseCase( $backend_client );
     116        $this->clear_logs_use_case                     = new ClearLogsUseCase();
     117        $this->authenticate_user_use_case              = new AuthenticateUserUseCase();
     118        $this->pull_local_post_content_use_case        = new PullLocalPostContentUseCase( $self_client );
     119        $this->get_local_post_content_by_id_use_case   = new GetLocalPostContentByIdUseCase();
     120        $this->get_post_contents_by_id_use_case        = new GetPostContentsByIdUseCase( $this->pull_local_post_content_use_case );
     121        $this->create_comment_use_case                 = new CreateCommentUseCase();
     122        $this->get_roles_by_id_use_case                = new GetRolesByIdUseCase();
     123        $this->get_role_sync_data_use_case             = new GetRoleSyncDataUseCase();
     124        $this->send_role_chunk_sync_use_case           = new SendRoleChunkSyncUseCase( $backend_client );
     125        $this->sync_roles_use_case                     = new SyncRolesUseCase( $this->get_role_sync_data_use_case, $this->send_role_chunk_sync_use_case );
     126        $this->get_pages_by_id_use_case                = new GetPagesByIdUseCase();
     127        $this->get_page_sync_data_use_case             = new GetPageSyncDataUseCase();
     128        $this->page_delete_use_case                    = new PageDeleteUseCase( $backend_client );
     129        $this->page_save_use_case                      = new PageSaveUseCase( $backend_client );
     130        $this->send_page_chunk_sync_use_case           = new SendPageChunkSyncUseCase( $backend_client );
     131        $this->sync_pages_use_case                     = new SyncPagesUseCase( $this->get_page_sync_data_use_case, $this->send_page_chunk_sync_use_case );
     132        $this->page_use_case_manager                   = new PageUseCaseManager( $self_client );
     133        $this->post_use_case_manager                   = new PostUseCaseManager( $backend_client );
     134        $this->app_settings_use_case_manager           = new AppSettingsUseCaseManager( $backend_client );
     135        $this->point_of_interest_use_case_manager      = new PointOfInterestUseCaseManager( $backend_client );
     136        $this->sync_all_use_case                       = new SyncAllUseCase( $this->post_use_case_manager->get_sync_posts_use_case(), $this->sync_tags_use_case, $this->sync_categories_use_case, $this->sync_attachments_use_case, $this->sync_comments_use_case, $this->sync_users_use_case, $this->sync_roles_use_case, $this->sync_pages_use_case, $this->points_of_interest()->get_sync_points_of_interest_use_case() );
     137    }
     138
     139    public function get_android_asset_link_use_case(): GetAndroidAssetLinkUseCase {
     140        return $this->get_android_asset_link_use_case;
     141    }
     142
     143    public function get_apple_app_site_association_use_case(): GetAppleAppSiteAssociationUseCase {
     144        return $this->get_apple_app_site_association_use_case;
     145    }
     146
     147    public function get_logs_use_case(): GetLogsUseCase {
     148        return $this->get_logs_use_case;
     149    }
     150
     151    public function get_blog_info_use_case(): GetBlogInfoUseCase {
     152        return $this->get_blog_info_use_case;
     153    }
     154
     155    public function is_logged_in_use_case(): IsLoggedInUseCase {
     156        return $this->is_logged_in_use_case;
     157    }
     158
     159    public function delete_session_use_case(): DeleteSessionUseCase {
     160        return $this->delete_session_use_case;
     161    }
     162
     163    public function register_blog_use_case(): RegisterBlogUseCase {
     164        return $this->register_blog_use_case;
     165    }
     166
     167    public function category_save_use_case(): CategorySaveUseCase {
     168        return $this->category_save_use_case;
     169    }
     170
     171    public function category_delete_use_case(): CategoryDeleteUseCase {
     172        return $this->category_delete_use_case;
     173    }
     174
     175    public function tag_delete_use_case(): TagDeleteUseCase {
     176        return $this->tag_delete_use_case;
     177    }
     178
     179    public function tag_save_use_case(): TagSaveUseCase {
     180        return $this->tag_save_use_case;
     181    }
     182
     183    public function get_posts_by_id_use_case(): GetPostsByIdUseCase {
     184        return $this->get_posts_by_id_use_case;
     185    }
     186
     187    public function get_tag_sync_data_use_case(): GetTagSyncDataUseCase {
     188        return $this->get_tag_sync_data_use_case;
     189    }
     190
     191    public function send_tag_chunk_sync_use_case(): SendTagChunkSyncUseCase {
     192        return $this->send_tag_chunk_sync_use_case;
     193    }
     194
     195    public function get_tags_by_id_use_case(): GetTagsByIdUseCase {
     196        return $this->get_tags_by_id_use_case;
     197    }
     198
     199    public function send_category_chunk_sync_use_case(): SendCategoryChunkSyncUseCase {
     200        return $this->send_category_chunk_sync_use_case;
     201    }
     202
     203    public function get_category_sync_data_use_case(): GetCategorySyncDataUseCase {
     204        return $this->get_category_sync_data_use_case;
     205    }
     206
     207    public function get_categories_by_id_use_case(): GetCategoriesByIdUseCase {
     208        return $this->get_categories_by_id_use_case;
     209    }
     210
     211    public function send_attachment_chunk_sync_use_case(): SendAttachmentChunkSyncUseCase {
     212        return $this->send_attachment_chunk_sync_use_case;
     213    }
     214
     215    public function send_comment_chunk_sync_use_case(): SendCommentChunkSyncUseCase {
     216        return $this->send_comment_chunk_sync_use_case;
     217    }
     218
     219    public function get_attachments_by_id_use_case(): GetAttachmentsByIdUseCase {
     220        return $this->get_attachments_by_id_use_case;
     221    }
     222
     223    public function comment_save_use_case(): CommentSaveUseCase {
     224        return $this->comment_save_use_case;
     225    }
     226
     227    public function get_comment_sync_data_use_case(): GetCommentSyncDataUseCase {
     228        return $this->get_comment_sync_data_use_case;
     229    }
     230
     231    public function get_attachment_sync_data_use_case(): GetAttachmentSyncDataUseCase {
     232        return $this->get_attachment_sync_data_use_case;
     233    }
     234
     235    public function get_comments_by_id_use_case(): GetCommentsByIdUseCase {
     236        return $this->get_comments_by_id_use_case;
     237    }
     238
     239    public function logout_user_use_case(): LogoutUserUseCase {
     240        return $this->logout_user_use_case;
     241    }
     242
     243    public function sync_comments_use_case(): SyncCommentsUseCase {
     244        return $this->sync_comments_use_case;
     245    }
     246
     247    public function sync_tags_use_case(): SyncTagsUseCase {
     248        return $this->sync_tags_use_case;
     249    }
     250
     251    public function sync_categories_use_case(): SyncCategoriesUseCase {
     252        return $this->sync_categories_use_case;
     253    }
     254
     255    public function sync_attachments_use_case(): SyncAttachmentsUseCase {
     256        return $this->sync_attachments_use_case;
     257    }
     258
     259    public function sync_all_use_case(): SyncAllUseCase {
     260        return $this->sync_all_use_case;
     261    }
     262
     263    public function post_delete_use_case(): PostDeleteUseCase {
     264        return $this->post_delete_use_case;
     265    }
     266
     267    public function comment_delete_use_case(): CommentDeleteUseCase {
     268        return $this->comment_delete_use_case;
     269    }
     270
     271    public function attachment_delete_use_case(): AttachmentDeleteUseCase {
     272        return $this->attachment_delete_use_case;
     273    }
     274
     275    public function attachment_save_use_case(): AttachmentSaveUseCase {
     276        return $this->attachment_save_use_case;
     277    }
     278
     279    public function get_users_by_id_use_case(): GetUsersByIdUseCase {
     280        return $this->get_users_by_id_use_case;
     281    }
     282
     283    public function get_user_sync_data_use_case(): GetUserSyncDataUseCase {
     284        return $this->get_user_sync_data_use_case;
     285    }
     286
     287    public function send_user_chunk_sync_use_case(): SendUserChunkSyncUseCase {
     288        return $this->send_user_chunk_sync_use_case;
     289    }
     290
     291    public function user_delete_use_case(): UserDeleteUseCase {
     292        return $this->user_delete_use_case;
     293    }
     294
     295    public function user_save_use_case(): UserSaveUseCase {
     296        return $this->user_save_use_case;
     297    }
     298
     299    public function sync_users_use_case(): SyncUsersUseCase {
     300        return $this->sync_users_use_case;
     301    }
     302
     303    public function get_post_contents_by_id_use_case(): GetPostContentsByIdUseCase {
     304        return $this->get_post_contents_by_id_use_case;
     305    }
     306
     307    public function get_clear_logs_use_case(): ClearLogsUseCase {
     308        return $this->clear_logs_use_case;
     309    }
     310
     311    public function get_authenticate_user_use_case(): AuthenticateUserUseCase {
     312        return $this->authenticate_user_use_case;
     313    }
     314
     315    public function get_pull_local_post_content_use_case(): PullLocalPostContentUseCase {
     316        return $this->pull_local_post_content_use_case;
     317    }
     318
     319    public function get_get_local_post_content_by_id_use_case(): GetLocalPostContentByIdUseCase {
     320        return $this->get_local_post_content_by_id_use_case;
     321    }
     322
     323    public function create_comment_use_case(): CreateCommentUseCase {
     324        return $this->create_comment_use_case;
     325    }
     326
     327    public function get_roles_by_id_use_case(): GetRolesByIdUseCase {
     328        return $this->get_roles_by_id_use_case;
     329    }
     330
     331    public function get_role_sync_data_use_case(): GetRoleSyncDataUseCase {
     332        return $this->get_role_sync_data_use_case;
     333    }
     334
     335    public function send_role_chunk_sync_use_case(): SendRoleChunkSyncUseCase {
     336        return $this->send_role_chunk_sync_use_case;
     337    }
     338
     339    public function sync_roles_use_case(): SyncRolesUseCase {
     340        return $this->sync_roles_use_case;
     341    }
     342
     343    public function get_pages_by_id_use_case(): GetPagesByIdUseCase {
     344        return $this->get_pages_by_id_use_case;
     345    }
     346
     347    public function get_page_sync_data_use_case(): GetPageSyncDataUseCase {
     348        return $this->get_page_sync_data_use_case;
     349    }
     350
     351    public function page_delete_use_case(): PageDeleteUseCase {
     352        return $this->page_delete_use_case;
     353    }
     354
     355    public function page_save_use_case(): PageSaveUseCase {
     356        return $this->page_save_use_case;
     357    }
     358
     359    public function send_page_chunk_sync_use_case(): SendPageChunkSyncUseCase {
     360        return $this->send_page_chunk_sync_use_case;
     361    }
     362
     363    public function sync_pages_use_case(): SyncPagesUseCase {
     364        return $this->sync_pages_use_case;
     365    }
     366
     367    public function pages(): PageUseCaseManager {
     368        return $this->page_use_case_manager;
     369    }
     370
     371    public function posts(): PostUseCaseManager {
     372        return $this->post_use_case_manager;
     373    }
     374
     375    public function app_settings(): AppSettingsUseCaseManager {
     376        return $this->app_settings_use_case_manager;
     377    }
     378
     379    public function points_of_interest(): PointOfInterestUseCaseManager {
     380        return $this->point_of_interest_use_case_manager;
     381    }
    375382}
  • appful-app/trunk/includes/use_cases/post/SyncPostUseCase.php

    r3027388 r3043568  
    44
    55class SyncPostUseCase {
    6     private GetPostSyncItemUseCase $get_post_sync_item_use_case;
    7     private SendPostSyncUseCase $send_post_sync_use_case;
     6    private GetPostSyncItemUseCase $get_post_sync_item_use_case;
     7    private SendPostSyncUseCase $send_post_sync_use_case;
    88
    9     public function __construct(
    10         GetPostSyncItemUseCase $get_post_sync_item_use_case,
    11         SendPostSyncUseCase $send_post_sync_use_case
    12     ) {
    13         $this->get_post_sync_item_use_case = $get_post_sync_item_use_case;
    14         $this->send_post_sync_use_case     = $send_post_sync_use_case;
    15     }
     9    public function __construct(
     10        GetPostSyncItemUseCase $get_post_sync_item_use_case,
     11        SendPostSyncUseCase $send_post_sync_use_case
     12    ) {
     13        $this->get_post_sync_item_use_case = $get_post_sync_item_use_case;
     14        $this->send_post_sync_use_case     = $send_post_sync_use_case;
     15    }
    1616
    17     public function invoke( int $post_id, bool $force ) {
    18         $post = $this->get_post_sync_item_use_case->invoke( $post_id );
    19         $post = $post->force_update( $force );
    20         $this->send_post_sync_use_case->invoke( $post );
    21     }
     17    public function invoke( int $post_id, bool $force = false ): void {
     18        $post = $this->get_post_sync_item_use_case->invoke( $post_id );
     19        $post = $post->force_update( $force );
     20        $this->send_post_sync_use_case->invoke( $post );
     21    }
    2222}
  • appful-app/trunk/includes/wp/WPPostDatabaseManager.php

    r3027388 r3043568  
    33namespace AppfulPlugin\Wp;
    44
     5use AppfulPlugin\Domain\PointOfInterest\PointOfInterest;
     6use AppfulPlugin\Domain\PointOfInterest\PostPointOfInterest;
    57use AppfulPlugin\Domain\SyncItem;
     8use AppfulPlugin\Helper\Constants;
    69use AppfulPlugin\Helper\DateParser;
     10use AppfulPlugin\Wp\Entities\PostCoordinatesEntity;
    711
    812class WPPostDatabaseManager {
     
    6771        return $wpdb->get_var( $query );
    6872    }
     73
     74    /**
     75     * @param int[] $ids
     76     *
     77     * @return PointOfInterest[]
     78     */
     79    public static function get_points_of_interest_for_ids( array $ids ): array {
     80        global $wpdb;
     81
     82        if ( empty( $ids ) ) {
     83            return [];
     84        }
     85
     86        $commaDelimitedIds = implode( ',', array_fill( 0, count( $ids ), '%d' ) );
     87        $query             = $wpdb->prepare( "SELECT post.ID, post.post_title, post.post_modified_gmt, meta.meta_value FROM $wpdb->posts AS post INNER JOIN $wpdb->postmeta AS meta ON post.ID = meta.post_id WHERE post.ID IN($commaDelimitedIds) AND meta.meta_key = %s ORDER BY post.ID DESC", array_merge( $ids, [ Constants::$APPFUL_POST_META_COORDINATES_KEY ] ) );
     88        $results           = $wpdb->get_results( $query );
     89
     90        return array_map(
     91            function ( $item ) {
     92                $coordinates_object = json_decode( $item->meta_value );
     93                $coordinates        = new PostCoordinatesEntity(null, 0, 0 );
     94                if ( $coordinates_object ) {
     95                    $coordinates = new PostCoordinatesEntity( $coordinates_object->name, $coordinates_object->latitude, $coordinates_object->longitude );
     96                }
     97
     98                return new PostPointOfInterest(
     99                    $item->ID,
     100                    $coordinates->name ?? $item->post_title,
     101                    $coordinates->longitude,
     102                    $coordinates->latitude,
     103                    DateParser::fromGmtDate( $item->post_modified_gmt ),
     104                    $item->ID
     105                );
     106            },
     107            $results
     108        );
     109    }
    69110}
  • appful-app/trunk/includes/wp/WPPostManager.php

    r3028218 r3043568  
    33namespace AppfulPlugin\Wp;
    44
     5use AppfulPlugin\Domain\PointOfInterest\PointOfInterest;
    56use AppfulPlugin\Domain\Post;
    67use AppfulPlugin\Domain\PostContent;
     
    89use AppfulPlugin\Helper\Constants;
    910use AppfulPlugin\Helper\Logger;
     11use AppfulPlugin\Wp\Entities\PostCoordinatesEntity;
    1012use AppfulPlugin\Wp\Mapper\PostMapper;
    1113use AppfulPlugin\Wp\Plugins\LanguageHelper;
     
    1315
    1416class WPPostManager {
    15     public static function get_post_permalink( WP_Post $post ): ?string {
    16         return get_permalink( $post );
    17     }
    18 
    19     public static function is_post_sticky( int $post_id ): bool {
    20         return is_sticky( $post_id );
    21     }
    22 
    23     public static function should_send_push( int $post_id ): bool {
    24         $push_term = get_term_by( "slug", Constants::$APPFUL_TAXONOMY_PUSH_TERM_SLUG, Constants::$APPFUL_TAXONOMY_NAME );
    25 
    26         if ( $push_term ) {
    27             return has_term( $push_term->term_id, Constants::$APPFUL_TAXONOMY_NAME, $post_id ) == false;
    28         }
    29 
    30         return true;
    31     }
    32 
    33     public static function get_post_language( int $post_id ): string {
    34         return LanguageHelper::get_post_language( $post_id );
    35     }
    36 
    37     public static function get_post_for_id( int $post_id ): ?Post {
    38         $post = get_post( $post_id );
    39         if ( $post != null ) {
    40             return PostMapper::to_domain( $post );
    41         } else {
    42             return null;
    43         }
    44     }
    45 
    46     public static function get_post_count(): int {
    47         return WPPostDatabaseManager::get_count_for_type( "post" );
    48     }
    49 
    50     public static function get_taxonomy_post_count( string $taxonomy, string $term_slug ): int {
    51         return WPPostDatabaseManager::get_count_for_type_and_taxonomy( "post", $taxonomy, $term_slug );
    52     }
    53 
    54     /** @return SyncItem[] */
    55     public static function get_post_sync_items( int $offset, int $count ): array {
    56         return WPPostDatabaseManager::get_sync_items_for_type( "post", $count, $offset );
    57     }
    58 
    59     /** @return SyncItem[] */
    60     public static function get_taxonomy_post_sync_items( string $taxonomy, string $term_slug, int $offset, int $count ): array {
    61         return WPPostDatabaseManager::get_sync_items_for_type_and_taxonomy( "post", $taxonomy, $term_slug, $count, $offset );
    62     }
    63 
    64     public static function get_post_sync_item( int $post_id ): SyncItem {
    65         return WPPostDatabaseManager::get_sync_item_for_type( "post", $post_id );
    66     }
    67 
    68     /**
    69      * @param int[] $ids
    70      *
    71      * @return Post[]
    72      */
    73     public static function get_posts_by_id( array $ids ): array {
    74         $args = [
    75             "numberposts" => - 1,
    76             "include"     => $ids,
    77             "post_status" => self::get_allowed_post_stati()
    78         ];
    79 
    80         $all_posts = get_posts( $args );
    81 
    82         $all_posts = array_values(
    83             array_filter( $all_posts, function ( WP_Post $post ) use ( $ids ) {
    84                 return in_array( $post->ID, $ids );
    85             } )
    86         );
    87 
    88         return array_map(
    89             function ( WP_Post $post ) {
    90                 return PostMapper::to_domain( $post );
    91             },
    92             $all_posts
    93         );
    94     }
    95 
    96     public static function get_post_content_by_id( int $id ): ?PostContent {
    97         global $wp_query;
    98 
    99         $args = [
    100             "post_type"   => "post",
    101             "p"           => $id,
    102             "post_status" => self::get_allowed_post_stati()
    103         ];
    104 
    105         $wp_query = new \WP_Query( $args );
    106 
    107         self::setup_wp_call();
    108 
    109         if ( have_posts() ) {
    110             the_post();
    111 
    112             Logger::debug( "Getting head!" );
    113             $head = self::get_data_code( 'wp_head' );
    114             Logger::debug( "Getting content!" );
    115             $content = self::get_data_code( 'the_content' );
    116             Logger::debug( "Getting footer!" );
    117             $footer = self::get_data_code( 'wp_footer' );
    118             Logger::debug( "Getting body classes!" );
    119             $body_class = self::get_data_code( 'body_class' );
    120 
    121             wp_reset_postdata();
    122 
    123             return PostContent::postContent()
    124                               ->id( get_the_ID() )
    125                               ->content( $content )
    126                               ->head( $head )
    127                               ->footer( $footer )
    128                               ->body_class( $body_class );
    129         }
    130 
    131         return null;
    132     }
    133 
    134     private static function get_data_code( callable $data_callback ): string {
    135         // The original buffer level before our handling
    136         $buffer_level_original = ob_get_level();
    137 
    138         // Start our custom buffer which we want to use to get the content
    139         ob_start();
    140 
    141         // Open some extra buffers in case somehow there is a
    142         // buffer closed which wasn't opened before
    143         for ( $i = 0; $i < 100; $i ++ ) {
    144             ob_start();
    145         }
    146 
    147         // Amount of buffers with our custom output buffers opened
    148         $buffer_level_fill = ob_get_level();
    149 
    150         call_user_func( $data_callback );
    151 
    152         // This is the level after the content call, if it is different from the one before
    153         // we have buffers which weren't closed correctly or were closed too much
    154         // We can't correctly detect what happened when buffers where closed and
    155         // opened at the same time, so we just hope that in one call only one of the both happens
    156         $buffer_level_end = ob_get_level();
    157 
    158         if ( $buffer_level_end > $buffer_level_fill ) {
    159             Logger::debug( "Buffers where opened too much, getting data with adjustment" );
    160 
    161             // New buffers were opened inside the head
    162             // We can just proceed by closing the buffers and accumulating their content
    163 
    164             // Get the information how much more buffers we have to close
    165             $opened_buffer_count = $buffer_level_end - $buffer_level_fill;
    166             Logger::debug( "Closing " . $opened_buffer_count . " extra buffers to get content" );
    167 
    168             return self::accumulate_buffer_data( $buffer_level_original );
    169         } else if ( $buffer_level_end < $buffer_level_fill ) {
    170             Logger::debug( "Buffers where closed too much, getting data with adjustment" );
    171 
    172             // Unknown buffers were closed inside the head
    173             // We have to reset our buffers and call the function again
    174 
    175             // Even tho there were more buffers closed than opened before, we assume that
    176             // there are not more than 100 and accumulate all the output
    177             $output = self::accumulate_buffer_data( $buffer_level_original );
    178 
    179             // Open the correct amount of buffers which are closed in the call
    180             $closed_buffer_count = $buffer_level_fill - $buffer_level_end;
    181             Logger::debug( $closed_buffer_count . " extra buffers where closed" );
    182 
    183             return $output;
    184         } else {
    185             Logger::debug( "Buffer level normal, getting data without adjustment" );
    186 
    187             // If we don't have a malicious actor in the content call we can use the normal method
    188 
    189             return self::accumulate_buffer_data( $buffer_level_original );
    190         }
    191     }
    192 
    193     // Close all buffers until the target level is reached and return the accumulated data
    194     private static function accumulate_buffer_data( int $target_level ): string {
    195         $data = "";
    196         // The first condition is a safety measure in case the target level is negative
    197         while ( ob_get_level() > 0 && ob_get_level() > $target_level ) {
    198             $data .= ob_get_clean();
    199         }
    200 
    201         return $data;
    202     }
    203 
    204     private static function setup_wp_call() {
    205         // This should trick "smart" plugins to stop posting their spam
    206         // bc. some plugins register a shutdown function, but rightfully don't
    207         // do it when it's a cron. So let's pretend we are.
    208         if ( ! defined( 'DOING_CRON' ) ) {
    209             define( 'DOING_CRON', true );
    210         }
    211 
    212         // We try to initialize a "frontend" theme so that all hooks etc.
    213         // by plugins are setup correctly
    214         do_action( 'template_redirect' );
    215     }
    216 
    217     /**
    218      * @return string[]
    219      */
    220     private static function get_allowed_post_stati(): array {
    221         return array_filter( get_post_stati(), function ( string $status ) {
    222             return $status != "auto-draft";
    223         } );
    224     }
     17    public static function get_post_permalink( WP_Post $post ): ?string {
     18        return get_permalink( $post );
     19    }
     20
     21    public static function is_post_sticky( int $post_id ): bool {
     22        return is_sticky( $post_id );
     23    }
     24
     25    public static function should_send_push( int $post_id ): bool {
     26        $push_term = get_term_by( "slug", Constants::$APPFUL_TAXONOMY_PUSH_TERM_SLUG, Constants::$APPFUL_TAXONOMY_NAME );
     27
     28        if ( $push_term ) {
     29            return has_term( $push_term->term_id, Constants::$APPFUL_TAXONOMY_NAME, $post_id ) == false;
     30        }
     31
     32        return true;
     33    }
     34
     35    public static function get_post_language( int $post_id ): string {
     36        return LanguageHelper::get_post_language( $post_id );
     37    }
     38
     39    public static function get_post_for_id( int $post_id ): ?Post {
     40        $post = get_post( $post_id );
     41        if ( $post != null ) {
     42            return PostMapper::to_domain( $post );
     43        } else {
     44            return null;
     45        }
     46    }
     47
     48    public static function get_post_count(): int {
     49        return WPPostDatabaseManager::get_count_for_type( "post" );
     50    }
     51
     52    public static function get_taxonomy_post_count( string $taxonomy, string $term_slug ): int {
     53        return WPPostDatabaseManager::get_count_for_type_and_taxonomy( "post", $taxonomy, $term_slug );
     54    }
     55
     56    /** @return SyncItem[] */
     57    public static function get_post_sync_items( int $offset, int $count ): array {
     58        return WPPostDatabaseManager::get_sync_items_for_type( "post", $count, $offset );
     59    }
     60
     61    /** @return SyncItem[] */
     62    public static function get_taxonomy_post_sync_items( string $taxonomy, string $term_slug, int $offset, int $count ): array {
     63        return WPPostDatabaseManager::get_sync_items_for_type_and_taxonomy( "post", $taxonomy, $term_slug, $count, $offset );
     64    }
     65
     66    public static function get_post_sync_item( int $post_id ): SyncItem {
     67        return WPPostDatabaseManager::get_sync_item_for_type( "post", $post_id );
     68    }
     69
     70    public static function get_post_coordinates( int $post_id ): ?PostCoordinatesEntity {
     71        $meta = get_post_meta( $post_id, Constants::$APPFUL_POST_META_COORDINATES_KEY, true );
     72        if ( ! $meta ) {
     73            return null;
     74        }
     75
     76        $meta_value = json_decode( $meta );
     77        if ( $meta_value ) {
     78            return new PostCoordinatesEntity( $meta_value->name, $meta_value->latitude, $meta_value->longitude );
     79        }
     80
     81        return null;
     82    }
     83
     84    public static function save_coordinates( int $post_id, ?string $name, string $long, string $lat ) {
     85        $longitude = floatval( $long );
     86        $latitude  = floatval( $lat );
     87        $data = json_encode( new PostCoordinatesEntity( $name, $latitude, $longitude ) );
     88        update_post_meta( $post_id, Constants::$APPFUL_POST_META_COORDINATES_KEY, $data );
     89    }
     90
     91    public static function delete_coordinates( int $post_id ) {
     92        delete_post_meta( $post_id, Constants::$APPFUL_POST_META_COORDINATES_KEY );
     93    }
     94
     95    /**
     96     * @param int[] $ids
     97     *
     98     * @return PointOfInterest[]
     99     */
     100    public static function get_points_of_interest_by_id( array $ids ): array {
     101        return WPPostDatabaseManager::get_points_of_interest_for_ids( $ids );
     102    }
     103
     104    /**
     105     * @param int[] $ids
     106     *
     107     * @return Post[]
     108     */
     109    public static function get_posts_by_id( array $ids ): array {
     110        $args = [
     111            "numberposts" => - 1,
     112            "include"     => $ids,
     113            "post_status" => self::get_allowed_post_stati()
     114        ];
     115
     116        $all_posts = get_posts( $args );
     117
     118        $all_posts = array_values(
     119            array_filter( $all_posts, function ( WP_Post $post ) use ( $ids ) {
     120                return in_array( $post->ID, $ids );
     121            } )
     122        );
     123
     124        return array_map(
     125            function ( WP_Post $post ) {
     126                return PostMapper::to_domain( $post );
     127            },
     128            $all_posts
     129        );
     130    }
     131
     132    public static function get_post_content_by_id( int $id ): ?PostContent {
     133        global $wp_query;
     134
     135        $args = [
     136            "post_type"   => "post",
     137            "p"           => $id,
     138            "post_status" => self::get_allowed_post_stati()
     139        ];
     140
     141        $wp_query = new \WP_Query( $args );
     142
     143        self::setup_wp_call();
     144
     145        if ( have_posts() ) {
     146            the_post();
     147
     148            Logger::debug( "Getting head!" );
     149            $head = self::get_data_code( 'wp_head' );
     150            Logger::debug( "Getting content!" );
     151            $content = self::get_data_code( 'the_content' );
     152            Logger::debug( "Getting footer!" );
     153            $footer = self::get_data_code( 'wp_footer' );
     154            Logger::debug( "Getting body classes!" );
     155            $body_class = self::get_data_code( 'body_class' );
     156
     157            wp_reset_postdata();
     158
     159            return PostContent::postContent()
     160                              ->id( get_the_ID() )
     161                              ->content( $content )
     162                              ->head( $head )
     163                              ->footer( $footer )
     164                              ->body_class( $body_class );
     165        }
     166
     167        return null;
     168    }
     169
     170    private static function get_data_code( callable $data_callback ): string {
     171        // The original buffer level before our handling
     172        $buffer_level_original = ob_get_level();
     173
     174        // Start our custom buffer which we want to use to get the content
     175        ob_start();
     176
     177        // Open some extra buffers in case somehow there is a
     178        // buffer closed which wasn't opened before
     179        for ( $i = 0; $i < 100; $i ++ ) {
     180            ob_start();
     181        }
     182
     183        // Amount of buffers with our custom output buffers opened
     184        $buffer_level_fill = ob_get_level();
     185
     186        call_user_func( $data_callback );
     187
     188        // This is the level after the content call, if it is different from the one before
     189        // we have buffers which weren't closed correctly or were closed too much
     190        // We can't correctly detect what happened when buffers where closed and
     191        // opened at the same time, so we just hope that in one call only one of the both happens
     192        $buffer_level_end = ob_get_level();
     193
     194        if ( $buffer_level_end > $buffer_level_fill ) {
     195            Logger::debug( "Buffers where opened too much, getting data with adjustment" );
     196
     197            // New buffers were opened inside the head
     198            // We can just proceed by closing the buffers and accumulating their content
     199
     200            // Get the information how much more buffers we have to close
     201            $opened_buffer_count = $buffer_level_end - $buffer_level_fill;
     202            Logger::debug( "Closing " . $opened_buffer_count . " extra buffers to get content" );
     203
     204            return self::accumulate_buffer_data( $buffer_level_original );
     205        } else if ( $buffer_level_end < $buffer_level_fill ) {
     206            Logger::debug( "Buffers where closed too much, getting data with adjustment" );
     207
     208            // Unknown buffers were closed inside the head
     209            // We have to reset our buffers and call the function again
     210
     211            // Even tho there were more buffers closed than opened before, we assume that
     212            // there are not more than 100 and accumulate all the output
     213            $output = self::accumulate_buffer_data( $buffer_level_original );
     214
     215            // Open the correct amount of buffers which are closed in the call
     216            $closed_buffer_count = $buffer_level_fill - $buffer_level_end;
     217            Logger::debug( $closed_buffer_count . " extra buffers where closed" );
     218
     219            return $output;
     220        } else {
     221            Logger::debug( "Buffer level normal, getting data without adjustment" );
     222
     223            // If we don't have a malicious actor in the content call we can use the normal method
     224
     225            return self::accumulate_buffer_data( $buffer_level_original );
     226        }
     227    }
     228
     229    // Close all buffers until the target level is reached and return the accumulated data
     230    private static function accumulate_buffer_data( int $target_level ): string {
     231        $data = "";
     232        // The first condition is a safety measure in case the target level is negative
     233        while ( ob_get_level() > 0 && ob_get_level() > $target_level ) {
     234            $data .= ob_get_clean();
     235        }
     236
     237        return $data;
     238    }
     239
     240    private static function setup_wp_call() {
     241        // We try to initialize a "frontend" theme so that all hooks etc.
     242        // by plugins are setup correctly
     243        do_action( 'template_redirect' );
     244    }
     245
     246    /**
     247     * @return string[]
     248     */
     249    private static function get_allowed_post_stati(): array {
     250        return array_filter( get_post_stati(), function ( string $status ) {
     251            return $status != "auto-draft";
     252        } );
     253    }
    225254}
  • appful-app/trunk/includes/wp/mapper/CategoryMapper.php

    r2907312 r3043568  
    1515                       ->description( $category->description )
    1616                       ->slug( $category->slug )
    17                        ->title( $category->name )
     17                       ->title( html_entity_decode($category->name) )
    1818                       ->parent( ( $category->parent != 0 ) ? self::to_domain( get_term( $category->parent ) ) : null )
    1919                       ->language( WPCategoryManager::get_category_language( $category->term_id ) )
  • appful-app/trunk/includes/wp/mapper/TagMapper.php

    r2907312 r3043568  
    1414                  ->description( $tag->description )
    1515                  ->slug( $tag->slug )
    16                   ->title( $tag->name )
     16                  ->title( html_entity_decode($tag->name) )
    1717                  ->language( WPTagManager::get_tag_language( $tag->term_id ) )
    1818                  ->image( WPAttachmentManager::get_image_for_term_id( $tag->term_id ) );
  • appful-app/trunk/lib/vendor/composer/autoload_classmap.php

    r3039311 r3043568  
    2121    'AppfulPlugin\\Api\\Dtos\\PageContentDto' => $baseDir . '/../includes/api/dtos/PageContentDto.php',
    2222    'AppfulPlugin\\Api\\Dtos\\PageDto' => $baseDir . '/../includes/api/dtos/PageDto.php',
     23    'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PointOfInterestDto' => $baseDir . '/../includes/api/dtos/point_of_interest/PointOfInterestDto.php',
     24    'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PostPointOfInterestDto' => $baseDir . '/../includes/api/dtos/point_of_interest/PostPointOfInterestDto.php',
    2325    'AppfulPlugin\\Api\\Dtos\\PostContentDto' => $baseDir . '/../includes/api/dtos/PostContentDto.php',
    2426    'AppfulPlugin\\Api\\Dtos\\PostDto' => $baseDir . '/../includes/api/dtos/PostDto.php',
     
    5254    'AppfulPlugin\\Api\\Handlers\\PageSyncRequestHandler' => $baseDir . '/../includes/api/handlers/PageSyncRequestHandler.php',
    5355    'AppfulPlugin\\Api\\Handlers\\Page\\GetPageContentRequestHandler' => $baseDir . '/../includes/api/handlers/page/GetPageContentRequestHandler.php',
     56    'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\GetPointsOfInterestRequestHandler' => $baseDir . '/../includes/api/handlers/point_of_interest/GetPointsOfInterestRequestHandler.php',
     57    'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\PointOfInterestSyncRequestHandler' => $baseDir . '/../includes/api/handlers/point_of_interest/PointOfInterestSyncRequestHandler.php',
    5458    'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => $baseDir . '/../includes/api/handlers/PostSyncRequestHandler.php',
    5559    'AppfulPlugin\\Api\\Handlers\\PullLocalPageContentRequestHandler' => $baseDir . '/../includes/api/handlers/PullLocalPageContentRequestHandler.php',
     
    7175    'AppfulPlugin\\Api\\Mapper\\PageContentMapper' => $baseDir . '/../includes/api/mapper/PageContentMapper.php',
    7276    'AppfulPlugin\\Api\\Mapper\\PageMapper' => $baseDir . '/../includes/api/mapper/PageMapper.php',
     77    'AppfulPlugin\\Api\\Mapper\\PointOfInterestMapper' => $baseDir . '/../includes/api/mapper/PointOfInterestMapper.php',
    7378    'AppfulPlugin\\Api\\Mapper\\PostContentMapper' => $baseDir . '/../includes/api/mapper/PostContentMapper.php',
    7479    'AppfulPlugin\\Api\\Mapper\\PostMapper' => $baseDir . '/../includes/api/mapper/PostMapper.php',
     
    98103    'AppfulPlugin\\Domain\\Page' => $baseDir . '/../includes/domain/Page.php',
    99104    'AppfulPlugin\\Domain\\PageContent' => $baseDir . '/../includes/domain/PageContent.php',
     105    'AppfulPlugin\\Domain\\PointOfInterest\\PointOfInterest' => $baseDir . '/../includes/domain/point_of_interest/PointOfInterest.php',
     106    'AppfulPlugin\\Domain\\PointOfInterest\\PostPointOfInterest' => $baseDir . '/../includes/domain/point_of_interest/PostPointOfInterest.php',
    100107    'AppfulPlugin\\Domain\\Post' => $baseDir . '/../includes/domain/Post.php',
    101108    'AppfulPlugin\\Domain\\PostContent' => $baseDir . '/../includes/domain/PostContent.php',
     
    127134    'AppfulPlugin\\Menu\\Menu' => $baseDir . '/../includes/menu/Menu.php',
    128135    'AppfulPlugin\\Notice\\Notice' => $baseDir . '/../includes/notice/Notice.php',
     136    'AppfulPlugin\\PostForm\\PostForm' => $baseDir . '/../includes/post_form/PostForm.php',
    129137    'AppfulPlugin\\TermForm\\TermForm' => $baseDir . '/../includes/term_form/TermForm.php',
    130138    'AppfulPlugin\\UseCases\\AppSettings\\AppSettingsUseCaseManager' => $baseDir . '/../includes/use_cases/app_settings/AppSettingsUseCaseManager.php',
     
    169177    'AppfulPlugin\\UseCases\\Page\\PageUseCaseManager' => $baseDir . '/../includes/use_cases/page/PageUseCaseManager.php',
    170178    'AppfulPlugin\\UseCases\\Page\\PullLocalPageContentUseCase' => $baseDir . '/../includes/use_cases/page/PullLocalPageContentUseCase.php',
     179    'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemUseCase.php',
     180    'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemsUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemsUseCase.php',
     181    'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointsOfInterestByIdUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/GetPointsOfInterestByIdUseCase.php',
     182    'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestDeleteUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/PointOfInterestDeleteUseCase.php',
     183    'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestUseCaseManager' => $baseDir . '/../includes/use_cases/point_of_interest/PointOfInterestUseCaseManager.php',
     184    'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestChunkSyncUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SendPointOfInterestChunkSyncUseCase.php',
     185    'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestSyncUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SendPointOfInterestSyncUseCase.php',
     186    'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointOfInterestUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SyncPointOfInterestUseCase.php',
     187    'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointsOfInterestUseCase' => $baseDir . '/../includes/use_cases/point_of_interest/SyncPointsOfInterestUseCase.php',
    171188    'AppfulPlugin\\UseCases\\PostDeleteUseCase' => $baseDir . '/../includes/use_cases/PostDeleteUseCase.php',
    172189    'AppfulPlugin\\UseCases\\Post\\GetPostSyncBatchSizeUseCase' => $baseDir . '/../includes/use_cases/post/GetPostSyncBatchSizeUseCase.php',
     
    203220    'AppfulPlugin\\UseCases\\UserDeleteUseCase' => $baseDir . '/../includes/use_cases/UserDeleteUseCase.php',
    204221    'AppfulPlugin\\UseCases\\UserSaveUseCase' => $baseDir . '/../includes/use_cases/UserSaveUseCase.php',
     222    'AppfulPlugin\\Wp\\Entities\\PostCoordinatesEntity' => $baseDir . '/../includes/wp/entities/PostCoordinatesEntity.php',
    205223    'AppfulPlugin\\Wp\\Mapper\\AttachmentMapper' => $baseDir . '/../includes/wp/mapper/AttachmentMapper.php',
    206224    'AppfulPlugin\\Wp\\Mapper\\CategoryMapper' => $baseDir . '/../includes/wp/mapper/CategoryMapper.php',
  • appful-app/trunk/lib/vendor/composer/autoload_psr4.php

    r3027388 r3043568  
    1717    'AppfulPlugin\\Wp\\Plugins\\' => array($baseDir . '/../includes/wp/plugins'),
    1818    'AppfulPlugin\\Wp\\Mapper\\' => array($baseDir . '/../includes/wp/mapper'),
     19    'AppfulPlugin\\Wp\\Entities\\' => array($baseDir . '/../includes/wp/entities'),
    1920    'AppfulPlugin\\Wp\\' => array($baseDir . '/../includes/wp'),
    2021    'AppfulPlugin\\UseCases\\Post\\' => array($baseDir . '/../includes/use_cases/post'),
     22    'AppfulPlugin\\UseCases\\PointOfInterest\\' => array($baseDir . '/../includes/use_cases/point_of_interest'),
    2123    'AppfulPlugin\\UseCases\\Page\\' => array($baseDir . '/../includes/use_cases/page'),
    2224    'AppfulPlugin\\UseCases\\AppSettings\\' => array($baseDir . '/../includes/use_cases/app_settings'),
    2325    'AppfulPlugin\\UseCases\\' => array($baseDir . '/../includes/use_cases'),
    2426    'AppfulPlugin\\TermForm\\' => array($baseDir . '/../includes/term_form'),
     27    'AppfulPlugin\\PostForm\\' => array($baseDir . '/../includes/post_form'),
    2528    'AppfulPlugin\\Notice\\' => array($baseDir . '/../includes/notice'),
    2629    'AppfulPlugin\\Menu\\' => array($baseDir . '/../includes/menu'),
     
    2831    'AppfulPlugin\\Hooks\\' => array($baseDir . '/../includes/hooks'),
    2932    'AppfulPlugin\\Helper\\' => array($baseDir . '/../includes/helper'),
     33    'AppfulPlugin\\Domain\\PointOfInterest\\' => array($baseDir . '/../includes/domain/point_of_interest'),
    3034    'AppfulPlugin\\Domain\\App\\' => array($baseDir . '/../includes/domain/app'),
    3135    'AppfulPlugin\\Domain\\' => array($baseDir . '/../includes/domain'),
     
    3438    'AppfulPlugin\\Api\\Requests\\' => array($baseDir . '/../includes/api/requests'),
    3539    'AppfulPlugin\\Api\\Mapper\\' => array($baseDir . '/../includes/api/mapper'),
     40    'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\' => array($baseDir . '/../includes/api/handlers/point_of_interest'),
    3641    'AppfulPlugin\\Api\\Handlers\\Page\\' => array($baseDir . '/../includes/api/handlers/page'),
    3742    'AppfulPlugin\\Api\\Handlers\\' => array($baseDir . '/../includes/api/handlers'),
     43    'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\' => array($baseDir . '/../includes/api/dtos/point_of_interest'),
    3844    'AppfulPlugin\\Api\\Dtos\\App\\' => array($baseDir . '/../includes/api/dtos/app'),
    3945    'AppfulPlugin\\Api\\Dtos\\' => array($baseDir . '/../includes/api/dtos'),
  • appful-app/trunk/lib/vendor/composer/autoload_static.php

    r3039311 r3043568  
    4141            'AppfulPlugin\\Wp\\Plugins\\' => 24,
    4242            'AppfulPlugin\\Wp\\Mapper\\' => 23,
     43            'AppfulPlugin\\Wp\\Entities\\' => 25,
    4344            'AppfulPlugin\\Wp\\' => 16,
    4445            'AppfulPlugin\\UseCases\\Post\\' => 27,
     46            'AppfulPlugin\\UseCases\\PointOfInterest\\' => 38,
    4547            'AppfulPlugin\\UseCases\\Page\\' => 27,
    4648            'AppfulPlugin\\UseCases\\AppSettings\\' => 34,
    4749            'AppfulPlugin\\UseCases\\' => 22,
    4850            'AppfulPlugin\\TermForm\\' => 22,
     51            'AppfulPlugin\\PostForm\\' => 22,
    4952            'AppfulPlugin\\Notice\\' => 20,
    5053            'AppfulPlugin\\Menu\\' => 18,
     
    5255            'AppfulPlugin\\Hooks\\' => 19,
    5356            'AppfulPlugin\\Helper\\' => 20,
     57            'AppfulPlugin\\Domain\\PointOfInterest\\' => 36,
    5458            'AppfulPlugin\\Domain\\App\\' => 24,
    5559            'AppfulPlugin\\Domain\\' => 20,
     
    5862            'AppfulPlugin\\Api\\Requests\\' => 26,
    5963            'AppfulPlugin\\Api\\Mapper\\' => 24,
     64            'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\' => 42,
    6065            'AppfulPlugin\\Api\\Handlers\\Page\\' => 31,
    6166            'AppfulPlugin\\Api\\Handlers\\' => 26,
     67            'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\' => 38,
    6268            'AppfulPlugin\\Api\\Dtos\\App\\' => 26,
    6369            'AppfulPlugin\\Api\\Dtos\\' => 22,
     
    109115            0 => __DIR__ . '/../..' . '/../includes/wp/mapper',
    110116        ),
     117        'AppfulPlugin\\Wp\\Entities\\' =>
     118        array (
     119            0 => __DIR__ . '/../..' . '/../includes/wp/entities',
     120        ),
    111121        'AppfulPlugin\\Wp\\' =>
    112122        array (
     
    117127            0 => __DIR__ . '/../..' . '/../includes/use_cases/post',
    118128        ),
     129        'AppfulPlugin\\UseCases\\PointOfInterest\\' =>
     130        array (
     131            0 => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest',
     132        ),
    119133        'AppfulPlugin\\UseCases\\Page\\' =>
    120134        array (
     
    133147            0 => __DIR__ . '/../..' . '/../includes/term_form',
    134148        ),
     149        'AppfulPlugin\\PostForm\\' =>
     150        array (
     151            0 => __DIR__ . '/../..' . '/../includes/post_form',
     152        ),
    135153        'AppfulPlugin\\Notice\\' =>
    136154        array (
     
    153171            0 => __DIR__ . '/../..' . '/../includes/helper',
    154172        ),
     173        'AppfulPlugin\\Domain\\PointOfInterest\\' =>
     174        array (
     175            0 => __DIR__ . '/../..' . '/../includes/domain/point_of_interest',
     176        ),
    155177        'AppfulPlugin\\Domain\\App\\' =>
    156178        array (
     
    177199            0 => __DIR__ . '/../..' . '/../includes/api/mapper',
    178200        ),
     201        'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\' =>
     202        array (
     203            0 => __DIR__ . '/../..' . '/../includes/api/handlers/point_of_interest',
     204        ),
    179205        'AppfulPlugin\\Api\\Handlers\\Page\\' =>
    180206        array (
     
    184210        array (
    185211            0 => __DIR__ . '/../..' . '/../includes/api/handlers',
     212        ),
     213        'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\' =>
     214        array (
     215            0 => __DIR__ . '/../..' . '/../includes/api/dtos/point_of_interest',
    186216        ),
    187217        'AppfulPlugin\\Api\\Dtos\\App\\' =>
     
    218248        'AppfulPlugin\\Api\\Dtos\\PageContentDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PageContentDto.php',
    219249        'AppfulPlugin\\Api\\Dtos\\PageDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PageDto.php',
     250        'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PointOfInterestDto' => __DIR__ . '/../..' . '/../includes/api/dtos/point_of_interest/PointOfInterestDto.php',
     251        'AppfulPlugin\\Api\\Dtos\\PointOfInterest\\PostPointOfInterestDto' => __DIR__ . '/../..' . '/../includes/api/dtos/point_of_interest/PostPointOfInterestDto.php',
    220252        'AppfulPlugin\\Api\\Dtos\\PostContentDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PostContentDto.php',
    221253        'AppfulPlugin\\Api\\Dtos\\PostDto' => __DIR__ . '/../..' . '/../includes/api/dtos/PostDto.php',
     
    249281        'AppfulPlugin\\Api\\Handlers\\PageSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PageSyncRequestHandler.php',
    250282        'AppfulPlugin\\Api\\Handlers\\Page\\GetPageContentRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/page/GetPageContentRequestHandler.php',
     283        'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\GetPointsOfInterestRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/point_of_interest/GetPointsOfInterestRequestHandler.php',
     284        'AppfulPlugin\\Api\\Handlers\\PointOfInterest\\PointOfInterestSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/point_of_interest/PointOfInterestSyncRequestHandler.php',
    251285        'AppfulPlugin\\Api\\Handlers\\PostSyncRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PostSyncRequestHandler.php',
    252286        'AppfulPlugin\\Api\\Handlers\\PullLocalPageContentRequestHandler' => __DIR__ . '/../..' . '/../includes/api/handlers/PullLocalPageContentRequestHandler.php',
     
    268302        'AppfulPlugin\\Api\\Mapper\\PageContentMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PageContentMapper.php',
    269303        'AppfulPlugin\\Api\\Mapper\\PageMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PageMapper.php',
     304        'AppfulPlugin\\Api\\Mapper\\PointOfInterestMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PointOfInterestMapper.php',
    270305        'AppfulPlugin\\Api\\Mapper\\PostContentMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PostContentMapper.php',
    271306        'AppfulPlugin\\Api\\Mapper\\PostMapper' => __DIR__ . '/../..' . '/../includes/api/mapper/PostMapper.php',
     
    295330        'AppfulPlugin\\Domain\\Page' => __DIR__ . '/../..' . '/../includes/domain/Page.php',
    296331        'AppfulPlugin\\Domain\\PageContent' => __DIR__ . '/../..' . '/../includes/domain/PageContent.php',
     332        'AppfulPlugin\\Domain\\PointOfInterest\\PointOfInterest' => __DIR__ . '/../..' . '/../includes/domain/point_of_interest/PointOfInterest.php',
     333        'AppfulPlugin\\Domain\\PointOfInterest\\PostPointOfInterest' => __DIR__ . '/../..' . '/../includes/domain/point_of_interest/PostPointOfInterest.php',
    297334        'AppfulPlugin\\Domain\\Post' => __DIR__ . '/../..' . '/../includes/domain/Post.php',
    298335        'AppfulPlugin\\Domain\\PostContent' => __DIR__ . '/../..' . '/../includes/domain/PostContent.php',
     
    324361        'AppfulPlugin\\Menu\\Menu' => __DIR__ . '/../..' . '/../includes/menu/Menu.php',
    325362        'AppfulPlugin\\Notice\\Notice' => __DIR__ . '/../..' . '/../includes/notice/Notice.php',
     363        'AppfulPlugin\\PostForm\\PostForm' => __DIR__ . '/../..' . '/../includes/post_form/PostForm.php',
    326364        'AppfulPlugin\\TermForm\\TermForm' => __DIR__ . '/../..' . '/../includes/term_form/TermForm.php',
    327365        'AppfulPlugin\\UseCases\\AppSettings\\AppSettingsUseCaseManager' => __DIR__ . '/../..' . '/../includes/use_cases/app_settings/AppSettingsUseCaseManager.php',
     
    366404        'AppfulPlugin\\UseCases\\Page\\PageUseCaseManager' => __DIR__ . '/../..' . '/../includes/use_cases/page/PageUseCaseManager.php',
    367405        'AppfulPlugin\\UseCases\\Page\\PullLocalPageContentUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/page/PullLocalPageContentUseCase.php',
     406        'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemUseCase.php',
     407        'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointOfInterestSyncItemsUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/GetPointOfInterestSyncItemsUseCase.php',
     408        'AppfulPlugin\\UseCases\\PointOfInterest\\GetPointsOfInterestByIdUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/GetPointsOfInterestByIdUseCase.php',
     409        'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/PointOfInterestDeleteUseCase.php',
     410        'AppfulPlugin\\UseCases\\PointOfInterest\\PointOfInterestUseCaseManager' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/PointOfInterestUseCaseManager.php',
     411        'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestChunkSyncUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SendPointOfInterestChunkSyncUseCase.php',
     412        'AppfulPlugin\\UseCases\\PointOfInterest\\SendPointOfInterestSyncUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SendPointOfInterestSyncUseCase.php',
     413        'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointOfInterestUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SyncPointOfInterestUseCase.php',
     414        'AppfulPlugin\\UseCases\\PointOfInterest\\SyncPointsOfInterestUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/point_of_interest/SyncPointsOfInterestUseCase.php',
    368415        'AppfulPlugin\\UseCases\\PostDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/PostDeleteUseCase.php',
    369416        'AppfulPlugin\\UseCases\\Post\\GetPostSyncBatchSizeUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/post/GetPostSyncBatchSizeUseCase.php',
     
    400447        'AppfulPlugin\\UseCases\\UserDeleteUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/UserDeleteUseCase.php',
    401448        'AppfulPlugin\\UseCases\\UserSaveUseCase' => __DIR__ . '/../..' . '/../includes/use_cases/UserSaveUseCase.php',
     449        'AppfulPlugin\\Wp\\Entities\\PostCoordinatesEntity' => __DIR__ . '/../..' . '/../includes/wp/entities/PostCoordinatesEntity.php',
    402450        'AppfulPlugin\\Wp\\Mapper\\AttachmentMapper' => __DIR__ . '/../..' . '/../includes/wp/mapper/AttachmentMapper.php',
    403451        'AppfulPlugin\\Wp\\Mapper\\CategoryMapper' => __DIR__ . '/../..' . '/../includes/wp/mapper/CategoryMapper.php',
  • appful-app/trunk/lib/vendor/composer/installed.php

    r3028218 r3043568  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '8a33ea6e2270e3e3016ee76d676b39b857c3c1f9',
     6        'reference' => '6f0d2c0f0f21f2ca2550d7a07d32827d416dc20c',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '8a33ea6e2270e3e3016ee76d676b39b857c3c1f9',
     16            'reference' => '6f0d2c0f0f21f2ca2550d7a07d32827d416dc20c',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • appful-app/trunk/readme.txt

    r3039311 r3043568  
    66Tested up to: 6.4
    77Requires PHP: 7.4
    8 Stable tag: 3.1.22
     8Stable tag: 3.1.23
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.