Completed
Push — develop ( 6c25be...f52da8 )
by David
01:25 queued 37s
created
src/includes/class-wordlift.php 2 patches
Spacing   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -639,13 +639,13 @@  discard block
 block discarded – undo
639 639
 		$this->set_locale();
640 640
 
641 641
 		$that = $this;
642
-		add_action( 'plugins_loaded', function () use ( $that ) {
643
-			$that->define_admin_hooks( $that );
644
-			$that->define_public_hooks( $that );
645
-		}, 4 );
642
+		add_action('plugins_loaded', function() use ($that) {
643
+			$that->define_admin_hooks($that);
644
+			$that->define_public_hooks($that);
645
+		}, 4);
646 646
 
647 647
 		// If we're in `WP_CLI` load the related files.
648
-		if ( class_exists( 'WP_CLI' ) ) {
648
+		if (class_exists('WP_CLI')) {
649 649
 			$this->load_cli_dependencies();
650 650
 		}
651 651
 
@@ -686,328 +686,328 @@  discard block
 block discarded – undo
686 686
 		 * The class responsible for orchestrating the actions and filters of the
687 687
 		 * core plugin.
688 688
 		 */
689
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
689
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
690 690
 
691 691
 		// The class responsible for plugin uninstall.
692
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
692
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php';
693 693
 
694 694
 		/**
695 695
 		 * The class responsible for defining internationalization functionality
696 696
 		 * of the plugin.
697 697
 		 */
698
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
698
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
699 699
 
700 700
 		/**
701 701
 		 * WordLift's supported languages.
702 702
 		 */
703
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
703
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
704 704
 
705 705
 		/**
706 706
 		 * WordLift's supported countries.
707 707
 		 */
708
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
708
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php';
709 709
 
710 710
 		/**
711 711
 		 * Provide support functions to sanitize data.
712 712
 		 */
713
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
713
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
714 714
 
715 715
 		/** Services. */
716
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
717
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
718
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
720
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
721
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
722
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
724
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
716
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
717
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php';
718
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
719
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
720
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
721
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
722
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
723
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php';
724
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php';
725 725
 
726 726
 		/**
727 727
 		 * The Schema service.
728 728
 		 */
729
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
729
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
730 730
 
731 731
 		/**
732 732
 		 * The schema:url property service.
733 733
 		 */
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
735
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
734
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
735
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
736 736
 
737 737
 		/**
738 738
 		 * The UI service.
739 739
 		 */
740
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
740
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
741 741
 
742 742
 		/**
743 743
 		 * The Entity Types Taxonomy service.
744 744
 		 */
745
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
745
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php';
746 746
 
747 747
 		/**
748 748
 		 * The Entity service.
749 749
 		 */
750
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
751
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
750
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php';
751
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
752 752
 
753 753
 		// Add the entity rating service.
754
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
754
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
755 755
 
756 756
 		/**
757 757
 		 * The User service.
758 758
 		 */
759
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
759
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
760 760
 
761 761
 		/**
762 762
 		 * The Timeline service.
763 763
 		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
764
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
765 765
 
766 766
 		/**
767 767
 		 * The Topic Taxonomy service.
768 768
 		 */
769
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
769
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
770 770
 
771 771
 		/**
772 772
 		 * The WordLift URI service.
773 773
 		 */
774
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
775
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
776
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
774
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
775
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
776
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php';
777 777
 
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
779
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
778
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
779
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
780 780
 
781 781
 		/**
782 782
 		 * Load the converters.
783 783
 		 */
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
785
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
784
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
785
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
786
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
788
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
789
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
790 790
 
791 791
 		/**
792 792
 		 * Load cache-related files.
793 793
 		 */
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
794
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php';
795 795
 
796 796
 		/**
797 797
 		 * Load the content filter.
798 798
 		 */
799
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
799
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
800 800
 
801 801
 		/*
802 802
 		 * Load the excerpt helper.
803 803
 		 */
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
804
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
805 805
 
806 806
 		/**
807 807
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
808 808
 		 *
809 809
 		 * @since 3.8.0
810 810
 		 */
811
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
811
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
812 812
 
813 813
 		// The Publisher Service and the AJAX adapter.
814
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
814
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
815
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
816 816
 
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
817
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
818 818
 
819 819
 		/**
820 820
 		 * Load the WordLift key validation service.
821 821
 		 */
822
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
822
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
823 823
 
824 824
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
825
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
826 826
 
827 827
 		// Load the `Wordlift_Entity_Page_Service` class definition.
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
828
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php';
829 829
 
830 830
 		/** Linked Data. */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
834
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
836
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
837
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
839
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
841
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
831
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php';
832
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
833
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php';
834
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
835
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
836
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php';
837
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
838
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php';
839
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php';
840
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php';
841
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php';
842 842
 
843 843
 		/** Services. */
844
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
844
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php';
845
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php';
846 846
 
847 847
 		/** Adapters. */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
849
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
851
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
848
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
849
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
850
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php';
851
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php';
852
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php';
853 853
 
854 854
 		/** Autocomplete. */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
855
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php';
856 856
 
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
857
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php';
858 858
 
859 859
 		/** Analytics */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
860
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php';
861 861
 
862 862
 		/**
863 863
 		 * The class responsible for defining all actions that occur in the admin area.
864 864
 		 */
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
865
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
866 866
 
867 867
 		/**
868 868
 		 * The class to customize the entity list admin page.
869 869
 		 */
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
870
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
871 871
 
872 872
 		/**
873 873
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
874 874
 		 */
875 875
 		global $wp_version;
876
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
877
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
876
+		if (version_compare($wp_version, '5.3', '<')) {
877
+			require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
878 878
 		} else {
879
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
879
+			require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
880 880
 		}
881 881
 
882 882
 		/**
883 883
 		 * The Notice service.
884 884
 		 */
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
885
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
886 886
 
887 887
 		/**
888 888
 		 * The PrimaShop adapter.
889 889
 		 */
890
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
890
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
891 891
 
892 892
 		/**
893 893
 		 * The WordLift Dashboard service.
894 894
 		 */
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
895
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
896 896
 
897 897
 		/**
898 898
 		 * The admin 'Install wizard' page.
899 899
 		 */
900
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
900
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
901 901
 
902 902
 		/**
903 903
 		 * The WordLift entity type list admin page controller.
904 904
 		 */
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
905
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
906 906
 
907 907
 		/**
908 908
 		 * The WordLift entity type settings admin page controller.
909 909
 		 */
910
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
910
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
911 911
 
912 912
 		/**
913 913
 		 * The admin 'Download Your Data' page.
914 914
 		 */
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
915
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
916 916
 
917 917
 		/**
918 918
 		 * The admin 'WordLift Settings' page.
919 919
 		 */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
923
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
924
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
926
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
929
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
931
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
934
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
920
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php';
921
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php';
922
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php';
923
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php';
924
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php';
925
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php';
926
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php';
927
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php';
928
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php';
929
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php';
930
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
931
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
932
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php';
933
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
934
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
935 935
 
936 936
 		/** Admin Pages */
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
937
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
938
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php';
939 939
 
940 940
 		/**
941 941
 		 * The class responsible for defining all actions that occur in the public-facing
942 942
 		 * side of the site.
943 943
 		 */
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
944
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
945 945
 
946 946
 		/**
947 947
 		 * The shortcode abstract class.
948 948
 		 */
949
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
949
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
950 950
 
951 951
 		/**
952 952
 		 * The Timeline shortcode.
953 953
 		 */
954
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
954
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
955 955
 
956 956
 		/**
957 957
 		 * The Navigator shortcode.
958 958
 		 */
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
959
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
960 960
 
961 961
 		/**
962 962
 		 * The Products Navigator shortcode.
963 963
 		 */
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
964
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php';
965 965
 
966 966
 		/**
967 967
 		 * The chord shortcode.
968 968
 		 */
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
969
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
970 970
 
971 971
 		/**
972 972
 		 * The geomap shortcode.
973 973
 		 */
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
974
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
975 975
 
976 976
 		/**
977 977
 		 * The entity cloud shortcode.
978 978
 		 */
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
979
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
980 980
 
981 981
 		/**
982 982
 		 * The entity glossary shortcode.
983 983
 		 */
984
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
985
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
984
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php';
985
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php';
986 986
 
987 987
 		/**
988 988
 		 * Faceted Search shortcode.
989 989
 		 */
990
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
990
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php';
991 991
 
992 992
 		/**
993 993
 		 * The ShareThis service.
994 994
 		 */
995
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
995
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
996 996
 
997 997
 		/**
998 998
 		 * The SEO service.
999 999
 		 */
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1000
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
1001 1001
 
1002 1002
 		/**
1003 1003
 		 * The AMP service.
1004 1004
 		 */
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1005
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
1006 1006
 
1007 1007
 		/** Widgets */
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1009
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1008
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
1009
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
1010
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php';
1011 1011
 
1012 1012
 		/*
1013 1013
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
@@ -1016,18 +1016,18 @@  discard block
 block discarded – undo
1016 1016
 		 *
1017 1017
 		 * @since 3.20.0
1018 1018
 		 */
1019
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1020
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1019
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php';
1020
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1021 1021
 
1022 1022
 		/*
1023 1023
 		 * Schema.org Services.
1024 1024
 		 *
1025 1025
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1026 1026
 		 */
1027
-		if ( WL_ALL_ENTITY_TYPES ) {
1028
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1029
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1030
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1027
+		if (WL_ALL_ENTITY_TYPES) {
1028
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1029
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1030
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1031 1031
 			new Wordlift_Schemaorg_Sync_Service();
1032 1032
 			$schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance();
1033 1033
 			new Wordlift_Schemaorg_Class_Service();
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		// Instantiate a global logger.
1045 1045
 		global $wl_logger;
1046
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1046
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
1047 1047
 
1048 1048
 		// Load the `wl-api` end-point.
1049 1049
 		new Wordlift_Http_Api();
1050 1050
 
1051 1051
 		// Load the Install Service.
1052
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1052
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php';
1053 1053
 		$this->install_service = new Wordlift_Install_Service();
1054 1054
 		$this->notice_service  = new Wordlift_Notice_Service();
1055 1055
 		$this->user_service    = Wordlift_User_Service::get_instance();
@@ -1067,21 +1067,21 @@  discard block
 block discarded – undo
1067 1067
 
1068 1068
 
1069 1069
 		$that = $this;
1070
-		add_action( 'plugins_loaded', function () use ( &$that, $schemaorg_property_service ) {
1070
+		add_action('plugins_loaded', function() use (&$that, $schemaorg_property_service) {
1071 1071
 
1072 1072
 			/** Services. */
1073 1073
 			// Create the configuration service.
1074 1074
 			$api_service = new Wordlift_Api_Service();
1075 1075
 
1076 1076
 			// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1077
-			$that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() );
1077
+			$that->entity_link_service = new Wordlift_Entity_Link_Service($that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path());
1078 1078
 
1079 1079
 			$schema_url_property_service = new Wordlift_Schema_Url_Property_Service();
1080 1080
 
1081 1081
 			$that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance();
1082 1082
 
1083 1083
 			// Create a new instance of the Redirect service.
1084
-			$that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service );
1084
+			$that->redirect_service = new Wordlift_Redirect_Service($that->entity_uri_service);
1085 1085
 
1086 1086
 			// Create a new instance of the Timeline service and Timeline shortcode.
1087 1087
 			$that->timeline_service = new Wordlift_Timeline_Service();
@@ -1094,30 +1094,30 @@  discard block
 block discarded – undo
1094 1094
 			// Create an instance of the PrimaShop adapter.
1095 1095
 			$that->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1096 1096
 
1097
-			$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1097
+			$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
1098 1098
 
1099 1099
 			// Create the entity rating service.
1100 1100
 			$that->rating_service = Wordlift_Rating_Service::get_instance();
1101 1101
 
1102 1102
 			// Create entity list customization (wp-admin/edit.php).
1103
-			$that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service );
1103
+			$that->entity_list_service = new Wordlift_Entity_List_Service($that->rating_service);
1104 1104
 
1105 1105
 			// Create an instance of the Publisher Service and the AJAX Adapter.
1106 1106
 			$that->publisher_service = Wordlift_Publisher_Service::get_instance();
1107
-			$that->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1108
-			$that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1107
+			$that->property_factory  = new Wordlift_Property_Factory($schema_url_property_service);
1108
+			$that->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1109 1109
 
1110 1110
 			$attachment_service = Wordlift_Attachment_Service::get_instance();
1111 1111
 
1112 1112
 			// Instantiate the JSON-LD service.
1113 1113
 			$property_getter                       = Wordlift_Property_Getter_Factory::create();
1114
-			$that->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service );
1115
-			$that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter );
1116
-			$that->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter );
1117
-			$that->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service );
1114
+			$that->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service);
1115
+			$that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter);
1116
+			$that->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter($that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter);
1117
+			$that->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service);
1118 1118
 
1119
-			$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1120
-			$that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache );
1119
+			$jsonld_cache                            = new Ttl_Cache('jsonld', 86400);
1120
+			$that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($that->postid_to_jsonld_converter, $jsonld_cache);
1121 1121
 			/*
1122 1122
 			 * Load the `Wordlift_Term_JsonLd_Adapter`.
1123 1123
 			 *
@@ -1125,31 +1125,31 @@  discard block
 block discarded – undo
1125 1125
 			 *
1126 1126
 			 * @since 3.20.0
1127 1127
 			 */
1128
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1128
+			require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php';
1129 1129
 
1130
-			$term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter );
1131
-			$that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter );
1130
+			$term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter($that->entity_uri_service, $that->cached_postid_to_jsonld_converter);
1131
+			$that->jsonld_service = new Wordlift_Jsonld_Service(Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter);
1132 1132
 
1133 1133
 			$jsonld_service = new Jsonld_Service(
1134 1134
 				$that->jsonld_service,
1135 1135
 				$term_jsonld_adapter,
1136
-				new Jsonld_User_Service( $that->user_service ) );
1137
-			new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service );
1136
+				new Jsonld_User_Service($that->user_service) );
1137
+			new Jsonld_Endpoint($jsonld_service, $that->entity_uri_service);
1138 1138
 
1139 1139
 			// Prints the JSON-LD in the head.
1140
-			new Jsonld_Adapter( $that->jsonld_service );
1140
+			new Jsonld_Adapter($that->jsonld_service);
1141 1141
 
1142
-			new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service );
1142
+			new Jsonld_By_Id_Endpoint($that->jsonld_service, $that->entity_uri_service);
1143 1143
 
1144 1144
 			$that->key_validation_service = new Wordlift_Key_Validation_Service();
1145 1145
 			$that->content_filter_service = Wordlift_Content_Filter_Service::get_instance();
1146 1146
 			// Creating Faq Content filter service.
1147 1147
 			$that->faq_content_filter_service = new Faq_Content_Filter();
1148 1148
 			$that->sample_data_service        = Wordlift_Sample_Data_Service::get_instance();
1149
-			$that->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service );
1149
+			$that->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter($that->sample_data_service);
1150 1150
 
1151
-			$that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' );
1152
-			$that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' );
1151
+			$that->loader->add_action('enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks');
1152
+			$that->loader->add_action('admin_enqueue_scripts', $that, 'add_wl_enabled_blocks');
1153 1153
 
1154 1154
 			/**
1155 1155
 			 * Filter: wl_feature__enable__blocks.
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
 			 * @return bool
1160 1160
 			 * @since 3.27.6
1161 1161
 			 */
1162
-			if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1162
+			if (apply_filters('wl_feature__enable__blocks', true)) {
1163 1163
 				// Initialize the short-codes.
1164
-				new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1164
+				new Async_Template_Decorator(new Wordlift_Navigator_Shortcode());
1165 1165
 				new Wordlift_Chord_Shortcode();
1166 1166
 				new Wordlift_Geomap_Shortcode();
1167 1167
 				new Wordlift_Timeline_Shortcode();
1168
-				new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() );
1168
+				new Wordlift_Related_Entities_Cloud_Shortcode(Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance());
1169 1169
 				new Wordlift_Vocabulary_Shortcode();
1170
-				new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1170
+				new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode());
1171 1171
 			}
1172 1172
 
1173 1173
 			new Wordlift_Products_Navigator_Shortcode();
@@ -1180,16 +1180,16 @@  discard block
 block discarded – undo
1180 1180
 			new Wordlift_Seo_Service();
1181 1181
 
1182 1182
 			// Initialize the AMP service.
1183
-			new Wordlift_AMP_Service( $that->jsonld_service );
1183
+			new Wordlift_AMP_Service($that->jsonld_service);
1184 1184
 
1185 1185
 			/** Services. */
1186 1186
 			$that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1187 1187
 			new Wordlift_Image_Service();
1188 1188
 
1189 1189
 			/** Adapters. */
1190
-			$that->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() );
1191
-			$that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service );
1192
-			$that->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $that );
1190
+			$that->entity_type_adapter    = new Wordlift_Entity_Type_Adapter(Wordlift_Entity_Type_Service::get_instance());
1191
+			$that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($that->publisher_service);
1192
+			$that->tinymce_adapter        = new Wordlift_Tinymce_Adapter($that);
1193 1193
 
1194 1194
 			/*
1195 1195
 			 * Exclude our public js from WP-Rocket.
@@ -1209,14 +1209,14 @@  discard block
 block discarded – undo
1209 1209
 			$that->language_select_element = new Wordlift_Admin_Language_Select_Element();
1210 1210
 			$that->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1211 1211
 			$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1212
-			$that->publisher_element       = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element );
1213
-			$that->author_element          = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element );
1212
+			$that->publisher_element       = new Wordlift_Admin_Publisher_Element($that->publisher_service, $tabs_element, $that->select2_element);
1213
+			$that->author_element          = new Wordlift_Admin_Author_Element($that->publisher_service, $that->select2_element);
1214 1214
 
1215 1215
 			$that->settings_page             = Wordlift_Admin_Settings_Page::get_instance();
1216
-			$that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page );
1216
+			$that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($that->settings_page);
1217 1217
 
1218
-			$that->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element );
1219
-			$that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page );
1218
+			$that->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page($that->input_element, $that->radio_input_element);
1219
+			$that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($that->analytics_settings_page);
1220 1220
 			$that->analytics_connect                   = new Wordlift_Analytics_Connect();
1221 1221
 
1222 1222
 			// Pages.
@@ -1227,9 +1227,9 @@  discard block
 block discarded – undo
1227 1227
 			 *
1228 1228
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1229 1229
 			 */
1230
-			if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1231
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1232
-				new Wordlift_Admin_Post_Edit_Page( $that );
1230
+			if (apply_filters('wl_can_see_classification_box', true)) {
1231
+				require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
1232
+				new Wordlift_Admin_Post_Edit_Page($that);
1233 1233
 			}
1234 1234
 			new Wordlift_Entity_Type_Admin_Service();
1235 1235
 
@@ -1237,19 +1237,19 @@  discard block
 block discarded – undo
1237 1237
 			$that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1238 1238
 
1239 1239
 			// Create an instance of the install wizard.
1240
-			$that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element );
1240
+			$that->admin_setup = new Wordlift_Admin_Setup($that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element);
1241 1241
 
1242
-			$that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service );
1242
+			$that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($that->entity_post_type_service);
1243 1243
 
1244 1244
 			// User Profile.
1245
-			new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service );
1245
+			new Wordlift_Admin_User_Profile_Page($that->author_element, $that->user_service);
1246 1246
 
1247 1247
 			$that->entity_page_service = new Wordlift_Entity_Page_Service();
1248 1248
 
1249 1249
 			// Load the debug service if WP is in debug mode.
1250
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1251
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1252
-				new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service );
1250
+			if (defined('WP_DEBUG') && WP_DEBUG) {
1251
+				require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1252
+				new Wordlift_Debug_Service(Wordlift_Entity_Service::get_instance(), $uri_service);
1253 1253
 			}
1254 1254
 
1255 1255
 			// Remote Image Service.
@@ -1262,12 +1262,12 @@  discard block
 block discarded – undo
1262 1262
 			 *
1263 1263
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1264 1264
 			 */
1265
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1266
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1267
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1265
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php';
1266
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php';
1267
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1268 1268
 
1269 1269
 			// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1270
-			new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1270
+			new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance()));
1271 1271
 
1272 1272
 			/*
1273 1273
 			 * Load the Mappings JSON-LD post processing.
@@ -1281,11 +1281,11 @@  discard block
 block discarded – undo
1281 1281
 			// Taxonomy term rule validator for validating rules for term pages.
1282 1282
 			new Taxonomy_Term_Rule_Validator();
1283 1283
 			new Post_Taxonomy_Term_Rule_Validator();
1284
-			$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1285
-			$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1286
-			$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1284
+			$rule_validators_registry = new Rule_Validators_Registry($default_rule_validator);
1285
+			$rule_groups_validator    = new Rule_Groups_Validator($rule_validators_registry);
1286
+			$mappings_validator       = new Mappings_Validator($mappings_dbo, $rule_groups_validator);
1287 1287
 
1288
-			new Url_To_Entity_Transform_Function( $that->entity_uri_service );
1288
+			new Url_To_Entity_Transform_Function($that->entity_uri_service);
1289 1289
 			new Taxonomy_To_Terms_Transform_Function();
1290 1290
 			new Post_Id_To_Entity_Transform_Function();
1291 1291
 			$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 			 * Intiailize the acf group data formatter.
1296 1296
 			 */
1297 1297
 			new Acf_Group_Formatter();
1298
-			new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1298
+			new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry);
1299 1299
 
1300 1300
 			/**
1301 1301
 			 * @since 3.26.0
@@ -1313,14 +1313,14 @@  discard block
 block discarded – undo
1313 1313
 			// Call this static method to register FAQ routes to rest api - disabled
1314 1314
 			//Faq_Rest_Controller::register_routes();
1315 1315
 
1316
-			$that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter );
1316
+			$that->storage_factory = new Wordlift_Storage_Factory(Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter);
1317 1317
 
1318 1318
 			/** WL Autocomplete. */
1319
-			$autocomplete_service       = new All_Autocomplete_Service( array(
1319
+			$autocomplete_service = new All_Autocomplete_Service(array(
1320 1320
 				new Local_Autocomplete_Service(),
1321
-				new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ),
1322
-			) );
1323
-			$that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1321
+				new Linked_Data_Autocomplete_Service(Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance()),
1322
+			));
1323
+			$that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service);
1324 1324
 
1325 1325
 			/**
1326 1326
 			 * @since 3.27.2
@@ -1329,10 +1329,10 @@  discard block
 block discarded – undo
1329 1329
 			 */
1330 1330
 			new Recipe_Maker_Post_Type_Hook();
1331 1331
 			$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1332
-			new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1333
-			new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1334
-			new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service );
1335
-			new Recipe_Maker_Warning( $recipe_maker_validation_service );
1332
+			new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service);
1333
+			new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service);
1334
+			new Recipe_Maker_Jsonld_Swap($recipe_maker_validation_service, $that->jsonld_service);
1335
+			new Recipe_Maker_Warning($recipe_maker_validation_service);
1336 1336
 
1337 1337
 
1338 1338
 			/**
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 			 * @since 3.27.8
1351 1351
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1352 1352
 			 */
1353
-			new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() );
1353
+			new Key_Validation_Notice($that->key_validation_service, Wordlift_Configuration_Service::get_instance());
1354 1354
 			/**
1355 1355
 			 * @since 3.28.0
1356 1356
 			 * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 			 * @since 3.29.0
1362 1362
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1363 1363
 			 */
1364
-			new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() );
1364
+			new Entity_Rest_Service(Wordlift_Entity_Type_Service::get_instance());
1365 1365
 
1366 1366
 			/**
1367 1367
 			 * Expand author in to references.
@@ -1370,12 +1370,12 @@  discard block
 block discarded – undo
1370 1370
 			 */
1371 1371
 
1372 1372
 
1373
-			if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1374
-				new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1373
+			if (apply_filters('wl_feature__enable__article-wrapper', false)) {
1374
+				new Jsonld_Article_Wrapper(Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter);
1375 1375
 			}
1376 1376
 
1377 1377
 
1378
-			if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1378
+			if (apply_filters('wl_feature__enable__match-terms', false)) {
1379 1379
 				$vocabulary_loader = new Vocabulary_Loader();
1380 1380
 				$vocabulary_loader->init_vocabulary();
1381 1381
 			}
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 			/**
1384 1384
 			 *Added for feature request 1496 (Webhooks)
1385 1385
 			 */
1386
-			if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) {
1386
+			if (apply_filters('wl_feature__enable__webhooks', false)) {
1387 1387
 				$that->webhook_loader = new Webhooks_Loader();
1388 1388
 				$that->webhook_loader->init();
1389 1389
 			}
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 			 * @since 3.31.5
1413 1413
 			 * Create configuration endpoint for webapp to configure.
1414 1414
 			 */
1415
-			new Config( $that->admin_setup, $that->key_validation_service );
1415
+			new Config($that->admin_setup, $that->key_validation_service);
1416 1416
 			/**
1417 1417
 			 * @since 3.31.7
1418 1418
 			 * Remove duplicate videoobject.
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 			 * @since 3.32.0
1425 1425
 			 * Create loader for vocabulary terms.
1426 1426
 			 */
1427
-			$vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter );
1427
+			$vocabulary_terms_loader = new Vocabulary_Terms_Loader(Wordlift_Entity_Type_Service::get_instance(), $property_getter);
1428 1428
 			$vocabulary_terms_loader->init_feature();
1429 1429
 
1430 1430
 			new Entity_Type_Change_Handler(
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 				Wordlift_Entity_Type_Service::get_instance()
1433 1433
 			);
1434 1434
 
1435
-		}, 3 );
1435
+		}, 3);
1436 1436
 
1437 1437
 
1438 1438
 		new Entity_Type_Setter();
@@ -1452,9 +1452,9 @@  discard block
 block discarded – undo
1452 1452
 	private function set_locale() {
1453 1453
 
1454 1454
 		$plugin_i18n = new Wordlift_i18n();
1455
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1455
+		$plugin_i18n->set_domain($this->get_plugin_name());
1456 1456
 
1457
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1457
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1458 1458
 
1459 1459
 	}
1460 1460
 
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 	 * @since    1.0.0
1466 1466
 	 * @access   private
1467 1467
 	 */
1468
-	private function define_admin_hooks( $that ) {
1468
+	private function define_admin_hooks($that) {
1469 1469
 		$plugin_admin = new
1470 1470
 		Wordlift_Admin(
1471 1471
 			$that->get_plugin_name(),
@@ -1474,64 +1474,64 @@  discard block
 block discarded – undo
1474 1474
 			$that->user_service
1475 1475
 		);
1476 1476
 
1477
-		$that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1478
-		$that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1477
+		$that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1478
+		$that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11);
1479 1479
 
1480 1480
 		// Hook the `admin_init` function to the Admin Setup.
1481
-		Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' );
1482
-		$that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' );
1481
+		Assertions::is_set($that->admin_setup, '`admin_setup` must be set');
1482
+		$that->loader->add_action('admin_init', $that->admin_setup, 'admin_init');
1483 1483
 
1484 1484
 		// Hook the admin_init to the settings page.
1485
-		Assertions::is_set( $that->settings_page, '`setting_page` must be set' );
1486
-		$that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' );
1485
+		Assertions::is_set($that->settings_page, '`setting_page` must be set');
1486
+		$that->loader->add_action('admin_init', $that->settings_page, 'admin_init');
1487 1487
 
1488 1488
 		// Hook the admin_init to the analytics settings page.
1489
-		Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' );
1490
-		$that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' );
1489
+		Assertions::is_set($that->analytics_settings_page, '`analytics_setting_page` must be set');
1490
+		$that->loader->add_action('admin_init', $that->analytics_settings_page, 'admin_init');
1491 1491
 
1492 1492
 		// Hook the init action to taxonomy services.
1493
-		$that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 );
1494
-		$that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 );
1493
+		$that->loader->add_action('init', $that->topic_taxonomy_service, 'init', 0);
1494
+		$that->loader->add_action('init', $that->entity_types_taxonomy_service, 'init', 0);
1495 1495
 
1496 1496
 		// Hook the AJAX wl_timeline action to the Timeline service.
1497
-		$that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' );
1497
+		$that->loader->add_action('wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline');
1498 1498
 
1499 1499
 		// Register custom allowed redirect hosts.
1500
-		$that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' );
1500
+		$that->loader->add_filter('allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts');
1501 1501
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1502
-		$that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' );
1502
+		$that->loader->add_action('wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect');
1503 1503
 
1504 1504
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1505 1505
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1506
-		$that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3 );
1507
-		$that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 );
1506
+		$that->loader->add_action('save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3);
1507
+		$that->loader->add_action('save_post', $that->rating_service, 'set_rating_for', 20, 1);
1508 1508
 
1509
-		$that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 );
1510
-		$that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' );
1509
+		$that->loader->add_action('edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1);
1510
+		$that->loader->add_action('in_admin_header', $that->rating_service, 'in_admin_header');
1511 1511
 
1512 1512
 		// Entity listing customization (wp-admin/edit.php)
1513 1513
 		// Add custom columns.
1514
-		$that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' );
1514
+		$that->loader->add_filter('manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns');
1515 1515
 		// no explicit entity as it prevents handling of other post types.
1516
-		$that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 );
1516
+		$that->loader->add_filter('manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2);
1517 1517
 		// Add 4W selection.
1518
-		$that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' );
1519
-		$that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' );
1520
-		$that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' );
1521
-		$that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' );
1518
+		$that->loader->add_action('restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope');
1519
+		$that->loader->add_filter('posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope');
1520
+		$that->loader->add_action('pre_get_posts', $that->entity_list_service, 'pre_get_posts');
1521
+		$that->loader->add_action('load-edit.php', $that->entity_list_service, 'load_edit');
1522 1522
 
1523 1523
 		/*
1524 1524
 		 * If `All Entity Types` is disable, use the radio button Walker.
1525 1525
 		 *
1526 1526
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1527 1527
 		 */
1528
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1529
-			$that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' );
1528
+		if ( ! WL_ALL_ENTITY_TYPES) {
1529
+			$that->loader->add_filter('wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args');
1530 1530
 		}
1531 1531
 
1532 1532
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1533 1533
 		// entities.
1534
-		$that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1534
+		$that->loader->add_filter('prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1535 1535
 
1536 1536
 		/**
1537 1537
 		 * Filter: wl_feature__enable__settings-download.
@@ -1541,27 +1541,27 @@  discard block
 block discarded – undo
1541 1541
 		 * @return bool
1542 1542
 		 * @since 3.27.6
1543 1543
 		 */
1544
-		$that->features_registry->register_feature_from_slug( 'settings-download', true, array(
1544
+		$that->features_registry->register_feature_from_slug('settings-download', true, array(
1545 1545
 			$that,
1546 1546
 			'register_screens'
1547
-		) );
1547
+		));
1548 1548
 
1549 1549
 
1550 1550
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1551
-		$that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 );
1551
+		$that->loader->add_action('wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10);
1552 1552
 
1553 1553
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1554
-		$that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' );
1555
-		$that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' );
1556
-		$that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' );
1554
+		$that->loader->add_action('wp_ajax_wl_jsonld', $that->jsonld_service, 'get');
1555
+		$that->loader->add_action('admin_post_wl_jsonld', $that->jsonld_service, 'get');
1556
+		$that->loader->add_action('admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get');
1557 1557
 
1558 1558
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1559
-		$that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' );
1559
+		$that->loader->add_action('wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key');
1560 1560
 
1561 1561
 		// Hook the AJAX wl_update_country_options action to the countries.
1562
-		$that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' );
1562
+		$that->loader->add_action('wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html');
1563 1563
 
1564
-		$that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' );
1564
+		$that->loader->add_filter('admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction');
1565 1565
 
1566 1566
 		// Hook the menu creation on the general wordlift menu creation.
1567 1567
 		/**
@@ -1574,16 +1574,16 @@  discard block
 block discarded – undo
1574 1574
 		 *
1575 1575
 		 * Since 3.30.0 this feature is registered using registry.
1576 1576
 		 */
1577
-		if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1578
-			add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1577
+		if (apply_filters('wl_feature__enable__settings-screen', true) || Admin_User_Option::is_wordlift_admin()) {
1578
+			add_action('wl_admin_menu', array($that->settings_page, 'admin_menu'), 10, 2);
1579 1579
 		}
1580 1580
 
1581 1581
 		// Hook key update.
1582
-		$that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 );
1583
-		$that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 );
1582
+		$that->loader->add_action('pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2);
1583
+		$that->loader->add_action('update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2);
1584 1584
 
1585 1585
 		// Add additional action links to the WordLift plugin in the plugins page.
1586
-		$that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 );
1586
+		$that->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1);
1587 1587
 
1588 1588
 		/*
1589 1589
 		 * Remove the Analytics Settings link from the plugin page.
@@ -1594,23 +1594,23 @@  discard block
 block discarded – undo
1594 1594
 		// $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 );
1595 1595
 
1596 1596
 		// Hook the AJAX `wl_publisher` action name.
1597
-		$that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' );
1597
+		$that->loader->add_action('wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher');
1598 1598
 
1599 1599
 		// Hook row actions for the entity type list admin.
1600
-		$that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1600
+		$that->loader->add_filter('wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1601 1601
 
1602 1602
 		/** Ajax actions. */
1603
-		$that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' );
1603
+		$that->loader->add_action('wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export');
1604 1604
 
1605 1605
 		// Hook capabilities manipulation to allow access to entity type admin
1606 1606
 		// page  on WordPress versions before 4.7.
1607 1607
 		global $wp_version;
1608
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1609
-			$that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1608
+		if (version_compare($wp_version, '4.7', '<')) {
1609
+			$that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1610 1610
 		}
1611 1611
 
1612 1612
 		/** Adapters. */
1613
-		$that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1613
+		$that->loader->add_filter('mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1);
1614 1614
 		/**
1615 1615
 		 * Disabling Faq temporarily.
1616 1616
 		 * Load the tinymce editor button on the tool bar.
@@ -1621,54 +1621,54 @@  discard block
 block discarded – undo
1621 1621
 		//$that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1622 1622
 
1623 1623
 
1624
-		$that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' );
1625
-		$that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' );
1624
+		$that->loader->add_action('wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create');
1625
+		$that->loader->add_action('wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete');
1626 1626
 
1627 1627
 		/**
1628 1628
 		 * @since 3.26.0
1629 1629
 		 */
1630 1630
 		$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1631
-		$that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1631
+		$that->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box');
1632 1632
 		// Adding Rest route for the post excerpt
1633 1633
 		Post_Excerpt_Rest_Controller::register_routes();
1634 1634
 
1635 1635
 		// Handle the autocomplete request.
1636
-		add_action( 'wp_ajax_wl_autocomplete', array(
1636
+		add_action('wp_ajax_wl_autocomplete', array(
1637 1637
 			$that->autocomplete_adapter,
1638 1638
 			'wl_autocomplete',
1639
-		) );
1640
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1639
+		));
1640
+		add_action('wp_ajax_nopriv_wl_autocomplete', array(
1641 1641
 			$that->autocomplete_adapter,
1642 1642
 			'wl_autocomplete',
1643
-		) );
1643
+		));
1644 1644
 
1645 1645
 		// Hooks to restrict multisite super admin from manipulating entity types.
1646
-		if ( is_multisite() ) {
1647
-			$that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1646
+		if (is_multisite()) {
1647
+			$that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1648 1648
 		}
1649 1649
 
1650 1650
 		$deactivator_feedback = new Wordlift_Deactivator_Feedback();
1651 1651
 
1652
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1653
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1654
-		add_action( 'wp_ajax_wl_deactivation_feedback', array(
1652
+		add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup'));
1653
+		add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts'));
1654
+		add_action('wp_ajax_wl_deactivation_feedback', array(
1655 1655
 			$deactivator_feedback,
1656 1656
 			'wl_deactivation_feedback'
1657
-		) );
1657
+		));
1658 1658
 
1659 1659
 		/**
1660 1660
 		 * Always allow the `wordlift/classification` block.
1661 1661
 		 *
1662 1662
 		 * @since 3.23.0
1663 1663
 		 */
1664
-		add_filter( 'allowed_block_types', function ( $value ) {
1664
+		add_filter('allowed_block_types', function($value) {
1665 1665
 
1666
-			if ( true === $value ) {
1666
+			if (true === $value) {
1667 1667
 				return $value;
1668 1668
 			}
1669 1669
 
1670
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1671
-		}, PHP_INT_MAX );
1670
+			return array_merge((array) $value, array('wordlift/classification'));
1671
+		}, PHP_INT_MAX);
1672 1672
 
1673 1673
 		/**
1674 1674
 		 * @since 3.27.7
@@ -1685,58 +1685,58 @@  discard block
 block discarded – undo
1685 1685
 	 * @since    1.0.0
1686 1686
 	 * @access   private
1687 1687
 	 */
1688
-	private function define_public_hooks( $that ) {
1688
+	private function define_public_hooks($that) {
1689 1689
 
1690
-		$plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() );
1690
+		$plugin_public = new Wordlift_Public($that->get_plugin_name(), $that->get_version());
1691 1691
 
1692 1692
 		// Register the entity post type.
1693
-		$that->loader->add_action( 'init', $that->entity_post_type_service, 'register' );
1693
+		$that->loader->add_action('init', $that->entity_post_type_service, 'register');
1694 1694
 
1695 1695
 		// Bind the link generation and handling hooks to the entity link service.
1696
-		$that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 4 );
1697
-		$that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1696
+		$that->loader->add_filter('post_type_link', $that->entity_link_service, 'post_type_link', 10, 4);
1697
+		$that->loader->add_action('pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1698 1698
 		// $that->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1699 1699
 		// $that->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1700 1700
 
1701
-		$that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1702
-		$that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1703
-		$that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' );
1701
+		$that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1702
+		$that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1703
+		$that->loader->add_action('wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts');
1704 1704
 
1705 1705
 		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1706
-		$that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1706
+		$that->loader->add_filter('the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags');
1707 1707
 		// Hook the content filter service to add entity links.
1708
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1709
-			$that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content' );
1708
+		if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) {
1709
+			$that->loader->add_filter('the_content', $that->content_filter_service, 'the_content');
1710 1710
 		}
1711 1711
 
1712 1712
 		// Hook the AJAX wl_timeline action to the Timeline service.
1713
-		$that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' );
1713
+		$that->loader->add_action('wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline');
1714 1714
 
1715 1715
 		// Hook the ShareThis service.
1716
-		$that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 );
1717
-		$that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 );
1716
+		$that->loader->add_filter('the_content', $that->sharethis_service, 'the_content', 99);
1717
+		$that->loader->add_filter('the_excerpt', $that->sharethis_service, 'the_excerpt', 99);
1718 1718
 
1719 1719
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1720
-		$that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' );
1720
+		$that->loader->add_action('wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get');
1721 1721
 
1722 1722
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1723 1723
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1724 1724
 		// to categories.
1725
-		$that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1725
+		$that->loader->add_action('pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1);
1726 1726
 
1727 1727
 		/*
1728 1728
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1729 1729
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1730 1730
 		 * order of start time.
1731 1731
 		 */
1732
-		$that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 );
1732
+		$that->loader->add_action('pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1);
1733 1733
 
1734 1734
 		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1735
-		$that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 3 );
1735
+		$that->loader->add_action('save_post', $that->entity_type_adapter, 'save_post', 9, 3);
1736 1736
 
1737 1737
 		// Analytics Script Frontend.
1738
-		if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) {
1739
-			$that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 );
1738
+		if (apply_filters('wl_feature__enable__analytics', true) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable()) {
1739
+			$that->loader->add_action('wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10);
1740 1740
 		}
1741 1741
 
1742 1742
 	}
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
 		 * @since 3.27.6
1802 1802
 		 */
1803 1803
 
1804
-		wp_register_script( 'wl_enabled_blocks', false );
1804
+		wp_register_script('wl_enabled_blocks', false);
1805 1805
 
1806 1806
 		$enabled_blocks = array();
1807 1807
 
@@ -1809,13 +1809,13 @@  discard block
 block discarded – undo
1809 1809
 		 * Filter name: wl_feature__enable__product-navigator
1810 1810
 		 * @since 3.32.3
1811 1811
 		 */
1812
-		if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
1812
+		if (apply_filters('wl_feature__enable__product-navigator', true)) {
1813 1813
 			$enabled_blocks[] = 'wordlift/products-navigator';
1814 1814
 		}
1815 1815
 
1816
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1816
+		if (apply_filters('wl_feature__enable__blocks', true)) {
1817 1817
 			// To intimate JS
1818
-			$enabled_blocks = array_merge( $enabled_blocks, array(
1818
+			$enabled_blocks = array_merge($enabled_blocks, array(
1819 1819
 				'wordlift/navigator',
1820 1820
 				'wordlift/chord',
1821 1821
 				'wordlift/geomap',
@@ -1823,11 +1823,11 @@  discard block
 block discarded – undo
1823 1823
 				'wordlift/cloud',
1824 1824
 				'wordlift/vocabulary',
1825 1825
 				'wordlift/faceted-search'
1826
-			) );
1826
+			));
1827 1827
 		}
1828 1828
 
1829
-		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
1830
-		wp_enqueue_script( 'wl_enabled_blocks' );
1829
+		wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks);
1830
+		wp_enqueue_script('wl_enabled_blocks');
1831 1831
 	}
1832 1832
 
1833 1833
 	/**
@@ -1835,13 +1835,13 @@  discard block
 block discarded – undo
1835 1835
 	 */
1836 1836
 	public function register_screens() {
1837 1837
 		// Hook the menu to the Download Your Data page.
1838
-		if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
1839
-			Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" );
1840
-			add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
1838
+		if (apply_filters('wl_feature__enable__settings-download', true)) {
1839
+			Assertions::is_set($this->download_your_data_page, "`download_your_data_page` can't be null");
1840
+			add_action('admin_menu', array($this->download_your_data_page, 'admin_menu'), 100, 0);
1841 1841
 		}
1842 1842
 
1843
-		Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" );
1844
-		add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
1843
+		Assertions::is_set($this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null");
1844
+		add_action('admin_menu', array($this->entity_type_settings_admin_page, 'admin_menu'), 100, 0);
1845 1845
 
1846 1846
 	}
1847 1847
 
Please login to merge, or discard this patch.
Indentation   +1686 added lines, -1686 removed lines patch added patch discarded remove patch
@@ -82,1767 +82,1767 @@
 block discarded – undo
82 82
  */
83 83
 class Wordlift {
84 84
 
85
-	//<editor-fold desc="## FIELDS">
86
-
87
-	/**
88
-	 * The loader that's responsible for maintaining and registering all hooks that power
89
-	 * the plugin.
90
-	 *
91
-	 * @since    1.0.0
92
-	 * @access   protected
93
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
94
-	 */
95
-	protected $loader;
96
-
97
-	/**
98
-	 * The unique identifier of this plugin.
99
-	 *
100
-	 * @since    1.0.0
101
-	 * @access   protected
102
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
103
-	 */
104
-	protected $plugin_name;
105
-
106
-	/**
107
-	 * The current version of the plugin.
108
-	 *
109
-	 * @since    1.0.0
110
-	 * @access   protected
111
-	 * @var      string $version The current version of the plugin.
112
-	 */
113
-	protected $version;
114
-
115
-	/**
116
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
117
-	 *
118
-	 * @since  3.12.0
119
-	 * @access protected
120
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
121
-	 */
122
-	protected $tinymce_adapter;
123
-
124
-	/**
125
-	 * The Schema service.
126
-	 *
127
-	 * @since  3.3.0
128
-	 * @access protected
129
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
130
-	 */
131
-	protected $schema_service;
132
-
133
-	/**
134
-	 * The Topic Taxonomy service.
135
-	 *
136
-	 * @since  3.5.0
137
-	 * @access private
138
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
139
-	 */
140
-	private $topic_taxonomy_service;
141
-
142
-	/**
143
-	 * The Entity Types Taxonomy service.
144
-	 *
145
-	 * @since  3.18.0
146
-	 * @access private
147
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
148
-	 */
149
-	private $entity_types_taxonomy_service;
150
-
151
-	/**
152
-	 * The User service.
153
-	 *
154
-	 * @since  3.1.7
155
-	 * @access protected
156
-	 * @var \Wordlift_User_Service $user_service The User service.
157
-	 */
158
-	protected $user_service;
159
-
160
-	/**
161
-	 * The Timeline service.
162
-	 *
163
-	 * @since  3.1.0
164
-	 * @access private
165
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
166
-	 */
167
-	private $timeline_service;
168
-
169
-	/**
170
-	 * The Redirect service.
171
-	 *
172
-	 * @since  3.2.0
173
-	 * @access private
174
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
175
-	 */
176
-	private $redirect_service;
177
-
178
-	/**
179
-	 * The Notice service.
180
-	 *
181
-	 * @since  3.3.0
182
-	 * @access private
183
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
184
-	 */
185
-	private $notice_service;
186
-
187
-	/**
188
-	 * The Entity list customization.
189
-	 *
190
-	 * @since  3.3.0
191
-	 * @access protected
192
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
193
-	 */
194
-	protected $entity_list_service;
195
-
196
-	/**
197
-	 * The Entity Types Taxonomy Walker.
198
-	 *
199
-	 * @since  3.1.0
200
-	 * @access private
201
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
202
-	 */
203
-	private $entity_types_taxonomy_walker;
204
-
205
-	/**
206
-	 * The ShareThis service.
207
-	 *
208
-	 * @since  3.2.0
209
-	 * @access private
210
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
211
-	 */
212
-	private $sharethis_service;
213
-
214
-	/**
215
-	 * The PrimaShop adapter.
216
-	 *
217
-	 * @since  3.2.3
218
-	 * @access private
219
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
220
-	 */
221
-	private $primashop_adapter;
222
-
223
-	/**
224
-	 * The entity type service.
225
-	 *
226
-	 * @since  3.6.0
227
-	 * @access private
228
-	 * @var \Wordlift_Entity_Post_Type_Service
229
-	 */
230
-	private $entity_post_type_service;
231
-
232
-	/**
233
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
234
-	 *
235
-	 * @since  3.6.0
236
-	 * @access private
237
-	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
238
-	 */
239
-	private $entity_link_service;
240
-
241
-	/**
242
-	 * A {@link Wordlift_Jsonld_Service} instance.
243
-	 *
244
-	 * @since  3.7.0
245
-	 * @access protected
246
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
247
-	 */
248
-	protected $jsonld_service;
249
-
250
-	/**
251
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
252
-	 *
253
-	 * @since  3.14.0
254
-	 * @access protected
255
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
256
-	 */
257
-	protected $jsonld_website_converter;
258
-
259
-	/**
260
-	 * A {@link Wordlift_Property_Factory} instance.
261
-	 *
262
-	 * @since  3.7.0
263
-	 * @access private
264
-	 * @var \Wordlift_Property_Factory $property_factory
265
-	 */
266
-	private $property_factory;
267
-
268
-	/**
269
-	 * The 'Download Your Data' page.
270
-	 *
271
-	 * @since  3.6.0
272
-	 * @access private
273
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
274
-	 */
275
-	private $download_your_data_page;
276
-
277
-	/**
278
-	 * The 'WordLift Settings' page.
279
-	 *
280
-	 * @since  3.11.0
281
-	 * @access protected
282
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
283
-	 */
284
-	protected $settings_page;
285
-
286
-	/**
287
-	 * The install wizard page.
288
-	 *
289
-	 * @since  3.9.0
290
-	 * @access private
291
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
292
-	 */
293
-	public $admin_setup;
294
-
295
-	/**
296
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
297
-	 * linking of entities to their pages.
298
-	 *
299
-	 * @since  3.8.0
300
-	 * @access private
301
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
302
-	 */
303
-	private $content_filter_service;
304
-
305
-	/**
306
-	 * The Faq Content filter service
307
-	 * @since  3.26.0
308
-	 * @access private
309
-	 * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
310
-	 */
311
-	private $faq_content_filter_service;
312
-
313
-	/**
314
-	 * A {@link Wordlift_Key_Validation_Service} instance.
315
-	 *
316
-	 * @since  3.9.0
317
-	 * @access private
318
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
319
-	 */
320
-	private $key_validation_service;
321
-
322
-	/**
323
-	 * A {@link Wordlift_Rating_Service} instance.
324
-	 *
325
-	 * @since  3.10.0
326
-	 * @access private
327
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
328
-	 */
329
-	private $rating_service;
330
-
331
-	/**
332
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
333
-	 *
334
-	 * @since  3.10.0
335
-	 * @access protected
336
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
337
-	 */
338
-	protected $post_to_jsonld_converter;
339
-
340
-	/**
341
-	 * A {@link Wordlift_Install_Service} instance.
342
-	 *
343
-	 * @since  3.18.0
344
-	 * @access protected
345
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
346
-	 */
347
-	protected $install_service;
348
-
349
-	/**
350
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
351
-	 *
352
-	 * @since  3.10.0
353
-	 * @access protected
354
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
355
-	 */
356
-	protected $entity_post_to_jsonld_converter;
357
-
358
-	/**
359
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
360
-	 *
361
-	 * @since  3.10.0
362
-	 * @access protected
363
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
364
-	 */
365
-	protected $postid_to_jsonld_converter;
366
-
367
-	/**
368
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
369
-	 *
370
-	 * @since  3.11.0
371
-	 * @access protected
372
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
373
-	 */
374
-	protected $category_taxonomy_service;
375
-
376
-	/**
377
-	 * The {@link Wordlift_Entity_Page_Service} instance.
378
-	 *
379
-	 * @since  3.11.0
380
-	 * @access protected
381
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
382
-	 */
383
-	protected $entity_page_service;
384
-
385
-	/**
386
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
387
-	 *
388
-	 * @since  3.11.0
389
-	 * @access protected
390
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
391
-	 */
392
-	protected $settings_page_action_link;
393
-
394
-	/**
395
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
396
-	 *
397
-	 * @since  3.11.0
398
-	 * @access protected
399
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
400
-	 */
401
-	protected $analytics_settings_page_action_link;
402
-
403
-	/**
404
-	 * The {@link Wordlift_Analytics_Connect} class.
405
-	 *
406
-	 * @since  3.11.0
407
-	 * @access protected
408
-	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
409
-	 */
410
-	protected $analytics_connect;
411
-
412
-	/**
413
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
414
-	 *
415
-	 * @since  3.11.0
416
-	 * @access protected
417
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
418
-	 */
419
-	protected $publisher_ajax_adapter;
420
-
421
-	/**
422
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
423
-	 *
424
-	 * @since  3.11.0
425
-	 * @access protected
426
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
427
-	 */
428
-	protected $input_element;
429
-
430
-	/**
431
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
432
-	 *
433
-	 * @since  3.13.0
434
-	 * @access protected
435
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
436
-	 */
437
-	protected $radio_input_element;
438
-
439
-	/**
440
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
441
-	 *
442
-	 * @since  3.11.0
443
-	 * @access protected
444
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
445
-	 */
446
-	protected $language_select_element;
447
-
448
-	/**
449
-	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
450
-	 *
451
-	 * @since  3.18.0
452
-	 * @access protected
453
-	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
454
-	 */
455
-	protected $country_select_element;
456
-
457
-	/**
458
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
459
-	 *
460
-	 * @since  3.11.0
461
-	 * @access protected
462
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
463
-	 */
464
-	protected $publisher_element;
465
-
466
-	/**
467
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
468
-	 *
469
-	 * @since  3.11.0
470
-	 * @access protected
471
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
472
-	 */
473
-	protected $select2_element;
474
-
475
-	/**
476
-	 * The controller for the entity type list admin page
477
-	 *
478
-	 * @since  3.11.0
479
-	 * @access private
480
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
481
-	 */
482
-	private $entity_type_admin_page;
483
-
484
-	/**
485
-	 * The controller for the entity type settings admin page
486
-	 *
487
-	 * @since  3.11.0
488
-	 * @access private
489
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
490
-	 */
491
-	private $entity_type_settings_admin_page;
492
-
493
-	/**
494
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
495
-	 *
496
-	 * @since  3.11.0
497
-	 * @access protected
498
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
499
-	 */
500
-	protected $related_entities_cloud_widget;
501
-
502
-	/**
503
-	 * The {@link Wordlift_Admin_Author_Element} instance.
504
-	 *
505
-	 * @since  3.14.0
506
-	 * @access protected
507
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
508
-	 */
509
-	protected $author_element;
510
-
511
-	/**
512
-	 * The {@link Wordlift_Sample_Data_Service} instance.
513
-	 *
514
-	 * @since  3.12.0
515
-	 * @access protected
516
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
517
-	 */
518
-	protected $sample_data_service;
519
-
520
-	/**
521
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
522
-	 *
523
-	 * @since  3.12.0
524
-	 * @access protected
525
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
526
-	 */
527
-	protected $sample_data_ajax_adapter;
528
-
529
-	/**
530
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
531
-	 *
532
-	 * @since  3.16.0
533
-	 * @access protected
534
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
535
-	 */
536
-	protected $google_analytics_export_service;
537
-
538
-	/**
539
-	 * {@link Wordlift}'s singleton instance.
540
-	 *
541
-	 * @since  3.15.0
542
-	 * @access protected
543
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
544
-	 */
545
-	protected $entity_type_adapter;
546
-
547
-	/**
548
-	 * The {@link Wordlift_Storage_Factory} instance.
549
-	 *
550
-	 * @since  3.15.0
551
-	 * @access protected
552
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
553
-	 */
554
-	protected $storage_factory;
555
-
556
-	/**
557
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
558
-	 *
559
-	 * @since  3.15.0
560
-	 * @access private
561
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
562
-	 */
563
-	private $autocomplete_adapter;
564
-
565
-	/**
566
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
567
-	 *
568
-	 * @since  3.16.0
569
-	 * @access protected
570
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
571
-	 *
572
-	 */
573
-	protected $cached_postid_to_jsonld_converter;
574
-
575
-	/**
576
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
577
-	 *
578
-	 * @since  3.16.3
579
-	 * @access protected
580
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
581
-	 */
582
-	protected $entity_uri_service;
583
-
584
-	/**
585
-	 * The {@link Wordlift_Publisher_Service} instance.
586
-	 *
587
-	 * @since  3.19.0
588
-	 * @access protected
589
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
590
-	 */
591
-	protected $publisher_service;
592
-
593
-	/**
594
-	 * The {@link Wordlift_Context_Cards_Service} instance.
595
-	 *
596
-	 * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
597
-	 */
598
-	protected $context_cards_service;
599
-
600
-	/**
601
-	 * {@link Wordlift}'s singleton instance.
602
-	 *
603
-	 * @since  3.11.2
604
-	 * @access private
605
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
606
-	 */
607
-	private static $instance;
608
-
609
-	/**
610
-	 * A singleton instance of features registry.
611
-	 * @since 3.30.0
612
-	 * @var Features_Registry
613
-	 */
614
-	private $features_registry;
615
-
616
-	private $analytics_settings_page;
617
-	//</editor-fold>
618
-
619
-	// Experimental code added by Nishit for feature request 1496
620
-	private $webhook_loader;
621
-	// Experimental code ents here
622
-
623
-	/**
624
-	 * Define the core functionality of the plugin.
625
-	 *
626
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
627
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
628
-	 * the public-facing side of the site.
629
-	 *
630
-	 * @since    1.0.0
631
-	 */
632
-	public function __construct() {
633
-
634
-		self::$instance = $this;
635
-
636
-		$this->plugin_name = 'wordlift';
637
-		$this->version     = '3.35.4';
638
-		$this->load_dependencies();
639
-		$this->set_locale();
640
-
641
-		$that = $this;
642
-		add_action( 'plugins_loaded', function () use ( $that ) {
643
-			$that->define_admin_hooks( $that );
644
-			$that->define_public_hooks( $that );
645
-		}, 4 );
646
-
647
-		// If we're in `WP_CLI` load the related files.
648
-		if ( class_exists( 'WP_CLI' ) ) {
649
-			$this->load_cli_dependencies();
650
-		}
651
-
652
-	}
653
-
654
-	/**
655
-	 * Get the singleton instance.
656
-	 *
657
-	 * @return Wordlift The {@link Wordlift} singleton instance.
658
-	 * @since 3.11.2
659
-	 *
660
-	 */
661
-	public static function get_instance() {
662
-
663
-		return self::$instance;
664
-	}
665
-
666
-	/**
667
-	 * Load the required dependencies for this plugin.
668
-	 *
669
-	 * Include the following files that make up the plugin:
670
-	 *
671
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
672
-	 * - Wordlift_i18n. Defines internationalization functionality.
673
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
674
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
675
-	 *
676
-	 * Create an instance of the loader which will be used to register the hooks
677
-	 * with WordPress.
678
-	 *
679
-	 * @throws Exception
680
-	 * @since    1.0.0
681
-	 * @access   private
682
-	 */
683
-	private function load_dependencies() {
684
-
685
-		/**
686
-		 * The class responsible for orchestrating the actions and filters of the
687
-		 * core plugin.
688
-		 */
689
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
690
-
691
-		// The class responsible for plugin uninstall.
692
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
693
-
694
-		/**
695
-		 * The class responsible for defining internationalization functionality
696
-		 * of the plugin.
697
-		 */
698
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
699
-
700
-		/**
701
-		 * WordLift's supported languages.
702
-		 */
703
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
704
-
705
-		/**
706
-		 * WordLift's supported countries.
707
-		 */
708
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
709
-
710
-		/**
711
-		 * Provide support functions to sanitize data.
712
-		 */
713
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
714
-
715
-		/** Services. */
716
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
717
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
718
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
720
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
721
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
722
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
724
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
725
-
726
-		/**
727
-		 * The Schema service.
728
-		 */
729
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
730
-
731
-		/**
732
-		 * The schema:url property service.
733
-		 */
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
735
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
736
-
737
-		/**
738
-		 * The UI service.
739
-		 */
740
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
741
-
742
-		/**
743
-		 * The Entity Types Taxonomy service.
744
-		 */
745
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
746
-
747
-		/**
748
-		 * The Entity service.
749
-		 */
750
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
751
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
752
-
753
-		// Add the entity rating service.
754
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
755
-
756
-		/**
757
-		 * The User service.
758
-		 */
759
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
760
-
761
-		/**
762
-		 * The Timeline service.
763
-		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
765
-
766
-		/**
767
-		 * The Topic Taxonomy service.
768
-		 */
769
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
770
-
771
-		/**
772
-		 * The WordLift URI service.
773
-		 */
774
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
775
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
776
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
777
-
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
779
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
780
-
781
-		/**
782
-		 * Load the converters.
783
-		 */
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
785
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
790
-
791
-		/**
792
-		 * Load cache-related files.
793
-		 */
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
795
-
796
-		/**
797
-		 * Load the content filter.
798
-		 */
799
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
800
-
801
-		/*
85
+    //<editor-fold desc="## FIELDS">
86
+
87
+    /**
88
+     * The loader that's responsible for maintaining and registering all hooks that power
89
+     * the plugin.
90
+     *
91
+     * @since    1.0.0
92
+     * @access   protected
93
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
94
+     */
95
+    protected $loader;
96
+
97
+    /**
98
+     * The unique identifier of this plugin.
99
+     *
100
+     * @since    1.0.0
101
+     * @access   protected
102
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
103
+     */
104
+    protected $plugin_name;
105
+
106
+    /**
107
+     * The current version of the plugin.
108
+     *
109
+     * @since    1.0.0
110
+     * @access   protected
111
+     * @var      string $version The current version of the plugin.
112
+     */
113
+    protected $version;
114
+
115
+    /**
116
+     * The {@link Wordlift_Tinymce_Adapter} instance.
117
+     *
118
+     * @since  3.12.0
119
+     * @access protected
120
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
121
+     */
122
+    protected $tinymce_adapter;
123
+
124
+    /**
125
+     * The Schema service.
126
+     *
127
+     * @since  3.3.0
128
+     * @access protected
129
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
130
+     */
131
+    protected $schema_service;
132
+
133
+    /**
134
+     * The Topic Taxonomy service.
135
+     *
136
+     * @since  3.5.0
137
+     * @access private
138
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
139
+     */
140
+    private $topic_taxonomy_service;
141
+
142
+    /**
143
+     * The Entity Types Taxonomy service.
144
+     *
145
+     * @since  3.18.0
146
+     * @access private
147
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
148
+     */
149
+    private $entity_types_taxonomy_service;
150
+
151
+    /**
152
+     * The User service.
153
+     *
154
+     * @since  3.1.7
155
+     * @access protected
156
+     * @var \Wordlift_User_Service $user_service The User service.
157
+     */
158
+    protected $user_service;
159
+
160
+    /**
161
+     * The Timeline service.
162
+     *
163
+     * @since  3.1.0
164
+     * @access private
165
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
166
+     */
167
+    private $timeline_service;
168
+
169
+    /**
170
+     * The Redirect service.
171
+     *
172
+     * @since  3.2.0
173
+     * @access private
174
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
175
+     */
176
+    private $redirect_service;
177
+
178
+    /**
179
+     * The Notice service.
180
+     *
181
+     * @since  3.3.0
182
+     * @access private
183
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
184
+     */
185
+    private $notice_service;
186
+
187
+    /**
188
+     * The Entity list customization.
189
+     *
190
+     * @since  3.3.0
191
+     * @access protected
192
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
193
+     */
194
+    protected $entity_list_service;
195
+
196
+    /**
197
+     * The Entity Types Taxonomy Walker.
198
+     *
199
+     * @since  3.1.0
200
+     * @access private
201
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
202
+     */
203
+    private $entity_types_taxonomy_walker;
204
+
205
+    /**
206
+     * The ShareThis service.
207
+     *
208
+     * @since  3.2.0
209
+     * @access private
210
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
211
+     */
212
+    private $sharethis_service;
213
+
214
+    /**
215
+     * The PrimaShop adapter.
216
+     *
217
+     * @since  3.2.3
218
+     * @access private
219
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
220
+     */
221
+    private $primashop_adapter;
222
+
223
+    /**
224
+     * The entity type service.
225
+     *
226
+     * @since  3.6.0
227
+     * @access private
228
+     * @var \Wordlift_Entity_Post_Type_Service
229
+     */
230
+    private $entity_post_type_service;
231
+
232
+    /**
233
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
234
+     *
235
+     * @since  3.6.0
236
+     * @access private
237
+     * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
238
+     */
239
+    private $entity_link_service;
240
+
241
+    /**
242
+     * A {@link Wordlift_Jsonld_Service} instance.
243
+     *
244
+     * @since  3.7.0
245
+     * @access protected
246
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
247
+     */
248
+    protected $jsonld_service;
249
+
250
+    /**
251
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
252
+     *
253
+     * @since  3.14.0
254
+     * @access protected
255
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
256
+     */
257
+    protected $jsonld_website_converter;
258
+
259
+    /**
260
+     * A {@link Wordlift_Property_Factory} instance.
261
+     *
262
+     * @since  3.7.0
263
+     * @access private
264
+     * @var \Wordlift_Property_Factory $property_factory
265
+     */
266
+    private $property_factory;
267
+
268
+    /**
269
+     * The 'Download Your Data' page.
270
+     *
271
+     * @since  3.6.0
272
+     * @access private
273
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
274
+     */
275
+    private $download_your_data_page;
276
+
277
+    /**
278
+     * The 'WordLift Settings' page.
279
+     *
280
+     * @since  3.11.0
281
+     * @access protected
282
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
283
+     */
284
+    protected $settings_page;
285
+
286
+    /**
287
+     * The install wizard page.
288
+     *
289
+     * @since  3.9.0
290
+     * @access private
291
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
292
+     */
293
+    public $admin_setup;
294
+
295
+    /**
296
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
297
+     * linking of entities to their pages.
298
+     *
299
+     * @since  3.8.0
300
+     * @access private
301
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
302
+     */
303
+    private $content_filter_service;
304
+
305
+    /**
306
+     * The Faq Content filter service
307
+     * @since  3.26.0
308
+     * @access private
309
+     * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
310
+     */
311
+    private $faq_content_filter_service;
312
+
313
+    /**
314
+     * A {@link Wordlift_Key_Validation_Service} instance.
315
+     *
316
+     * @since  3.9.0
317
+     * @access private
318
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
319
+     */
320
+    private $key_validation_service;
321
+
322
+    /**
323
+     * A {@link Wordlift_Rating_Service} instance.
324
+     *
325
+     * @since  3.10.0
326
+     * @access private
327
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
328
+     */
329
+    private $rating_service;
330
+
331
+    /**
332
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
333
+     *
334
+     * @since  3.10.0
335
+     * @access protected
336
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
337
+     */
338
+    protected $post_to_jsonld_converter;
339
+
340
+    /**
341
+     * A {@link Wordlift_Install_Service} instance.
342
+     *
343
+     * @since  3.18.0
344
+     * @access protected
345
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
346
+     */
347
+    protected $install_service;
348
+
349
+    /**
350
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
351
+     *
352
+     * @since  3.10.0
353
+     * @access protected
354
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
355
+     */
356
+    protected $entity_post_to_jsonld_converter;
357
+
358
+    /**
359
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
360
+     *
361
+     * @since  3.10.0
362
+     * @access protected
363
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
364
+     */
365
+    protected $postid_to_jsonld_converter;
366
+
367
+    /**
368
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
369
+     *
370
+     * @since  3.11.0
371
+     * @access protected
372
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
373
+     */
374
+    protected $category_taxonomy_service;
375
+
376
+    /**
377
+     * The {@link Wordlift_Entity_Page_Service} instance.
378
+     *
379
+     * @since  3.11.0
380
+     * @access protected
381
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
382
+     */
383
+    protected $entity_page_service;
384
+
385
+    /**
386
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
387
+     *
388
+     * @since  3.11.0
389
+     * @access protected
390
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
391
+     */
392
+    protected $settings_page_action_link;
393
+
394
+    /**
395
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
396
+     *
397
+     * @since  3.11.0
398
+     * @access protected
399
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
400
+     */
401
+    protected $analytics_settings_page_action_link;
402
+
403
+    /**
404
+     * The {@link Wordlift_Analytics_Connect} class.
405
+     *
406
+     * @since  3.11.0
407
+     * @access protected
408
+     * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
409
+     */
410
+    protected $analytics_connect;
411
+
412
+    /**
413
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
414
+     *
415
+     * @since  3.11.0
416
+     * @access protected
417
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
418
+     */
419
+    protected $publisher_ajax_adapter;
420
+
421
+    /**
422
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
423
+     *
424
+     * @since  3.11.0
425
+     * @access protected
426
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
427
+     */
428
+    protected $input_element;
429
+
430
+    /**
431
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
432
+     *
433
+     * @since  3.13.0
434
+     * @access protected
435
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
436
+     */
437
+    protected $radio_input_element;
438
+
439
+    /**
440
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
441
+     *
442
+     * @since  3.11.0
443
+     * @access protected
444
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
445
+     */
446
+    protected $language_select_element;
447
+
448
+    /**
449
+     * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
450
+     *
451
+     * @since  3.18.0
452
+     * @access protected
453
+     * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
454
+     */
455
+    protected $country_select_element;
456
+
457
+    /**
458
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
459
+     *
460
+     * @since  3.11.0
461
+     * @access protected
462
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
463
+     */
464
+    protected $publisher_element;
465
+
466
+    /**
467
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
468
+     *
469
+     * @since  3.11.0
470
+     * @access protected
471
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
472
+     */
473
+    protected $select2_element;
474
+
475
+    /**
476
+     * The controller for the entity type list admin page
477
+     *
478
+     * @since  3.11.0
479
+     * @access private
480
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
481
+     */
482
+    private $entity_type_admin_page;
483
+
484
+    /**
485
+     * The controller for the entity type settings admin page
486
+     *
487
+     * @since  3.11.0
488
+     * @access private
489
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
490
+     */
491
+    private $entity_type_settings_admin_page;
492
+
493
+    /**
494
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
495
+     *
496
+     * @since  3.11.0
497
+     * @access protected
498
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
499
+     */
500
+    protected $related_entities_cloud_widget;
501
+
502
+    /**
503
+     * The {@link Wordlift_Admin_Author_Element} instance.
504
+     *
505
+     * @since  3.14.0
506
+     * @access protected
507
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
508
+     */
509
+    protected $author_element;
510
+
511
+    /**
512
+     * The {@link Wordlift_Sample_Data_Service} instance.
513
+     *
514
+     * @since  3.12.0
515
+     * @access protected
516
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
517
+     */
518
+    protected $sample_data_service;
519
+
520
+    /**
521
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
522
+     *
523
+     * @since  3.12.0
524
+     * @access protected
525
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
526
+     */
527
+    protected $sample_data_ajax_adapter;
528
+
529
+    /**
530
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
531
+     *
532
+     * @since  3.16.0
533
+     * @access protected
534
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
535
+     */
536
+    protected $google_analytics_export_service;
537
+
538
+    /**
539
+     * {@link Wordlift}'s singleton instance.
540
+     *
541
+     * @since  3.15.0
542
+     * @access protected
543
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
544
+     */
545
+    protected $entity_type_adapter;
546
+
547
+    /**
548
+     * The {@link Wordlift_Storage_Factory} instance.
549
+     *
550
+     * @since  3.15.0
551
+     * @access protected
552
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
553
+     */
554
+    protected $storage_factory;
555
+
556
+    /**
557
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
558
+     *
559
+     * @since  3.15.0
560
+     * @access private
561
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
562
+     */
563
+    private $autocomplete_adapter;
564
+
565
+    /**
566
+     * The {@link Wordlift_Cached_Post_Converter} instance.
567
+     *
568
+     * @since  3.16.0
569
+     * @access protected
570
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
571
+     *
572
+     */
573
+    protected $cached_postid_to_jsonld_converter;
574
+
575
+    /**
576
+     * The {@link Wordlift_Entity_Uri_Service} instance.
577
+     *
578
+     * @since  3.16.3
579
+     * @access protected
580
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
581
+     */
582
+    protected $entity_uri_service;
583
+
584
+    /**
585
+     * The {@link Wordlift_Publisher_Service} instance.
586
+     *
587
+     * @since  3.19.0
588
+     * @access protected
589
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
590
+     */
591
+    protected $publisher_service;
592
+
593
+    /**
594
+     * The {@link Wordlift_Context_Cards_Service} instance.
595
+     *
596
+     * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
597
+     */
598
+    protected $context_cards_service;
599
+
600
+    /**
601
+     * {@link Wordlift}'s singleton instance.
602
+     *
603
+     * @since  3.11.2
604
+     * @access private
605
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
606
+     */
607
+    private static $instance;
608
+
609
+    /**
610
+     * A singleton instance of features registry.
611
+     * @since 3.30.0
612
+     * @var Features_Registry
613
+     */
614
+    private $features_registry;
615
+
616
+    private $analytics_settings_page;
617
+    //</editor-fold>
618
+
619
+    // Experimental code added by Nishit for feature request 1496
620
+    private $webhook_loader;
621
+    // Experimental code ents here
622
+
623
+    /**
624
+     * Define the core functionality of the plugin.
625
+     *
626
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
627
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
628
+     * the public-facing side of the site.
629
+     *
630
+     * @since    1.0.0
631
+     */
632
+    public function __construct() {
633
+
634
+        self::$instance = $this;
635
+
636
+        $this->plugin_name = 'wordlift';
637
+        $this->version     = '3.35.4';
638
+        $this->load_dependencies();
639
+        $this->set_locale();
640
+
641
+        $that = $this;
642
+        add_action( 'plugins_loaded', function () use ( $that ) {
643
+            $that->define_admin_hooks( $that );
644
+            $that->define_public_hooks( $that );
645
+        }, 4 );
646
+
647
+        // If we're in `WP_CLI` load the related files.
648
+        if ( class_exists( 'WP_CLI' ) ) {
649
+            $this->load_cli_dependencies();
650
+        }
651
+
652
+    }
653
+
654
+    /**
655
+     * Get the singleton instance.
656
+     *
657
+     * @return Wordlift The {@link Wordlift} singleton instance.
658
+     * @since 3.11.2
659
+     *
660
+     */
661
+    public static function get_instance() {
662
+
663
+        return self::$instance;
664
+    }
665
+
666
+    /**
667
+     * Load the required dependencies for this plugin.
668
+     *
669
+     * Include the following files that make up the plugin:
670
+     *
671
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
672
+     * - Wordlift_i18n. Defines internationalization functionality.
673
+     * - Wordlift_Admin. Defines all hooks for the admin area.
674
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
675
+     *
676
+     * Create an instance of the loader which will be used to register the hooks
677
+     * with WordPress.
678
+     *
679
+     * @throws Exception
680
+     * @since    1.0.0
681
+     * @access   private
682
+     */
683
+    private function load_dependencies() {
684
+
685
+        /**
686
+         * The class responsible for orchestrating the actions and filters of the
687
+         * core plugin.
688
+         */
689
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
690
+
691
+        // The class responsible for plugin uninstall.
692
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
693
+
694
+        /**
695
+         * The class responsible for defining internationalization functionality
696
+         * of the plugin.
697
+         */
698
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
699
+
700
+        /**
701
+         * WordLift's supported languages.
702
+         */
703
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
704
+
705
+        /**
706
+         * WordLift's supported countries.
707
+         */
708
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
709
+
710
+        /**
711
+         * Provide support functions to sanitize data.
712
+         */
713
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
714
+
715
+        /** Services. */
716
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
717
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
718
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
719
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
720
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
721
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
722
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
723
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
724
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
725
+
726
+        /**
727
+         * The Schema service.
728
+         */
729
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
730
+
731
+        /**
732
+         * The schema:url property service.
733
+         */
734
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
735
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
736
+
737
+        /**
738
+         * The UI service.
739
+         */
740
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
741
+
742
+        /**
743
+         * The Entity Types Taxonomy service.
744
+         */
745
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
746
+
747
+        /**
748
+         * The Entity service.
749
+         */
750
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
751
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
752
+
753
+        // Add the entity rating service.
754
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
755
+
756
+        /**
757
+         * The User service.
758
+         */
759
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
760
+
761
+        /**
762
+         * The Timeline service.
763
+         */
764
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
765
+
766
+        /**
767
+         * The Topic Taxonomy service.
768
+         */
769
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
770
+
771
+        /**
772
+         * The WordLift URI service.
773
+         */
774
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
775
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
776
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
777
+
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
779
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
780
+
781
+        /**
782
+         * Load the converters.
783
+         */
784
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
785
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
786
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
790
+
791
+        /**
792
+         * Load cache-related files.
793
+         */
794
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
795
+
796
+        /**
797
+         * Load the content filter.
798
+         */
799
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
800
+
801
+        /*
802 802
 		 * Load the excerpt helper.
803 803
 		 */
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
805
-
806
-		/**
807
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
808
-		 *
809
-		 * @since 3.8.0
810
-		 */
811
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
812
-
813
-		// The Publisher Service and the AJAX adapter.
814
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
816
-
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
818
-
819
-		/**
820
-		 * Load the WordLift key validation service.
821
-		 */
822
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
823
-
824
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
826
-
827
-		// Load the `Wordlift_Entity_Page_Service` class definition.
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
829
-
830
-		/** Linked Data. */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
834
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
836
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
837
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
839
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
841
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
842
-
843
-		/** Services. */
844
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
846
-
847
-		/** Adapters. */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
849
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
851
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
853
-
854
-		/** Autocomplete. */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
856
-
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
858
-
859
-		/** Analytics */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
861
-
862
-		/**
863
-		 * The class responsible for defining all actions that occur in the admin area.
864
-		 */
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
866
-
867
-		/**
868
-		 * The class to customize the entity list admin page.
869
-		 */
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
871
-
872
-		/**
873
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
874
-		 */
875
-		global $wp_version;
876
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
877
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
878
-		} else {
879
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
880
-		}
881
-
882
-		/**
883
-		 * The Notice service.
884
-		 */
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
886
-
887
-		/**
888
-		 * The PrimaShop adapter.
889
-		 */
890
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
891
-
892
-		/**
893
-		 * The WordLift Dashboard service.
894
-		 */
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
896
-
897
-		/**
898
-		 * The admin 'Install wizard' page.
899
-		 */
900
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
901
-
902
-		/**
903
-		 * The WordLift entity type list admin page controller.
904
-		 */
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
906
-
907
-		/**
908
-		 * The WordLift entity type settings admin page controller.
909
-		 */
910
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
911
-
912
-		/**
913
-		 * The admin 'Download Your Data' page.
914
-		 */
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
916
-
917
-		/**
918
-		 * The admin 'WordLift Settings' page.
919
-		 */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
923
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
924
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
926
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
929
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
931
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
934
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
935
-
936
-		/** Admin Pages */
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
939
-
940
-		/**
941
-		 * The class responsible for defining all actions that occur in the public-facing
942
-		 * side of the site.
943
-		 */
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
945
-
946
-		/**
947
-		 * The shortcode abstract class.
948
-		 */
949
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
950
-
951
-		/**
952
-		 * The Timeline shortcode.
953
-		 */
954
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
955
-
956
-		/**
957
-		 * The Navigator shortcode.
958
-		 */
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
960
-
961
-		/**
962
-		 * The Products Navigator shortcode.
963
-		 */
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
965
-
966
-		/**
967
-		 * The chord shortcode.
968
-		 */
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
970
-
971
-		/**
972
-		 * The geomap shortcode.
973
-		 */
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
975
-
976
-		/**
977
-		 * The entity cloud shortcode.
978
-		 */
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
980
-
981
-		/**
982
-		 * The entity glossary shortcode.
983
-		 */
984
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
985
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
986
-
987
-		/**
988
-		 * Faceted Search shortcode.
989
-		 */
990
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
991
-
992
-		/**
993
-		 * The ShareThis service.
994
-		 */
995
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
996
-
997
-		/**
998
-		 * The SEO service.
999
-		 */
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1001
-
1002
-		/**
1003
-		 * The AMP service.
1004
-		 */
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1006
-
1007
-		/** Widgets */
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1009
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1011
-
1012
-		/*
804
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
805
+
806
+        /**
807
+         * Load the JSON-LD service to publish entities using JSON-LD.s
808
+         *
809
+         * @since 3.8.0
810
+         */
811
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
812
+
813
+        // The Publisher Service and the AJAX adapter.
814
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
815
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
816
+
817
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
818
+
819
+        /**
820
+         * Load the WordLift key validation service.
821
+         */
822
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
823
+
824
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
825
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
826
+
827
+        // Load the `Wordlift_Entity_Page_Service` class definition.
828
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
829
+
830
+        /** Linked Data. */
831
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
832
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
833
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
834
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
835
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
836
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
837
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
838
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
839
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
841
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
842
+
843
+        /** Services. */
844
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
846
+
847
+        /** Adapters. */
848
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
849
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
851
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
852
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
853
+
854
+        /** Autocomplete. */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
856
+
857
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
858
+
859
+        /** Analytics */
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
861
+
862
+        /**
863
+         * The class responsible for defining all actions that occur in the admin area.
864
+         */
865
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
866
+
867
+        /**
868
+         * The class to customize the entity list admin page.
869
+         */
870
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
871
+
872
+        /**
873
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
874
+         */
875
+        global $wp_version;
876
+        if ( version_compare( $wp_version, '5.3', '<' ) ) {
877
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
878
+        } else {
879
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
880
+        }
881
+
882
+        /**
883
+         * The Notice service.
884
+         */
885
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
886
+
887
+        /**
888
+         * The PrimaShop adapter.
889
+         */
890
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
891
+
892
+        /**
893
+         * The WordLift Dashboard service.
894
+         */
895
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
896
+
897
+        /**
898
+         * The admin 'Install wizard' page.
899
+         */
900
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
901
+
902
+        /**
903
+         * The WordLift entity type list admin page controller.
904
+         */
905
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
906
+
907
+        /**
908
+         * The WordLift entity type settings admin page controller.
909
+         */
910
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
911
+
912
+        /**
913
+         * The admin 'Download Your Data' page.
914
+         */
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
916
+
917
+        /**
918
+         * The admin 'WordLift Settings' page.
919
+         */
920
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
921
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
922
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
923
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
924
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
925
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
926
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
928
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
929
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
930
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
931
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
932
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
933
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
934
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
935
+
936
+        /** Admin Pages */
937
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
938
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
939
+
940
+        /**
941
+         * The class responsible for defining all actions that occur in the public-facing
942
+         * side of the site.
943
+         */
944
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
945
+
946
+        /**
947
+         * The shortcode abstract class.
948
+         */
949
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
950
+
951
+        /**
952
+         * The Timeline shortcode.
953
+         */
954
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
955
+
956
+        /**
957
+         * The Navigator shortcode.
958
+         */
959
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
960
+
961
+        /**
962
+         * The Products Navigator shortcode.
963
+         */
964
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
965
+
966
+        /**
967
+         * The chord shortcode.
968
+         */
969
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
970
+
971
+        /**
972
+         * The geomap shortcode.
973
+         */
974
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
975
+
976
+        /**
977
+         * The entity cloud shortcode.
978
+         */
979
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
980
+
981
+        /**
982
+         * The entity glossary shortcode.
983
+         */
984
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
985
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
986
+
987
+        /**
988
+         * Faceted Search shortcode.
989
+         */
990
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
991
+
992
+        /**
993
+         * The ShareThis service.
994
+         */
995
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
996
+
997
+        /**
998
+         * The SEO service.
999
+         */
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1001
+
1002
+        /**
1003
+         * The AMP service.
1004
+         */
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1006
+
1007
+        /** Widgets */
1008
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1009
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1010
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1011
+
1012
+        /*
1013 1013
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1014 1014
 		 *
1015 1015
 		 * Eventually Batch Actions will become Batch Operations.
1016 1016
 		 *
1017 1017
 		 * @since 3.20.0
1018 1018
 		 */
1019
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1020
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1019
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1020
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1021 1021
 
1022
-		/*
1022
+        /*
1023 1023
 		 * Schema.org Services.
1024 1024
 		 *
1025 1025
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1026 1026
 		 */
1027
-		if ( WL_ALL_ENTITY_TYPES ) {
1028
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1029
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1030
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1031
-			new Wordlift_Schemaorg_Sync_Service();
1032
-			$schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance();
1033
-			new Wordlift_Schemaorg_Class_Service();
1034
-		} else {
1035
-			$schemaorg_property_service = null;
1036
-		}
1037
-
1038
-		$this->loader = new Wordlift_Loader();
1039
-		/**
1040
-		 * @since 3.30.0
1041
-		 */
1042
-		$this->features_registry = Features_Registry::get_instance();
1043
-
1044
-		// Instantiate a global logger.
1045
-		global $wl_logger;
1046
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1047
-
1048
-		// Load the `wl-api` end-point.
1049
-		new Wordlift_Http_Api();
1050
-
1051
-		// Load the Install Service.
1052
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1053
-		$this->install_service = new Wordlift_Install_Service();
1054
-		$this->notice_service  = new Wordlift_Notice_Service();
1055
-		$this->user_service    = Wordlift_User_Service::get_instance();
1056
-		// create an instance of the entity type list admin page controller.
1057
-		$this->entity_type_admin_page        = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1058
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1059
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1060
-		// Create an entity type service instance. It'll be later bound to the init action.
1061
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(
1062
-			Wordlift_Entity_Service::TYPE_NAME, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() );
1063
-		/* WordPress Admin. */
1064
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page();
1065
-		// create an instance of the entity type setting admin page controller.
1066
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1067
-
1068
-
1069
-		$that = $this;
1070
-		add_action( 'plugins_loaded', function () use ( &$that, $schemaorg_property_service ) {
1071
-
1072
-			/** Services. */
1073
-			// Create the configuration service.
1074
-			$api_service = new Wordlift_Api_Service();
1075
-
1076
-			// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1077
-			$that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() );
1078
-
1079
-			$schema_url_property_service = new Wordlift_Schema_Url_Property_Service();
1080
-
1081
-			$that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance();
1082
-
1083
-			// Create a new instance of the Redirect service.
1084
-			$that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service );
1085
-
1086
-			// Create a new instance of the Timeline service and Timeline shortcode.
1087
-			$that->timeline_service = new Wordlift_Timeline_Service();
1088
-
1089
-			$that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1090
-
1091
-			// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1092
-			$that->sharethis_service = new Wordlift_ShareThis_Service();
1093
-
1094
-			// Create an instance of the PrimaShop adapter.
1095
-			$that->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1096
-
1097
-			$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1098
-
1099
-			// Create the entity rating service.
1100
-			$that->rating_service = Wordlift_Rating_Service::get_instance();
1101
-
1102
-			// Create entity list customization (wp-admin/edit.php).
1103
-			$that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service );
1104
-
1105
-			// Create an instance of the Publisher Service and the AJAX Adapter.
1106
-			$that->publisher_service = Wordlift_Publisher_Service::get_instance();
1107
-			$that->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1108
-			$that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1109
-
1110
-			$attachment_service = Wordlift_Attachment_Service::get_instance();
1111
-
1112
-			// Instantiate the JSON-LD service.
1113
-			$property_getter                       = Wordlift_Property_Getter_Factory::create();
1114
-			$that->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service );
1115
-			$that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter );
1116
-			$that->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter );
1117
-			$that->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service );
1118
-
1119
-			$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1120
-			$that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache );
1121
-			/*
1027
+        if ( WL_ALL_ENTITY_TYPES ) {
1028
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1029
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1030
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1031
+            new Wordlift_Schemaorg_Sync_Service();
1032
+            $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance();
1033
+            new Wordlift_Schemaorg_Class_Service();
1034
+        } else {
1035
+            $schemaorg_property_service = null;
1036
+        }
1037
+
1038
+        $this->loader = new Wordlift_Loader();
1039
+        /**
1040
+         * @since 3.30.0
1041
+         */
1042
+        $this->features_registry = Features_Registry::get_instance();
1043
+
1044
+        // Instantiate a global logger.
1045
+        global $wl_logger;
1046
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1047
+
1048
+        // Load the `wl-api` end-point.
1049
+        new Wordlift_Http_Api();
1050
+
1051
+        // Load the Install Service.
1052
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1053
+        $this->install_service = new Wordlift_Install_Service();
1054
+        $this->notice_service  = new Wordlift_Notice_Service();
1055
+        $this->user_service    = Wordlift_User_Service::get_instance();
1056
+        // create an instance of the entity type list admin page controller.
1057
+        $this->entity_type_admin_page        = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1058
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1059
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1060
+        // Create an entity type service instance. It'll be later bound to the init action.
1061
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(
1062
+            Wordlift_Entity_Service::TYPE_NAME, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() );
1063
+        /* WordPress Admin. */
1064
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page();
1065
+        // create an instance of the entity type setting admin page controller.
1066
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1067
+
1068
+
1069
+        $that = $this;
1070
+        add_action( 'plugins_loaded', function () use ( &$that, $schemaorg_property_service ) {
1071
+
1072
+            /** Services. */
1073
+            // Create the configuration service.
1074
+            $api_service = new Wordlift_Api_Service();
1075
+
1076
+            // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1077
+            $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() );
1078
+
1079
+            $schema_url_property_service = new Wordlift_Schema_Url_Property_Service();
1080
+
1081
+            $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance();
1082
+
1083
+            // Create a new instance of the Redirect service.
1084
+            $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service );
1085
+
1086
+            // Create a new instance of the Timeline service and Timeline shortcode.
1087
+            $that->timeline_service = new Wordlift_Timeline_Service();
1088
+
1089
+            $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1090
+
1091
+            // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1092
+            $that->sharethis_service = new Wordlift_ShareThis_Service();
1093
+
1094
+            // Create an instance of the PrimaShop adapter.
1095
+            $that->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1096
+
1097
+            $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1098
+
1099
+            // Create the entity rating service.
1100
+            $that->rating_service = Wordlift_Rating_Service::get_instance();
1101
+
1102
+            // Create entity list customization (wp-admin/edit.php).
1103
+            $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service );
1104
+
1105
+            // Create an instance of the Publisher Service and the AJAX Adapter.
1106
+            $that->publisher_service = Wordlift_Publisher_Service::get_instance();
1107
+            $that->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1108
+            $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1109
+
1110
+            $attachment_service = Wordlift_Attachment_Service::get_instance();
1111
+
1112
+            // Instantiate the JSON-LD service.
1113
+            $property_getter                       = Wordlift_Property_Getter_Factory::create();
1114
+            $that->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service );
1115
+            $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter );
1116
+            $that->postid_to_jsonld_converter      = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter );
1117
+            $that->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service );
1118
+
1119
+            $jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1120
+            $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache );
1121
+            /*
1122 1122
 			 * Load the `Wordlift_Term_JsonLd_Adapter`.
1123 1123
 			 *
1124 1124
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1125 1125
 			 *
1126 1126
 			 * @since 3.20.0
1127 1127
 			 */
1128
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1129
-
1130
-			$term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter );
1131
-			$that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter );
1132
-
1133
-			$jsonld_service = new Jsonld_Service(
1134
-				$that->jsonld_service,
1135
-				$term_jsonld_adapter,
1136
-				new Jsonld_User_Service( $that->user_service ) );
1137
-			new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service );
1138
-
1139
-			// Prints the JSON-LD in the head.
1140
-			new Jsonld_Adapter( $that->jsonld_service );
1141
-
1142
-			new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service );
1143
-
1144
-			$that->key_validation_service = new Wordlift_Key_Validation_Service();
1145
-			$that->content_filter_service = Wordlift_Content_Filter_Service::get_instance();
1146
-			// Creating Faq Content filter service.
1147
-			$that->faq_content_filter_service = new Faq_Content_Filter();
1148
-			$that->sample_data_service        = Wordlift_Sample_Data_Service::get_instance();
1149
-			$that->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service );
1150
-
1151
-			$that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' );
1152
-			$that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' );
1153
-
1154
-			/**
1155
-			 * Filter: wl_feature__enable__blocks.
1156
-			 *
1157
-			 * @param bool whether the blocks needed to be registered, defaults to true.
1158
-			 *
1159
-			 * @return bool
1160
-			 * @since 3.27.6
1161
-			 */
1162
-			if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1163
-				// Initialize the short-codes.
1164
-				new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1165
-				new Wordlift_Chord_Shortcode();
1166
-				new Wordlift_Geomap_Shortcode();
1167
-				new Wordlift_Timeline_Shortcode();
1168
-				new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() );
1169
-				new Wordlift_Vocabulary_Shortcode();
1170
-				new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1171
-			}
1172
-
1173
-			new Wordlift_Products_Navigator_Shortcode();
1174
-
1175
-
1176
-			// Initialize the Context Cards Service
1177
-			$that->context_cards_service = new Wordlift_Context_Cards_Service();
1178
-
1179
-			// Initialize the SEO service.
1180
-			new Wordlift_Seo_Service();
1181
-
1182
-			// Initialize the AMP service.
1183
-			new Wordlift_AMP_Service( $that->jsonld_service );
1184
-
1185
-			/** Services. */
1186
-			$that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1187
-			new Wordlift_Image_Service();
1188
-
1189
-			/** Adapters. */
1190
-			$that->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() );
1191
-			$that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service );
1192
-			$that->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $that );
1193
-
1194
-			/*
1128
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1129
+
1130
+            $term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter );
1131
+            $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter );
1132
+
1133
+            $jsonld_service = new Jsonld_Service(
1134
+                $that->jsonld_service,
1135
+                $term_jsonld_adapter,
1136
+                new Jsonld_User_Service( $that->user_service ) );
1137
+            new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service );
1138
+
1139
+            // Prints the JSON-LD in the head.
1140
+            new Jsonld_Adapter( $that->jsonld_service );
1141
+
1142
+            new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service );
1143
+
1144
+            $that->key_validation_service = new Wordlift_Key_Validation_Service();
1145
+            $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance();
1146
+            // Creating Faq Content filter service.
1147
+            $that->faq_content_filter_service = new Faq_Content_Filter();
1148
+            $that->sample_data_service        = Wordlift_Sample_Data_Service::get_instance();
1149
+            $that->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service );
1150
+
1151
+            $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' );
1152
+            $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' );
1153
+
1154
+            /**
1155
+             * Filter: wl_feature__enable__blocks.
1156
+             *
1157
+             * @param bool whether the blocks needed to be registered, defaults to true.
1158
+             *
1159
+             * @return bool
1160
+             * @since 3.27.6
1161
+             */
1162
+            if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1163
+                // Initialize the short-codes.
1164
+                new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1165
+                new Wordlift_Chord_Shortcode();
1166
+                new Wordlift_Geomap_Shortcode();
1167
+                new Wordlift_Timeline_Shortcode();
1168
+                new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() );
1169
+                new Wordlift_Vocabulary_Shortcode();
1170
+                new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1171
+            }
1172
+
1173
+            new Wordlift_Products_Navigator_Shortcode();
1174
+
1175
+
1176
+            // Initialize the Context Cards Service
1177
+            $that->context_cards_service = new Wordlift_Context_Cards_Service();
1178
+
1179
+            // Initialize the SEO service.
1180
+            new Wordlift_Seo_Service();
1181
+
1182
+            // Initialize the AMP service.
1183
+            new Wordlift_AMP_Service( $that->jsonld_service );
1184
+
1185
+            /** Services. */
1186
+            $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1187
+            new Wordlift_Image_Service();
1188
+
1189
+            /** Adapters. */
1190
+            $that->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() );
1191
+            $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service );
1192
+            $that->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $that );
1193
+
1194
+            /*
1195 1195
 			 * Exclude our public js from WP-Rocket.
1196 1196
 			 *
1197 1197
 			 * @since 3.19.4
1198 1198
 			 *
1199 1199
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1200 1200
 			 */
1201
-			new Wordlift_WpRocket_Adapter();
1201
+            new Wordlift_WpRocket_Adapter();
1202 1202
 
1203
-			/** WordPress Admin UI. */
1203
+            /** WordPress Admin UI. */
1204 1204
 
1205
-			// UI elements.
1206
-			$that->input_element           = new Wordlift_Admin_Input_Element();
1207
-			$that->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1208
-			$that->select2_element         = new Wordlift_Admin_Select2_Element();
1209
-			$that->language_select_element = new Wordlift_Admin_Language_Select_Element();
1210
-			$that->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1211
-			$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1212
-			$that->publisher_element       = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element );
1213
-			$that->author_element          = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element );
1205
+            // UI elements.
1206
+            $that->input_element           = new Wordlift_Admin_Input_Element();
1207
+            $that->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1208
+            $that->select2_element         = new Wordlift_Admin_Select2_Element();
1209
+            $that->language_select_element = new Wordlift_Admin_Language_Select_Element();
1210
+            $that->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1211
+            $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1212
+            $that->publisher_element       = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element );
1213
+            $that->author_element          = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element );
1214 1214
 
1215
-			$that->settings_page             = Wordlift_Admin_Settings_Page::get_instance();
1216
-			$that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page );
1215
+            $that->settings_page             = Wordlift_Admin_Settings_Page::get_instance();
1216
+            $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page );
1217 1217
 
1218
-			$that->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element );
1219
-			$that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page );
1220
-			$that->analytics_connect                   = new Wordlift_Analytics_Connect();
1218
+            $that->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element );
1219
+            $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page );
1220
+            $that->analytics_connect                   = new Wordlift_Analytics_Connect();
1221 1221
 
1222
-			// Pages.
1223
-			/*
1222
+            // Pages.
1223
+            /*
1224 1224
 			 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1225 1225
 			 *
1226 1226
 			 * @since 3.20.3
1227 1227
 			 *
1228 1228
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1229 1229
 			 */
1230
-			if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1231
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1232
-				new Wordlift_Admin_Post_Edit_Page( $that );
1233
-			}
1234
-			new Wordlift_Entity_Type_Admin_Service();
1230
+            if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1231
+                require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1232
+                new Wordlift_Admin_Post_Edit_Page( $that );
1233
+            }
1234
+            new Wordlift_Entity_Type_Admin_Service();
1235 1235
 
1236
-			/** Widgets */
1237
-			$that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1236
+            /** Widgets */
1237
+            $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1238 1238
 
1239
-			// Create an instance of the install wizard.
1240
-			$that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element );
1239
+            // Create an instance of the install wizard.
1240
+            $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element );
1241 1241
 
1242
-			$that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service );
1242
+            $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service );
1243 1243
 
1244
-			// User Profile.
1245
-			new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service );
1244
+            // User Profile.
1245
+            new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service );
1246 1246
 
1247
-			$that->entity_page_service = new Wordlift_Entity_Page_Service();
1247
+            $that->entity_page_service = new Wordlift_Entity_Page_Service();
1248 1248
 
1249
-			// Load the debug service if WP is in debug mode.
1250
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1251
-				require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1252
-				new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service );
1253
-			}
1249
+            // Load the debug service if WP is in debug mode.
1250
+            if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1251
+                require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1252
+                new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service );
1253
+            }
1254 1254
 
1255
-			// Remote Image Service.
1256
-			new Wordlift_Remote_Image_Service();
1255
+            // Remote Image Service.
1256
+            new Wordlift_Remote_Image_Service();
1257 1257
 
1258
-			/*
1258
+            /*
1259 1259
 			 * Provides mappings between post types and entity types.
1260 1260
 			 *
1261 1261
 			 * @since 3.20.0
1262 1262
 			 *
1263 1263
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1264 1264
 			 */
1265
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1266
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1267
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1265
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1266
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1267
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1268 1268
 
1269
-			// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1270
-			new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1269
+            // Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1270
+            new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1271 1271
 
1272
-			/*
1272
+            /*
1273 1273
 			 * Load the Mappings JSON-LD post processing.
1274 1274
 			 *
1275 1275
 			 * @since 3.25.0
1276 1276
 			 */
1277 1277
 
1278
-			$mappings_dbo           = new Mappings_DBO();
1279
-			$default_rule_validator = new Taxonomy_Rule_Validator();
1280
-			new Post_Type_Rule_Validator();
1281
-			// Taxonomy term rule validator for validating rules for term pages.
1282
-			new Taxonomy_Term_Rule_Validator();
1283
-			new Post_Taxonomy_Term_Rule_Validator();
1284
-			$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1285
-			$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1286
-			$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1287
-
1288
-			new Url_To_Entity_Transform_Function( $that->entity_uri_service );
1289
-			new Taxonomy_To_Terms_Transform_Function();
1290
-			new Post_Id_To_Entity_Transform_Function();
1291
-			$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1292
-
1293
-			/**
1294
-			 * @since 3.27.1
1295
-			 * Intiailize the acf group data formatter.
1296
-			 */
1297
-			new Acf_Group_Formatter();
1298
-			new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1299
-
1300
-			/**
1301
-			 * @since 3.26.0
1302
-			 * Initialize the Faq JSON LD converter here - disabled.
1303
-			 */
1304
-			// new Faq_To_Jsonld_Converter();
1305
-			/*
1278
+            $mappings_dbo           = new Mappings_DBO();
1279
+            $default_rule_validator = new Taxonomy_Rule_Validator();
1280
+            new Post_Type_Rule_Validator();
1281
+            // Taxonomy term rule validator for validating rules for term pages.
1282
+            new Taxonomy_Term_Rule_Validator();
1283
+            new Post_Taxonomy_Term_Rule_Validator();
1284
+            $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1285
+            $rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1286
+            $mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1287
+
1288
+            new Url_To_Entity_Transform_Function( $that->entity_uri_service );
1289
+            new Taxonomy_To_Terms_Transform_Function();
1290
+            new Post_Id_To_Entity_Transform_Function();
1291
+            $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1292
+
1293
+            /**
1294
+             * @since 3.27.1
1295
+             * Intiailize the acf group data formatter.
1296
+             */
1297
+            new Acf_Group_Formatter();
1298
+            new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1299
+
1300
+            /**
1301
+             * @since 3.26.0
1302
+             * Initialize the Faq JSON LD converter here - disabled.
1303
+             */
1304
+            // new Faq_To_Jsonld_Converter();
1305
+            /*
1306 1306
 			 * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php
1307 1307
 			 * end-point.
1308 1308
 			 *
1309 1309
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/834
1310 1310
 			 * @since 3.24.4
1311 1311
 			 */
1312
-			new Templates_Ajax_Endpoint();
1313
-			// Call this static method to register FAQ routes to rest api - disabled
1314
-			//Faq_Rest_Controller::register_routes();
1315
-
1316
-			$that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter );
1317
-
1318
-			/** WL Autocomplete. */
1319
-			$autocomplete_service       = new All_Autocomplete_Service( array(
1320
-				new Local_Autocomplete_Service(),
1321
-				new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ),
1322
-			) );
1323
-			$that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1324
-
1325
-			/**
1326
-			 * @since 3.27.2
1327
-			 * Integrate the recipe maker jsonld & set recipe
1328
-			 * as default entity type to the wprm_recipe CPT.
1329
-			 */
1330
-			new Recipe_Maker_Post_Type_Hook();
1331
-			$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1332
-			new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1333
-			new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1334
-			new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service );
1335
-			new Recipe_Maker_Warning( $recipe_maker_validation_service );
1336
-
1337
-
1338
-			/**
1339
-			 * @since 3.27.4
1340
-			 * Add the faq duplicate markup hook.
1341
-			 */
1342
-			new Faq_Duplicate_Markup_Remover();
1343
-			/**
1344
-			 * @since 3.33.1
1345
-			 * Remove the duplicate HowTo Markup.
1346
-			 */
1347
-			new How_To_Duplicate_Markup_Remover();
1348
-
1349
-			/**
1350
-			 * @since 3.27.8
1351
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1352
-			 */
1353
-			new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() );
1354
-			/**
1355
-			 * @since 3.28.0
1356
-			 * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
1357
-			 */
1358
-			new Entity_No_Index_Flag();
1359
-
1360
-			/**
1361
-			 * @since 3.29.0
1362
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1363
-			 */
1364
-			new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() );
1365
-
1366
-			/**
1367
-			 * Expand author in to references.
1368
-			 * @since 3.30.0
1369
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1370
-			 */
1371
-
1372
-
1373
-			if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1374
-				new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1375
-			}
1376
-
1377
-
1378
-			if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1379
-				$vocabulary_loader = new Vocabulary_Loader();
1380
-				$vocabulary_loader->init_vocabulary();
1381
-			}
1382
-
1383
-			/**
1384
-			 *Added for feature request 1496 (Webhooks)
1385
-			 */
1386
-			if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) {
1387
-				$that->webhook_loader = new Webhooks_Loader();
1388
-				$that->webhook_loader->init();
1389
-			}
1390
-
1391
-			/**
1392
-			 * @since 3.30.0
1393
-			 * Add a checkbox to user option screen for wordlift admin.
1394
-			 */
1395
-			$wordlift_admin_checkbox = new Admin_User_Option();
1396
-			$wordlift_admin_checkbox->connect_hook();
1397
-
1398
-			/**
1399
-			 * @since 3.31.0
1400
-			 * Init loader class for videoobject.
1401
-			 */
1402
-			$videoobject_loader = new Loader();
1403
-			$videoobject_loader->init_feature();
1404
-
1405
-			/**
1406
-			 * @since 3.35.0
1407
-			 */
1408
-			$google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader();
1409
-			$google_addon_integration_loader->init_feature();
1410
-
1411
-			/**
1412
-			 * @since 3.31.5
1413
-			 * Create configuration endpoint for webapp to configure.
1414
-			 */
1415
-			new Config( $that->admin_setup, $that->key_validation_service );
1416
-			/**
1417
-			 * @since 3.31.7
1418
-			 * Remove duplicate videoobject.
1419
-			 */
1420
-			new Videoobject_Duplicate_Remover();
1421
-			$synonym_loader = new \Wordlift\Synonym\Loader();
1422
-			$synonym_loader->init_feature();
1423
-			/**
1424
-			 * @since 3.32.0
1425
-			 * Create loader for vocabulary terms.
1426
-			 */
1427
-			$vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter );
1428
-			$vocabulary_terms_loader->init_feature();
1429
-
1430
-			new Entity_Type_Change_Handler(
1431
-				Wordlift_Entity_Service::get_instance(),
1432
-				Wordlift_Entity_Type_Service::get_instance()
1433
-			);
1434
-
1435
-		}, 3 );
1436
-
1437
-
1438
-		new Entity_Type_Setter();
1439
-		$no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader();
1440
-		$no_editor_analysis_loader->init_feature();
1441
-	}
1442
-
1443
-	/**
1444
-	 * Define the locale for this plugin for internationalization.
1445
-	 *
1446
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1447
-	 * with WordPress.
1448
-	 *
1449
-	 * @since    1.0.0
1450
-	 * @access   private
1451
-	 */
1452
-	private function set_locale() {
1453
-
1454
-		$plugin_i18n = new Wordlift_i18n();
1455
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1456
-
1457
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1458
-
1459
-	}
1460
-
1461
-	/**
1462
-	 * Register all of the hooks related to the admin area functionality
1463
-	 * of the plugin.
1464
-	 *
1465
-	 * @since    1.0.0
1466
-	 * @access   private
1467
-	 */
1468
-	private function define_admin_hooks( $that ) {
1469
-		$plugin_admin = new
1470
-		Wordlift_Admin(
1471
-			$that->get_plugin_name(),
1472
-			$that->get_version(),
1473
-			$that->notice_service,
1474
-			$that->user_service
1475
-		);
1476
-
1477
-		$that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1478
-		$that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1479
-
1480
-		// Hook the `admin_init` function to the Admin Setup.
1481
-		Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' );
1482
-		$that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' );
1483
-
1484
-		// Hook the admin_init to the settings page.
1485
-		Assertions::is_set( $that->settings_page, '`setting_page` must be set' );
1486
-		$that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' );
1487
-
1488
-		// Hook the admin_init to the analytics settings page.
1489
-		Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' );
1490
-		$that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' );
1491
-
1492
-		// Hook the init action to taxonomy services.
1493
-		$that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 );
1494
-		$that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 );
1495
-
1496
-		// Hook the AJAX wl_timeline action to the Timeline service.
1497
-		$that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' );
1498
-
1499
-		// Register custom allowed redirect hosts.
1500
-		$that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' );
1501
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1502
-		$that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' );
1503
-
1504
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1505
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1506
-		$that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3 );
1507
-		$that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 );
1508
-
1509
-		$that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 );
1510
-		$that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' );
1511
-
1512
-		// Entity listing customization (wp-admin/edit.php)
1513
-		// Add custom columns.
1514
-		$that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' );
1515
-		// no explicit entity as it prevents handling of other post types.
1516
-		$that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 );
1517
-		// Add 4W selection.
1518
-		$that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' );
1519
-		$that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' );
1520
-		$that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' );
1521
-		$that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' );
1522
-
1523
-		/*
1312
+            new Templates_Ajax_Endpoint();
1313
+            // Call this static method to register FAQ routes to rest api - disabled
1314
+            //Faq_Rest_Controller::register_routes();
1315
+
1316
+            $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter );
1317
+
1318
+            /** WL Autocomplete. */
1319
+            $autocomplete_service       = new All_Autocomplete_Service( array(
1320
+                new Local_Autocomplete_Service(),
1321
+                new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ),
1322
+            ) );
1323
+            $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1324
+
1325
+            /**
1326
+             * @since 3.27.2
1327
+             * Integrate the recipe maker jsonld & set recipe
1328
+             * as default entity type to the wprm_recipe CPT.
1329
+             */
1330
+            new Recipe_Maker_Post_Type_Hook();
1331
+            $recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1332
+            new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1333
+            new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1334
+            new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service );
1335
+            new Recipe_Maker_Warning( $recipe_maker_validation_service );
1336
+
1337
+
1338
+            /**
1339
+             * @since 3.27.4
1340
+             * Add the faq duplicate markup hook.
1341
+             */
1342
+            new Faq_Duplicate_Markup_Remover();
1343
+            /**
1344
+             * @since 3.33.1
1345
+             * Remove the duplicate HowTo Markup.
1346
+             */
1347
+            new How_To_Duplicate_Markup_Remover();
1348
+
1349
+            /**
1350
+             * @since 3.27.8
1351
+             * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1352
+             */
1353
+            new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() );
1354
+            /**
1355
+             * @since 3.28.0
1356
+             * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
1357
+             */
1358
+            new Entity_No_Index_Flag();
1359
+
1360
+            /**
1361
+             * @since 3.29.0
1362
+             * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1363
+             */
1364
+            new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() );
1365
+
1366
+            /**
1367
+             * Expand author in to references.
1368
+             * @since 3.30.0
1369
+             * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1370
+             */
1371
+
1372
+
1373
+            if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1374
+                new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1375
+            }
1376
+
1377
+
1378
+            if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1379
+                $vocabulary_loader = new Vocabulary_Loader();
1380
+                $vocabulary_loader->init_vocabulary();
1381
+            }
1382
+
1383
+            /**
1384
+             *Added for feature request 1496 (Webhooks)
1385
+             */
1386
+            if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) {
1387
+                $that->webhook_loader = new Webhooks_Loader();
1388
+                $that->webhook_loader->init();
1389
+            }
1390
+
1391
+            /**
1392
+             * @since 3.30.0
1393
+             * Add a checkbox to user option screen for wordlift admin.
1394
+             */
1395
+            $wordlift_admin_checkbox = new Admin_User_Option();
1396
+            $wordlift_admin_checkbox->connect_hook();
1397
+
1398
+            /**
1399
+             * @since 3.31.0
1400
+             * Init loader class for videoobject.
1401
+             */
1402
+            $videoobject_loader = new Loader();
1403
+            $videoobject_loader->init_feature();
1404
+
1405
+            /**
1406
+             * @since 3.35.0
1407
+             */
1408
+            $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader();
1409
+            $google_addon_integration_loader->init_feature();
1410
+
1411
+            /**
1412
+             * @since 3.31.5
1413
+             * Create configuration endpoint for webapp to configure.
1414
+             */
1415
+            new Config( $that->admin_setup, $that->key_validation_service );
1416
+            /**
1417
+             * @since 3.31.7
1418
+             * Remove duplicate videoobject.
1419
+             */
1420
+            new Videoobject_Duplicate_Remover();
1421
+            $synonym_loader = new \Wordlift\Synonym\Loader();
1422
+            $synonym_loader->init_feature();
1423
+            /**
1424
+             * @since 3.32.0
1425
+             * Create loader for vocabulary terms.
1426
+             */
1427
+            $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter );
1428
+            $vocabulary_terms_loader->init_feature();
1429
+
1430
+            new Entity_Type_Change_Handler(
1431
+                Wordlift_Entity_Service::get_instance(),
1432
+                Wordlift_Entity_Type_Service::get_instance()
1433
+            );
1434
+
1435
+        }, 3 );
1436
+
1437
+
1438
+        new Entity_Type_Setter();
1439
+        $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader();
1440
+        $no_editor_analysis_loader->init_feature();
1441
+    }
1442
+
1443
+    /**
1444
+     * Define the locale for this plugin for internationalization.
1445
+     *
1446
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1447
+     * with WordPress.
1448
+     *
1449
+     * @since    1.0.0
1450
+     * @access   private
1451
+     */
1452
+    private function set_locale() {
1453
+
1454
+        $plugin_i18n = new Wordlift_i18n();
1455
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1456
+
1457
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1458
+
1459
+    }
1460
+
1461
+    /**
1462
+     * Register all of the hooks related to the admin area functionality
1463
+     * of the plugin.
1464
+     *
1465
+     * @since    1.0.0
1466
+     * @access   private
1467
+     */
1468
+    private function define_admin_hooks( $that ) {
1469
+        $plugin_admin = new
1470
+        Wordlift_Admin(
1471
+            $that->get_plugin_name(),
1472
+            $that->get_version(),
1473
+            $that->notice_service,
1474
+            $that->user_service
1475
+        );
1476
+
1477
+        $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1478
+        $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1479
+
1480
+        // Hook the `admin_init` function to the Admin Setup.
1481
+        Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' );
1482
+        $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' );
1483
+
1484
+        // Hook the admin_init to the settings page.
1485
+        Assertions::is_set( $that->settings_page, '`setting_page` must be set' );
1486
+        $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' );
1487
+
1488
+        // Hook the admin_init to the analytics settings page.
1489
+        Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' );
1490
+        $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' );
1491
+
1492
+        // Hook the init action to taxonomy services.
1493
+        $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 );
1494
+        $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 );
1495
+
1496
+        // Hook the AJAX wl_timeline action to the Timeline service.
1497
+        $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' );
1498
+
1499
+        // Register custom allowed redirect hosts.
1500
+        $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' );
1501
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1502
+        $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' );
1503
+
1504
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1505
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1506
+        $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3 );
1507
+        $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 );
1508
+
1509
+        $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 );
1510
+        $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' );
1511
+
1512
+        // Entity listing customization (wp-admin/edit.php)
1513
+        // Add custom columns.
1514
+        $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' );
1515
+        // no explicit entity as it prevents handling of other post types.
1516
+        $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 );
1517
+        // Add 4W selection.
1518
+        $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' );
1519
+        $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' );
1520
+        $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' );
1521
+        $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' );
1522
+
1523
+        /*
1524 1524
 		 * If `All Entity Types` is disable, use the radio button Walker.
1525 1525
 		 *
1526 1526
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1527 1527
 		 */
1528
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1529
-			$that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' );
1530
-		}
1531
-
1532
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1533
-		// entities.
1534
-		$that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1535
-
1536
-		/**
1537
-		 * Filter: wl_feature__enable__settings-download.
1538
-		 *
1539
-		 * @param bool whether the screens needed to be registered, defaults to true.
1540
-		 *
1541
-		 * @return bool
1542
-		 * @since 3.27.6
1543
-		 */
1544
-		$that->features_registry->register_feature_from_slug( 'settings-download', true, array(
1545
-			$that,
1546
-			'register_screens'
1547
-		) );
1548
-
1549
-
1550
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1551
-		$that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 );
1552
-
1553
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1554
-		$that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' );
1555
-		$that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' );
1556
-		$that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' );
1557
-
1558
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1559
-		$that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' );
1560
-
1561
-		// Hook the AJAX wl_update_country_options action to the countries.
1562
-		$that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' );
1563
-
1564
-		$that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' );
1565
-
1566
-		// Hook the menu creation on the general wordlift menu creation.
1567
-		/**
1568
-		 * Filter: wl_feature__enable__screens.
1569
-		 *
1570
-		 * @param bool whether the screens needed to be registered, defaults to true.
1571
-		 *
1572
-		 * @return bool
1573
-		 * @since 3.27.6
1574
-		 *
1575
-		 * Since 3.30.0 this feature is registered using registry.
1576
-		 */
1577
-		if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1578
-			add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1579
-		}
1580
-
1581
-		// Hook key update.
1582
-		$that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 );
1583
-		$that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 );
1584
-
1585
-		// Add additional action links to the WordLift plugin in the plugins page.
1586
-		$that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 );
1587
-
1588
-		/*
1528
+        if ( ! WL_ALL_ENTITY_TYPES ) {
1529
+            $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' );
1530
+        }
1531
+
1532
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1533
+        // entities.
1534
+        $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1535
+
1536
+        /**
1537
+         * Filter: wl_feature__enable__settings-download.
1538
+         *
1539
+         * @param bool whether the screens needed to be registered, defaults to true.
1540
+         *
1541
+         * @return bool
1542
+         * @since 3.27.6
1543
+         */
1544
+        $that->features_registry->register_feature_from_slug( 'settings-download', true, array(
1545
+            $that,
1546
+            'register_screens'
1547
+        ) );
1548
+
1549
+
1550
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1551
+        $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 );
1552
+
1553
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1554
+        $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' );
1555
+        $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' );
1556
+        $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' );
1557
+
1558
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1559
+        $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' );
1560
+
1561
+        // Hook the AJAX wl_update_country_options action to the countries.
1562
+        $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' );
1563
+
1564
+        $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' );
1565
+
1566
+        // Hook the menu creation on the general wordlift menu creation.
1567
+        /**
1568
+         * Filter: wl_feature__enable__screens.
1569
+         *
1570
+         * @param bool whether the screens needed to be registered, defaults to true.
1571
+         *
1572
+         * @return bool
1573
+         * @since 3.27.6
1574
+         *
1575
+         * Since 3.30.0 this feature is registered using registry.
1576
+         */
1577
+        if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1578
+            add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1579
+        }
1580
+
1581
+        // Hook key update.
1582
+        $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 );
1583
+        $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 );
1584
+
1585
+        // Add additional action links to the WordLift plugin in the plugins page.
1586
+        $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 );
1587
+
1588
+        /*
1589 1589
 		 * Remove the Analytics Settings link from the plugin page.
1590 1590
 		 *
1591 1591
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1592 1592
 		 * @since 3.21.1
1593 1593
 		 */
1594
-		// $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 );
1595
-
1596
-		// Hook the AJAX `wl_publisher` action name.
1597
-		$that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' );
1598
-
1599
-		// Hook row actions for the entity type list admin.
1600
-		$that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1601
-
1602
-		/** Ajax actions. */
1603
-		$that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' );
1604
-
1605
-		// Hook capabilities manipulation to allow access to entity type admin
1606
-		// page  on WordPress versions before 4.7.
1607
-		global $wp_version;
1608
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1609
-			$that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1610
-		}
1611
-
1612
-		/** Adapters. */
1613
-		$that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1614
-		/**
1615
-		 * Disabling Faq temporarily.
1616
-		 * Load the tinymce editor button on the tool bar.
1617
-		 * @since 3.26.0
1618
-		 */
1619
-		//$that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' );
1620
-		//$that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1621
-		//$that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1622
-
1623
-
1624
-		$that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' );
1625
-		$that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' );
1626
-
1627
-		/**
1628
-		 * @since 3.26.0
1629
-		 */
1630
-		$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1631
-		$that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1632
-		// Adding Rest route for the post excerpt
1633
-		Post_Excerpt_Rest_Controller::register_routes();
1634
-
1635
-		// Handle the autocomplete request.
1636
-		add_action( 'wp_ajax_wl_autocomplete', array(
1637
-			$that->autocomplete_adapter,
1638
-			'wl_autocomplete',
1639
-		) );
1640
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1641
-			$that->autocomplete_adapter,
1642
-			'wl_autocomplete',
1643
-		) );
1644
-
1645
-		// Hooks to restrict multisite super admin from manipulating entity types.
1646
-		if ( is_multisite() ) {
1647
-			$that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1648
-		}
1649
-
1650
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback();
1651
-
1652
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1653
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1654
-		add_action( 'wp_ajax_wl_deactivation_feedback', array(
1655
-			$deactivator_feedback,
1656
-			'wl_deactivation_feedback'
1657
-		) );
1658
-
1659
-		/**
1660
-		 * Always allow the `wordlift/classification` block.
1661
-		 *
1662
-		 * @since 3.23.0
1663
-		 */
1664
-		add_filter( 'allowed_block_types', function ( $value ) {
1665
-
1666
-			if ( true === $value ) {
1667
-				return $value;
1668
-			}
1669
-
1670
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1671
-		}, PHP_INT_MAX );
1672
-
1673
-		/**
1674
-		 * @since 3.27.7
1675
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1676
-		 */
1677
-		new Top_Entities();
1678
-
1679
-	}
1680
-
1681
-	/**
1682
-	 * Register all of the hooks related to the public-facing functionality
1683
-	 * of the plugin.
1684
-	 *
1685
-	 * @since    1.0.0
1686
-	 * @access   private
1687
-	 */
1688
-	private function define_public_hooks( $that ) {
1689
-
1690
-		$plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() );
1691
-
1692
-		// Register the entity post type.
1693
-		$that->loader->add_action( 'init', $that->entity_post_type_service, 'register' );
1694
-
1695
-		// Bind the link generation and handling hooks to the entity link service.
1696
-		$that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 4 );
1697
-		$that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1698
-		// $that->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1699
-		// $that->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1700
-
1701
-		$that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1702
-		$that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1703
-		$that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' );
1704
-
1705
-		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1706
-		$that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1707
-		// Hook the content filter service to add entity links.
1708
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1709
-			$that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content' );
1710
-		}
1711
-
1712
-		// Hook the AJAX wl_timeline action to the Timeline service.
1713
-		$that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' );
1714
-
1715
-		// Hook the ShareThis service.
1716
-		$that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 );
1717
-		$that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 );
1718
-
1719
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1720
-		$that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' );
1721
-
1722
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1723
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1724
-		// to categories.
1725
-		$that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1726
-
1727
-		/*
1594
+        // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 );
1595
+
1596
+        // Hook the AJAX `wl_publisher` action name.
1597
+        $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' );
1598
+
1599
+        // Hook row actions for the entity type list admin.
1600
+        $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1601
+
1602
+        /** Ajax actions. */
1603
+        $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' );
1604
+
1605
+        // Hook capabilities manipulation to allow access to entity type admin
1606
+        // page  on WordPress versions before 4.7.
1607
+        global $wp_version;
1608
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1609
+            $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1610
+        }
1611
+
1612
+        /** Adapters. */
1613
+        $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1614
+        /**
1615
+         * Disabling Faq temporarily.
1616
+         * Load the tinymce editor button on the tool bar.
1617
+         * @since 3.26.0
1618
+         */
1619
+        //$that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' );
1620
+        //$that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1621
+        //$that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1622
+
1623
+
1624
+        $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' );
1625
+        $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' );
1626
+
1627
+        /**
1628
+         * @since 3.26.0
1629
+         */
1630
+        $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1631
+        $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1632
+        // Adding Rest route for the post excerpt
1633
+        Post_Excerpt_Rest_Controller::register_routes();
1634
+
1635
+        // Handle the autocomplete request.
1636
+        add_action( 'wp_ajax_wl_autocomplete', array(
1637
+            $that->autocomplete_adapter,
1638
+            'wl_autocomplete',
1639
+        ) );
1640
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1641
+            $that->autocomplete_adapter,
1642
+            'wl_autocomplete',
1643
+        ) );
1644
+
1645
+        // Hooks to restrict multisite super admin from manipulating entity types.
1646
+        if ( is_multisite() ) {
1647
+            $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1648
+        }
1649
+
1650
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback();
1651
+
1652
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1653
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1654
+        add_action( 'wp_ajax_wl_deactivation_feedback', array(
1655
+            $deactivator_feedback,
1656
+            'wl_deactivation_feedback'
1657
+        ) );
1658
+
1659
+        /**
1660
+         * Always allow the `wordlift/classification` block.
1661
+         *
1662
+         * @since 3.23.0
1663
+         */
1664
+        add_filter( 'allowed_block_types', function ( $value ) {
1665
+
1666
+            if ( true === $value ) {
1667
+                return $value;
1668
+            }
1669
+
1670
+            return array_merge( (array) $value, array( 'wordlift/classification' ) );
1671
+        }, PHP_INT_MAX );
1672
+
1673
+        /**
1674
+         * @since 3.27.7
1675
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1676
+         */
1677
+        new Top_Entities();
1678
+
1679
+    }
1680
+
1681
+    /**
1682
+     * Register all of the hooks related to the public-facing functionality
1683
+     * of the plugin.
1684
+     *
1685
+     * @since    1.0.0
1686
+     * @access   private
1687
+     */
1688
+    private function define_public_hooks( $that ) {
1689
+
1690
+        $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() );
1691
+
1692
+        // Register the entity post type.
1693
+        $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' );
1694
+
1695
+        // Bind the link generation and handling hooks to the entity link service.
1696
+        $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 4 );
1697
+        $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1698
+        // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1699
+        // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1700
+
1701
+        $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1702
+        $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1703
+        $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' );
1704
+
1705
+        // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1706
+        $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1707
+        // Hook the content filter service to add entity links.
1708
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1709
+            $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content' );
1710
+        }
1711
+
1712
+        // Hook the AJAX wl_timeline action to the Timeline service.
1713
+        $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' );
1714
+
1715
+        // Hook the ShareThis service.
1716
+        $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 );
1717
+        $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 );
1718
+
1719
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1720
+        $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' );
1721
+
1722
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1723
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1724
+        // to categories.
1725
+        $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1726
+
1727
+        /*
1728 1728
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1729 1729
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1730 1730
 		 * order of start time.
1731 1731
 		 */
1732
-		$that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 );
1733
-
1734
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1735
-		$that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 3 );
1736
-
1737
-		// Analytics Script Frontend.
1738
-		if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) {
1739
-			$that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 );
1740
-		}
1741
-
1742
-	}
1743
-
1744
-	/**
1745
-	 * Run the loader to execute all of the hooks with WordPress.
1746
-	 *
1747
-	 * @since    1.0.0
1748
-	 */
1749
-	public function run() {
1750
-		$this->loader->run();
1751
-	}
1752
-
1753
-	/**
1754
-	 * The name of the plugin used to uniquely identify it within the context of
1755
-	 * WordPress and to define internationalization functionality.
1756
-	 *
1757
-	 * @return    string    The name of the plugin.
1758
-	 * @since     1.0.0
1759
-	 */
1760
-	public function get_plugin_name() {
1761
-		return $this->plugin_name;
1762
-	}
1763
-
1764
-	/**
1765
-	 * The reference to the class that orchestrates the hooks with the plugin.
1766
-	 *
1767
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1768
-	 * @since     1.0.0
1769
-	 */
1770
-	public function get_loader() {
1771
-		return $this->loader;
1772
-	}
1773
-
1774
-	/**
1775
-	 * Retrieve the version number of the plugin.
1776
-	 *
1777
-	 * @return    string    The version number of the plugin.
1778
-	 * @since     1.0.0
1779
-	 */
1780
-	public function get_version() {
1781
-		return $this->version;
1782
-	}
1783
-
1784
-	/**
1785
-	 * Load dependencies for WP-CLI.
1786
-	 *
1787
-	 * @throws Exception
1788
-	 * @since 3.18.0
1789
-	 */
1790
-	private function load_cli_dependencies() {
1791
-
1792
-	}
1793
-
1794
-	public function add_wl_enabled_blocks() {
1795
-		/**
1796
-		 * Filter: wl_feature__enable__blocks.
1797
-		 *
1798
-		 * @param bool whether the blocks needed to be registered, defaults to true.
1799
-		 *
1800
-		 * @return bool
1801
-		 * @since 3.27.6
1802
-		 */
1803
-
1804
-		wp_register_script( 'wl_enabled_blocks', false );
1805
-
1806
-		$enabled_blocks = array();
1807
-
1808
-		/**
1809
-		 * Filter name: wl_feature__enable__product-navigator
1810
-		 * @since 3.32.3
1811
-		 */
1812
-		if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
1813
-			$enabled_blocks[] = 'wordlift/products-navigator';
1814
-		}
1815
-
1816
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1817
-			// To intimate JS
1818
-			$enabled_blocks = array_merge( $enabled_blocks, array(
1819
-				'wordlift/navigator',
1820
-				'wordlift/chord',
1821
-				'wordlift/geomap',
1822
-				'wordlift/timeline',
1823
-				'wordlift/cloud',
1824
-				'wordlift/vocabulary',
1825
-				'wordlift/faceted-search'
1826
-			) );
1827
-		}
1828
-
1829
-		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
1830
-		wp_enqueue_script( 'wl_enabled_blocks' );
1831
-	}
1832
-
1833
-	/**
1834
-	 * Register screens based on the filter.
1835
-	 */
1836
-	public function register_screens() {
1837
-		// Hook the menu to the Download Your Data page.
1838
-		if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
1839
-			Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" );
1840
-			add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
1841
-		}
1842
-
1843
-		Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" );
1844
-		add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
1845
-
1846
-	}
1732
+        $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 );
1733
+
1734
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1735
+        $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 3 );
1736
+
1737
+        // Analytics Script Frontend.
1738
+        if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) {
1739
+            $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 );
1740
+        }
1741
+
1742
+    }
1743
+
1744
+    /**
1745
+     * Run the loader to execute all of the hooks with WordPress.
1746
+     *
1747
+     * @since    1.0.0
1748
+     */
1749
+    public function run() {
1750
+        $this->loader->run();
1751
+    }
1752
+
1753
+    /**
1754
+     * The name of the plugin used to uniquely identify it within the context of
1755
+     * WordPress and to define internationalization functionality.
1756
+     *
1757
+     * @return    string    The name of the plugin.
1758
+     * @since     1.0.0
1759
+     */
1760
+    public function get_plugin_name() {
1761
+        return $this->plugin_name;
1762
+    }
1763
+
1764
+    /**
1765
+     * The reference to the class that orchestrates the hooks with the plugin.
1766
+     *
1767
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1768
+     * @since     1.0.0
1769
+     */
1770
+    public function get_loader() {
1771
+        return $this->loader;
1772
+    }
1773
+
1774
+    /**
1775
+     * Retrieve the version number of the plugin.
1776
+     *
1777
+     * @return    string    The version number of the plugin.
1778
+     * @since     1.0.0
1779
+     */
1780
+    public function get_version() {
1781
+        return $this->version;
1782
+    }
1783
+
1784
+    /**
1785
+     * Load dependencies for WP-CLI.
1786
+     *
1787
+     * @throws Exception
1788
+     * @since 3.18.0
1789
+     */
1790
+    private function load_cli_dependencies() {
1791
+
1792
+    }
1793
+
1794
+    public function add_wl_enabled_blocks() {
1795
+        /**
1796
+         * Filter: wl_feature__enable__blocks.
1797
+         *
1798
+         * @param bool whether the blocks needed to be registered, defaults to true.
1799
+         *
1800
+         * @return bool
1801
+         * @since 3.27.6
1802
+         */
1803
+
1804
+        wp_register_script( 'wl_enabled_blocks', false );
1805
+
1806
+        $enabled_blocks = array();
1807
+
1808
+        /**
1809
+         * Filter name: wl_feature__enable__product-navigator
1810
+         * @since 3.32.3
1811
+         */
1812
+        if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
1813
+            $enabled_blocks[] = 'wordlift/products-navigator';
1814
+        }
1815
+
1816
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1817
+            // To intimate JS
1818
+            $enabled_blocks = array_merge( $enabled_blocks, array(
1819
+                'wordlift/navigator',
1820
+                'wordlift/chord',
1821
+                'wordlift/geomap',
1822
+                'wordlift/timeline',
1823
+                'wordlift/cloud',
1824
+                'wordlift/vocabulary',
1825
+                'wordlift/faceted-search'
1826
+            ) );
1827
+        }
1828
+
1829
+        wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
1830
+        wp_enqueue_script( 'wl_enabled_blocks' );
1831
+    }
1832
+
1833
+    /**
1834
+     * Register screens based on the filter.
1835
+     */
1836
+    public function register_screens() {
1837
+        // Hook the menu to the Download Your Data page.
1838
+        if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
1839
+            Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" );
1840
+            add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
1841
+        }
1842
+
1843
+        Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" );
1844
+        add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
1845
+
1846
+    }
1847 1847
 
1848 1848
 }
Please login to merge, or discard this patch.
external-plugin-hooks/recipe-maker/class-recipe-maker-jsonld-hook.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -14,94 +14,94 @@
 block discarded – undo
14 14
  */
15 15
 class Recipe_Maker_Jsonld_Hook {
16 16
 
17
-	/**
18
-	 * @var \Wordlift_Attachment_Service
19
-	 */
20
-	private $attachment_service;
21
-	/**
22
-	 * @var Recipe_Maker_Validation_Service
23
-	 */
24
-	private $recipe_maker_validation_service;
25
-
26
-	/**
27
-	 * Recipe_Maker_Jsonld_Hook constructor.
28
-	 *
29
-	 * @param $attachment_service \Wordlift_Attachment_Service
30
-	 * @param $recipe_maker_validation_service Recipe_Maker_Validation_Service
31
-	 */
32
-	public function __construct( $attachment_service, $recipe_maker_validation_service ) {
33
-
34
-		$this->attachment_service              = $attachment_service;
35
-		$this->recipe_maker_validation_service = $recipe_maker_validation_service;
36
-		$this->merge_recipe_jsonld();
37
-	}
38
-
39
-
40
-	private function merge_recipe_jsonld() {
41
-		// First we push all the linked recipes to references.
42
-		add_filter( 'wl_entity_jsonld_array', array( $this, 'wl_entity_jsonld_array' ), 10, 2 );
43
-		add_filter( 'wl_post_jsonld_array', array( $this, 'wl_entity_jsonld_array' ), 10, 2 );
44
-
45
-		// Then we merge the jsonld for every recipe.
46
-		add_filter( 'wl_entity_jsonld', array( $this, 'wl_entity_jsonld' ), 10, 3 );
47
-	}
48
-
49
-
50
-	public function wl_entity_jsonld_array( $arr, $post_id ) {
51
-
52
-		$jsonld     = $arr['jsonld'];
53
-		$references = $arr['references'];
54
-
55
-		// check if wp recipe maker installed, if not return early.
56
-		if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) {
57
-			return $arr;
58
-		}
59
-
60
-		// 1. Get the jsonld from recipe maker for the post id.
61
-		$recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post( $post_id );
62
-
63
-		// If there are no associated recipes for a post id then return early
64
-		if ( ! $recipe_ids ) {
65
-			return $arr;
66
-		}
67
-
68
-		return array(
69
-			'jsonld'     => $jsonld,
70
-			'references' => array_merge( $recipe_ids, $references )
71
-		);
72
-
73
-	}
74
-
75
-
76
-	public function wl_entity_jsonld( $jsonld, $post_id, $references ) {
77
-		$recipe_data = $this->process_single_recipe_item( $post_id );
78
-		if ( ! $recipe_data ) {
79
-			return $jsonld;
80
-		}
81
-
82
-		if ( ! $jsonld ) {
83
-			return $recipe_data;
84
-		}
85
-
86
-		return $recipe_data + $jsonld;
87
-	}
88
-
89
-	/**
90
-	 * @param $linked_recipe_id int post id of that recipe.
91
-	 *
92
-	 * @return array Recipe valid jsonld data.
93
-	 */
94
-	private function process_single_recipe_item( $linked_recipe_id ) {
95
-		// check if recipe maker present.
96
-		if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) {
97
-			return array();
98
-		}
99
-		$linked_recipe = \WPRM_Recipe_Manager::get_recipe( $linked_recipe_id );
100
-		if ( $linked_recipe ) {
101
-			return \WPRM_Metadata::get_metadata_details( $linked_recipe ) ?: array();
102
-		}
103
-
104
-		return array();
105
-	}
17
+    /**
18
+     * @var \Wordlift_Attachment_Service
19
+     */
20
+    private $attachment_service;
21
+    /**
22
+     * @var Recipe_Maker_Validation_Service
23
+     */
24
+    private $recipe_maker_validation_service;
25
+
26
+    /**
27
+     * Recipe_Maker_Jsonld_Hook constructor.
28
+     *
29
+     * @param $attachment_service \Wordlift_Attachment_Service
30
+     * @param $recipe_maker_validation_service Recipe_Maker_Validation_Service
31
+     */
32
+    public function __construct( $attachment_service, $recipe_maker_validation_service ) {
33
+
34
+        $this->attachment_service              = $attachment_service;
35
+        $this->recipe_maker_validation_service = $recipe_maker_validation_service;
36
+        $this->merge_recipe_jsonld();
37
+    }
38
+
39
+
40
+    private function merge_recipe_jsonld() {
41
+        // First we push all the linked recipes to references.
42
+        add_filter( 'wl_entity_jsonld_array', array( $this, 'wl_entity_jsonld_array' ), 10, 2 );
43
+        add_filter( 'wl_post_jsonld_array', array( $this, 'wl_entity_jsonld_array' ), 10, 2 );
44
+
45
+        // Then we merge the jsonld for every recipe.
46
+        add_filter( 'wl_entity_jsonld', array( $this, 'wl_entity_jsonld' ), 10, 3 );
47
+    }
48
+
49
+
50
+    public function wl_entity_jsonld_array( $arr, $post_id ) {
51
+
52
+        $jsonld     = $arr['jsonld'];
53
+        $references = $arr['references'];
54
+
55
+        // check if wp recipe maker installed, if not return early.
56
+        if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) {
57
+            return $arr;
58
+        }
59
+
60
+        // 1. Get the jsonld from recipe maker for the post id.
61
+        $recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post( $post_id );
62
+
63
+        // If there are no associated recipes for a post id then return early
64
+        if ( ! $recipe_ids ) {
65
+            return $arr;
66
+        }
67
+
68
+        return array(
69
+            'jsonld'     => $jsonld,
70
+            'references' => array_merge( $recipe_ids, $references )
71
+        );
72
+
73
+    }
74
+
75
+
76
+    public function wl_entity_jsonld( $jsonld, $post_id, $references ) {
77
+        $recipe_data = $this->process_single_recipe_item( $post_id );
78
+        if ( ! $recipe_data ) {
79
+            return $jsonld;
80
+        }
81
+
82
+        if ( ! $jsonld ) {
83
+            return $recipe_data;
84
+        }
85
+
86
+        return $recipe_data + $jsonld;
87
+    }
88
+
89
+    /**
90
+     * @param $linked_recipe_id int post id of that recipe.
91
+     *
92
+     * @return array Recipe valid jsonld data.
93
+     */
94
+    private function process_single_recipe_item( $linked_recipe_id ) {
95
+        // check if recipe maker present.
96
+        if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) {
97
+            return array();
98
+        }
99
+        $linked_recipe = \WPRM_Recipe_Manager::get_recipe( $linked_recipe_id );
100
+        if ( $linked_recipe ) {
101
+            return \WPRM_Metadata::get_metadata_details( $linked_recipe ) ?: array();
102
+        }
103
+
104
+        return array();
105
+    }
106 106
 
107 107
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param $attachment_service \Wordlift_Attachment_Service
30 30
 	 * @param $recipe_maker_validation_service Recipe_Maker_Validation_Service
31 31
 	 */
32
-	public function __construct( $attachment_service, $recipe_maker_validation_service ) {
32
+	public function __construct($attachment_service, $recipe_maker_validation_service) {
33 33
 
34 34
 		$this->attachment_service              = $attachment_service;
35 35
 		$this->recipe_maker_validation_service = $recipe_maker_validation_service;
@@ -39,47 +39,47 @@  discard block
 block discarded – undo
39 39
 
40 40
 	private function merge_recipe_jsonld() {
41 41
 		// First we push all the linked recipes to references.
42
-		add_filter( 'wl_entity_jsonld_array', array( $this, 'wl_entity_jsonld_array' ), 10, 2 );
43
-		add_filter( 'wl_post_jsonld_array', array( $this, 'wl_entity_jsonld_array' ), 10, 2 );
42
+		add_filter('wl_entity_jsonld_array', array($this, 'wl_entity_jsonld_array'), 10, 2);
43
+		add_filter('wl_post_jsonld_array', array($this, 'wl_entity_jsonld_array'), 10, 2);
44 44
 
45 45
 		// Then we merge the jsonld for every recipe.
46
-		add_filter( 'wl_entity_jsonld', array( $this, 'wl_entity_jsonld' ), 10, 3 );
46
+		add_filter('wl_entity_jsonld', array($this, 'wl_entity_jsonld'), 10, 3);
47 47
 	}
48 48
 
49 49
 
50
-	public function wl_entity_jsonld_array( $arr, $post_id ) {
50
+	public function wl_entity_jsonld_array($arr, $post_id) {
51 51
 
52 52
 		$jsonld     = $arr['jsonld'];
53 53
 		$references = $arr['references'];
54 54
 
55 55
 		// check if wp recipe maker installed, if not return early.
56
-		if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) {
56
+		if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available()) {
57 57
 			return $arr;
58 58
 		}
59 59
 
60 60
 		// 1. Get the jsonld from recipe maker for the post id.
61
-		$recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post( $post_id );
61
+		$recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post($post_id);
62 62
 
63 63
 		// If there are no associated recipes for a post id then return early
64
-		if ( ! $recipe_ids ) {
64
+		if ( ! $recipe_ids) {
65 65
 			return $arr;
66 66
 		}
67 67
 
68 68
 		return array(
69 69
 			'jsonld'     => $jsonld,
70
-			'references' => array_merge( $recipe_ids, $references )
70
+			'references' => array_merge($recipe_ids, $references)
71 71
 		);
72 72
 
73 73
 	}
74 74
 
75 75
 
76
-	public function wl_entity_jsonld( $jsonld, $post_id, $references ) {
77
-		$recipe_data = $this->process_single_recipe_item( $post_id );
78
-		if ( ! $recipe_data ) {
76
+	public function wl_entity_jsonld($jsonld, $post_id, $references) {
77
+		$recipe_data = $this->process_single_recipe_item($post_id);
78
+		if ( ! $recipe_data) {
79 79
 			return $jsonld;
80 80
 		}
81 81
 
82
-		if ( ! $jsonld ) {
82
+		if ( ! $jsonld) {
83 83
 			return $recipe_data;
84 84
 		}
85 85
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return array Recipe valid jsonld data.
93 93
 	 */
94
-	private function process_single_recipe_item( $linked_recipe_id ) {
94
+	private function process_single_recipe_item($linked_recipe_id) {
95 95
 		// check if recipe maker present.
96
-		if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) {
96
+		if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available()) {
97 97
 			return array();
98 98
 		}
99
-		$linked_recipe = \WPRM_Recipe_Manager::get_recipe( $linked_recipe_id );
100
-		if ( $linked_recipe ) {
101
-			return \WPRM_Metadata::get_metadata_details( $linked_recipe ) ?: array();
99
+		$linked_recipe = \WPRM_Recipe_Manager::get_recipe($linked_recipe_id);
100
+		if ($linked_recipe) {
101
+			return \WPRM_Metadata::get_metadata_details($linked_recipe) ?: array();
102 102
 		}
103 103
 
104 104
 		return array();
Please login to merge, or discard this patch.
external-plugin-hooks/recipe-maker/class-recipe-maker-jsonld-swap.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -11,61 +11,61 @@
 block discarded – undo
11 11
 class Recipe_Maker_Jsonld_Swap {
12 12
 
13 13
 
14
-	/**
15
-	 * @var Recipe_Maker_Validation_Service
16
-	 */
17
-	private $validation_service;
18
-	/**
19
-	 * @var \Wordlift_Jsonld_Service
20
-	 */
21
-	private $jsonld_service;
22
-
23
-	/**
24
-	 * @param $validation_service Recipe_Maker_Validation_Service
25
-	 */
26
-	public function __construct( $validation_service, $jsonld_service ) {
27
-
28
-		$this->validation_service = $validation_service;
29
-		$this->jsonld_service     = $jsonld_service;
30
-
31
-		add_filter( 'wprm_recipe_metadata', array( $this, 'alter_jsonld' ), 10, 2 );
32
-	}
33
-
34
-	/**
35
-	 * Remove recipe maker jsonld or add mentions based on the integration.
36
-	 *
37
-	 * @param $metadata
38
-	 * @param $recipe
39
-	 *
40
-	 * @return array
41
-	 */
42
-	public function alter_jsonld( $metadata, $recipe ) {
43
-
44
-		// If this filter is invoked on any other page except post, then we should not modify the jsonld.
45
-		if ( ! get_post() instanceof \WP_Post ) {
46
-			return $metadata;
47
-		}
48
-
49
-		$post_id = get_the_ID();
50
-
51
-		/**
52
-		 * We dont print our jsonld when the page has recipe maker, we enhance the recipe maker jsonld
53
-		 * by adding only the `mentions` property.
54
-		 */
55
-		add_filter( 'wl_jsonld_enabled', '__return_false' );
56
-
57
-		$post_jsonld = $this->jsonld_service->get_jsonld( false, $post_id, Jsonld_Context_Enum::PAGE );
58
-
59
-		if ( 0 === count( $post_jsonld ) || ! array_key_exists( 'mentions', $post_jsonld[0] )
60
-		     || 0 === count( $post_jsonld[0]['mentions'] ) ) {
61
-			// Even if we don't have mentions return the metadata.
62
-			return $metadata;
63
-		}
64
-
65
-		$metadata['mentions'] = $post_jsonld[0]['mentions'];
66
-
67
-		return $metadata;
68
-	}
14
+    /**
15
+     * @var Recipe_Maker_Validation_Service
16
+     */
17
+    private $validation_service;
18
+    /**
19
+     * @var \Wordlift_Jsonld_Service
20
+     */
21
+    private $jsonld_service;
22
+
23
+    /**
24
+     * @param $validation_service Recipe_Maker_Validation_Service
25
+     */
26
+    public function __construct( $validation_service, $jsonld_service ) {
27
+
28
+        $this->validation_service = $validation_service;
29
+        $this->jsonld_service     = $jsonld_service;
30
+
31
+        add_filter( 'wprm_recipe_metadata', array( $this, 'alter_jsonld' ), 10, 2 );
32
+    }
33
+
34
+    /**
35
+     * Remove recipe maker jsonld or add mentions based on the integration.
36
+     *
37
+     * @param $metadata
38
+     * @param $recipe
39
+     *
40
+     * @return array
41
+     */
42
+    public function alter_jsonld( $metadata, $recipe ) {
43
+
44
+        // If this filter is invoked on any other page except post, then we should not modify the jsonld.
45
+        if ( ! get_post() instanceof \WP_Post ) {
46
+            return $metadata;
47
+        }
48
+
49
+        $post_id = get_the_ID();
50
+
51
+        /**
52
+         * We dont print our jsonld when the page has recipe maker, we enhance the recipe maker jsonld
53
+         * by adding only the `mentions` property.
54
+         */
55
+        add_filter( 'wl_jsonld_enabled', '__return_false' );
56
+
57
+        $post_jsonld = $this->jsonld_service->get_jsonld( false, $post_id, Jsonld_Context_Enum::PAGE );
58
+
59
+        if ( 0 === count( $post_jsonld ) || ! array_key_exists( 'mentions', $post_jsonld[0] )
60
+             || 0 === count( $post_jsonld[0]['mentions'] ) ) {
61
+            // Even if we don't have mentions return the metadata.
62
+            return $metadata;
63
+        }
64
+
65
+        $metadata['mentions'] = $post_jsonld[0]['mentions'];
66
+
67
+        return $metadata;
68
+    }
69 69
 
70 70
 
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * @param $validation_service Recipe_Maker_Validation_Service
25 25
 	 */
26
-	public function __construct( $validation_service, $jsonld_service ) {
26
+	public function __construct($validation_service, $jsonld_service) {
27 27
 
28 28
 		$this->validation_service = $validation_service;
29 29
 		$this->jsonld_service     = $jsonld_service;
30 30
 
31
-		add_filter( 'wprm_recipe_metadata', array( $this, 'alter_jsonld' ), 10, 2 );
31
+		add_filter('wprm_recipe_metadata', array($this, 'alter_jsonld'), 10, 2);
32 32
 	}
33 33
 
34 34
 	/**
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return array
41 41
 	 */
42
-	public function alter_jsonld( $metadata, $recipe ) {
42
+	public function alter_jsonld($metadata, $recipe) {
43 43
 
44 44
 		// If this filter is invoked on any other page except post, then we should not modify the jsonld.
45
-		if ( ! get_post() instanceof \WP_Post ) {
45
+		if ( ! get_post() instanceof \WP_Post) {
46 46
 			return $metadata;
47 47
 		}
48 48
 
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 		 * We dont print our jsonld when the page has recipe maker, we enhance the recipe maker jsonld
53 53
 		 * by adding only the `mentions` property.
54 54
 		 */
55
-		add_filter( 'wl_jsonld_enabled', '__return_false' );
55
+		add_filter('wl_jsonld_enabled', '__return_false');
56 56
 
57
-		$post_jsonld = $this->jsonld_service->get_jsonld( false, $post_id, Jsonld_Context_Enum::PAGE );
57
+		$post_jsonld = $this->jsonld_service->get_jsonld(false, $post_id, Jsonld_Context_Enum::PAGE);
58 58
 
59
-		if ( 0 === count( $post_jsonld ) || ! array_key_exists( 'mentions', $post_jsonld[0] )
60
-		     || 0 === count( $post_jsonld[0]['mentions'] ) ) {
59
+		if (0 === count($post_jsonld) || ! array_key_exists('mentions', $post_jsonld[0])
60
+		     || 0 === count($post_jsonld[0]['mentions'])) {
61 61
 			// Even if we don't have mentions return the metadata.
62 62
 			return $metadata;
63 63
 		}
Please login to merge, or discard this patch.
src/includes/class-wordlift-post-to-jsonld-converter.php 2 patches
Indentation   +488 added lines, -488 removed lines patch added patch discarded remove patch
@@ -19,512 +19,512 @@
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter {
21 21
 
22
-	/**
23
-	 * @var Wordlift_Post_To_Jsonld_Converter
24
-	 */
25
-	private static $instance;
26
-
27
-	/**
28
-	 * A {@link Wordlift_Log_Service} instance.
29
-	 *
30
-	 * @since  3.10.0
31
-	 * @access private
32
-	 * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
33
-	 */
34
-	private $log;
35
-
36
-	/**
37
-	 * @var false
38
-	 */
39
-	private $disable_convert_filters;
40
-	/**
41
-	 * @var Object_Relation_Service
42
-	 */
43
-	private $object_relation_service;
44
-
45
-	/**
46
-	 * Wordlift_Post_To_Jsonld_Converter constructor.
47
-	 *
48
-	 * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
49
-	 * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance.
50
-	 * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
51
-	 *
52
-	 * @since 3.10.0
53
-	 *
54
-	 */
55
-	public function __construct( $entity_type_service, $user_service, $attachment_service, $disable_convert_filters = false ) {
56
-		parent::__construct( $entity_type_service, $user_service, $attachment_service );
57
-		$this->disable_convert_filters = $disable_convert_filters;
58
-		$this->object_relation_service = Object_Relation_Service::get_instance();
59
-		// Set a reference to the logger.
60
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
61
-
62
-		self::$instance = $this;
63
-
64
-	}
65
-
66
-	public static function get_instance() {
67
-
68
-		return self::$instance;
69
-	}
70
-
71
-	public function new_instance_with_filters_disabled() {
72
-		return new static( $this->entity_type_service, $this->user_service, $this->attachment_service, true );
73
-	}
74
-
75
-	/**
76
-	 * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
77
-	 * found while processing the post is set in the $references array.
78
-	 *
79
-	 * @param int $post_id The post id.
80
-	 * @param array<Reference> $references An array of entity references.
81
-	 * @param array $references_infos
82
-	 *
83
-	 * @return array A JSON-LD array.
84
-	 * @since 3.10.0
85
-	 */
86
-	public function convert( $post_id, &$references = array(), &$references_infos = array() ) {
87
-
88
-		// Get the post instance.
89
-		if ( null === $post = get_post( $post_id ) ) {
90
-			// Post not found.
91
-			return null;
92
-		}
93
-
94
-		// Get the base JSON-LD and the list of entities referenced by this entity.
95
-		$jsonld = parent::convert( $post_id, $references, $references_infos );
96
-
97
-		// Set WebPage by default.
98
-		if ( empty( $jsonld['@type'] ) ) {
99
-			$jsonld['@type'] = 'WebPage';
100
-		}
101
-
102
-		// Get the entity name.
103
-		$jsonld['headline'] = $post->post_title;
104
-		$urls               = Wordlift_Schema_Url_Property_Service::get_instance()->get( $post->ID );
105
-		if ( ! empty( $urls ) ) {
106
-			$jsonld['url'] = self::make_one( $urls );
107
-		}
108
-
109
-		// Set the published and modified dates.
110
-		/*
22
+    /**
23
+     * @var Wordlift_Post_To_Jsonld_Converter
24
+     */
25
+    private static $instance;
26
+
27
+    /**
28
+     * A {@link Wordlift_Log_Service} instance.
29
+     *
30
+     * @since  3.10.0
31
+     * @access private
32
+     * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
33
+     */
34
+    private $log;
35
+
36
+    /**
37
+     * @var false
38
+     */
39
+    private $disable_convert_filters;
40
+    /**
41
+     * @var Object_Relation_Service
42
+     */
43
+    private $object_relation_service;
44
+
45
+    /**
46
+     * Wordlift_Post_To_Jsonld_Converter constructor.
47
+     *
48
+     * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
49
+     * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance.
50
+     * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
51
+     *
52
+     * @since 3.10.0
53
+     *
54
+     */
55
+    public function __construct( $entity_type_service, $user_service, $attachment_service, $disable_convert_filters = false ) {
56
+        parent::__construct( $entity_type_service, $user_service, $attachment_service );
57
+        $this->disable_convert_filters = $disable_convert_filters;
58
+        $this->object_relation_service = Object_Relation_Service::get_instance();
59
+        // Set a reference to the logger.
60
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
61
+
62
+        self::$instance = $this;
63
+
64
+    }
65
+
66
+    public static function get_instance() {
67
+
68
+        return self::$instance;
69
+    }
70
+
71
+    public function new_instance_with_filters_disabled() {
72
+        return new static( $this->entity_type_service, $this->user_service, $this->attachment_service, true );
73
+    }
74
+
75
+    /**
76
+     * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
77
+     * found while processing the post is set in the $references array.
78
+     *
79
+     * @param int $post_id The post id.
80
+     * @param array<Reference> $references An array of entity references.
81
+     * @param array $references_infos
82
+     *
83
+     * @return array A JSON-LD array.
84
+     * @since 3.10.0
85
+     */
86
+    public function convert( $post_id, &$references = array(), &$references_infos = array() ) {
87
+
88
+        // Get the post instance.
89
+        if ( null === $post = get_post( $post_id ) ) {
90
+            // Post not found.
91
+            return null;
92
+        }
93
+
94
+        // Get the base JSON-LD and the list of entities referenced by this entity.
95
+        $jsonld = parent::convert( $post_id, $references, $references_infos );
96
+
97
+        // Set WebPage by default.
98
+        if ( empty( $jsonld['@type'] ) ) {
99
+            $jsonld['@type'] = 'WebPage';
100
+        }
101
+
102
+        // Get the entity name.
103
+        $jsonld['headline'] = $post->post_title;
104
+        $urls               = Wordlift_Schema_Url_Property_Service::get_instance()->get( $post->ID );
105
+        if ( ! empty( $urls ) ) {
106
+            $jsonld['url'] = self::make_one( $urls );
107
+        }
108
+
109
+        // Set the published and modified dates.
110
+        /*
111 111
 		 * Set the `datePublished` and `dateModified` using the local timezone.
112 112
 		 *
113 113
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/887
114 114
 		 *
115 115
 		 * @since 3.20.0
116 116
 		 */
117
-		try {
118
-			$default_timezone = date_default_timezone_get();
119
-			$timezone         = get_option( 'timezone_string' );
120
-			if ( ! empty( $timezone ) ) {
121
-				date_default_timezone_set( $timezone );
122
-				$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i:sP', false, $post );
123
-				$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i:sP', false, $post );
124
-				date_default_timezone_set( $default_timezone );
125
-			} else {
126
-				$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
127
-				$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
128
-			}
129
-		} catch ( Exception $e ) {
130
-			$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
131
-			$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
132
-		}
133
-
134
-		// Get the word count for the post.
135
-		/*
117
+        try {
118
+            $default_timezone = date_default_timezone_get();
119
+            $timezone         = get_option( 'timezone_string' );
120
+            if ( ! empty( $timezone ) ) {
121
+                date_default_timezone_set( $timezone );
122
+                $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i:sP', false, $post );
123
+                $jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i:sP', false, $post );
124
+                date_default_timezone_set( $default_timezone );
125
+            } else {
126
+                $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
127
+                $jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
128
+            }
129
+        } catch ( Exception $e ) {
130
+            $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
131
+            $jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
132
+        }
133
+
134
+        // Get the word count for the post.
135
+        /*
136 136
 		 * Do not display the `wordCount` on a `WebPage`.
137 137
 		 *
138 138
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/888
139 139
 		 *
140 140
 		 * @since 3.20.0
141 141
 		 */
142
-		if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) {
143
-			$post_adapter        = new Wordlift_Post_Adapter( $post_id );
144
-			$jsonld['wordCount'] = $post_adapter->word_count();
145
-		}
142
+        if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) {
143
+            $post_adapter        = new Wordlift_Post_Adapter( $post_id );
144
+            $jsonld['wordCount'] = $post_adapter->word_count();
145
+        }
146 146
 
147
-		/*
147
+        /*
148 148
 		 * Add keywords, articleSection, commentCount and inLanguage properties to `Article` JSON-LD
149 149
 		 *
150 150
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/1140
151 151
 		 *
152 152
 		 * @since 3.27.2
153 153
 		 */
154
-		if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) {
155
-			$post_adapter    = new Wordlift_Post_Adapter( $post_id );
156
-			$keywords        = $post_adapter->keywords();
157
-			$article_section = $post_adapter->article_section();
158
-			$comment_count   = $post_adapter->comment_count();
159
-			$locale          = $post_adapter->locale();
160
-
161
-			if ( isset( $keywords ) ) {
162
-				$jsonld['keywords'] = $keywords;
163
-			}
164
-			if ( ! empty( $article_section ) ) {
165
-				$jsonld['articleSection'] = $article_section;
166
-			}
167
-			$jsonld['commentCount'] = $comment_count;
168
-			$jsonld['inLanguage']   = $locale;
169
-			$post_adapter->add_references( $post_id, $references );
170
-		}
171
-
172
-		// Set the publisher.
173
-		$this->set_publisher( $jsonld );
174
-
175
-		$references = $this->convert_references( $references );
176
-
177
-		// Process the references if any.
178
-		$this->set_mentions_and_about( $references, $post, $jsonld );
179
-
180
-		// Finally set the author.
181
-		$jsonld['author'] = $this->get_author( $post->post_author, $references );
182
-
183
-		// Return the JSON-LD if filters are disabled by the client.
184
-		if ( $this->disable_convert_filters ) {
185
-			return $jsonld;
186
-		}
187
-
188
-		/**
189
-		 * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references.
190
-		 *
191
-		 * @param array $value {
192
-		 *
193
-		 * @type array $jsonld The JSON-LD structure.
194
-		 * @type int[] $references An array of post IDs.
195
-		 * }
196
-		 * @since 3.25.0
197
-		 *
198
-		 * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/
199
-		 *
200
-		 * @api
201
-		 */
202
-		$ret_val = apply_filters( 'wl_post_jsonld_array', array(
203
-			'jsonld'     => $jsonld,
204
-			'references' => $references,
205
-		), $post_id );
206
-
207
-		$jsonld     = $ret_val['jsonld'];
208
-		$references = $ret_val['references'];
209
-
210
-		/**
211
-		 * Call the `wl_post_jsonld` filter.
212
-		 *
213
-		 * @param array $jsonld The JSON-LD structure.
214
-		 * @param int $post_id The {@link WP_Post} `id`.
215
-		 * @param array $references The array of referenced entities.
216
-		 *
217
-		 * @since 3.14.0
218
-		 *
219
-		 * @api
220
-		 */
221
-		return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references );
222
-	}
223
-
224
-	/**
225
-	 * Get the author's JSON-LD fragment.
226
-	 *
227
-	 * The JSON-LD fragment is generated using the {@link WP_User}'s data or
228
-	 * the referenced entity if configured for the {@link WP_User}.
229
-	 *
230
-	 * @param int $author_id The author {@link WP_User}'s `id`.
231
-	 * @param array $references An array of referenced entities.
232
-	 *
233
-	 * @return string|array A JSON-LD structure.
234
-	 * @since 3.14.0
235
-	 *
236
-	 */
237
-	public function get_author( $author_id, &$references ) {
238
-
239
-		// Get the entity bound to this user.
240
-		$entity_id = $this->user_service->get_entity( $author_id );
241
-
242
-		// If there's no entity bound return a simple author structure.
243
-		if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) {
244
-
245
-			$author            = get_the_author_meta( 'display_name', $author_id );
246
-			$author_first_name = get_the_author_meta( 'first_name', $author_id );
247
-			$author_last_name  = get_the_author_meta( 'last_name', $author_id );
248
-			$author_uri        = $this->user_service->get_uri( $author_id );
249
-
250
-			return array(
251
-				'@type'      => 'Person',
252
-				'@id'        => $author_uri,
253
-				'name'       => $author,
254
-				'givenName'  => $author_first_name,
255
-				'familyName' => $author_last_name,
256
-				'url'        => get_author_posts_url( $author_id ),
257
-			);
258
-		}
259
-
260
-		// Add the author to the references.
261
-		$author_uri   = Wordlift_Entity_Service::get_instance()->get_uri( $entity_id );
262
-		$references[] = $entity_id;
263
-
264
-		// Return the JSON-LD for the referenced entity.
265
-		return array(
266
-			'@id' => $author_uri,
267
-		);
268
-	}
269
-
270
-	/**
271
-	 * Enrich the provided params array with publisher data, if available.
272
-	 *
273
-	 * @param array $params The parameters array.
274
-	 *
275
-	 * @since 3.10.0
276
-	 *
277
-	 */
278
-	protected function set_publisher( &$params ) {
279
-
280
-		// If the publisher id isn't set don't do anything.
281
-		if ( null === $publisher_id = Wordlift_Configuration_Service::get_instance()->get_publisher_id() ) {
282
-			return;
283
-		}
284
-
285
-		// Get the post instance.
286
-		if ( null === $post = get_post( $publisher_id ) ) {
287
-			// Publisher not found.
288
-			return;
289
-		}
290
-
291
-		// Get the item id.
292
-		$id = Wordlift_Entity_Service::get_instance()->get_uri( $publisher_id );
293
-
294
-		// Get the type.
295
-		$type = $this->entity_type_service->get( $publisher_id );
296
-
297
-		// Get the name.
298
-		$name = $post->post_title;
299
-
300
-		// Set the publisher data.
301
-		$params['publisher'] = array(
302
-			'@type' => $this->relative_to_context( $type['uri'] ),
303
-			'@id'   => $id,
304
-			'name'  => $name,
305
-		);
306
-
307
-		// Add the sameAs values associated with the publisher.
308
-		$storage_factory = Wordlift_Storage_Factory::get_instance();
309
-		$sameas          = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id );
310
-		if ( ! empty( $sameas ) ) {
311
-			$params['publisher']['sameAs'] = $sameas;
312
-		}
313
-
314
-		// Set the logo, only for http://schema.org/Organization as Person doesn't
315
-		// support the logo property.
316
-		//
317
-		// See http://schema.org/logo.
318
-		if ( 1 !== preg_match( '~Organization$~', $type['uri'] ) ) {
319
-			return;
320
-		}
321
-
322
-		// Get the publisher logo.
323
-		$publisher_logo = $this->get_publisher_logo( $post->ID );
324
-
325
-		// Bail out if the publisher logo isn't set.
326
-		if ( false === $publisher_logo ) {
327
-			return;
328
-		}
329
-
330
-		// Copy over some useful properties.
331
-		//
332
-		// See https://developers.google.com/search/docs/data-types/articles.
333
-		$params['publisher']['logo']['@type'] = 'ImageObject';
334
-		$params['publisher']['logo']['url']   = $publisher_logo['url'];
335
-
336
-		// If you specify a "width" or "height" value you should leave out
337
-		// 'px'. For example: "width":"4608px" should be "width":"4608".
338
-		//
339
-		// See https://github.com/insideout10/wordlift-plugin/issues/451.
340
-		$params['publisher']['logo']['width']  = $publisher_logo['width'];
341
-		$params['publisher']['logo']['height'] = $publisher_logo['height'];
342
-
343
-	}
344
-
345
-	/**
346
-	 * Get the publisher logo structure.
347
-	 *
348
-	 * The function returns false when the publisher logo cannot be determined, i.e.:
349
-	 *  - the post has no featured image.
350
-	 *  - the featured image has no file.
351
-	 *  - a wp_image_editor instance cannot be instantiated on the original file or on the publisher logo file.
352
-	 *
353
-	 * @param int $post_id The post id.
354
-	 *
355
-	 * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case
356
-	 *  of errors.
357
-	 * @since 3.19.2
358
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue.
359
-	 *
360
-	 */
361
-	private function get_publisher_logo( $post_id ) {
362
-
363
-		// Get the featured image for the post.
364
-		$thumbnail_id = get_post_thumbnail_id( $post_id );
365
-
366
-		// Bail out if thumbnail not available.
367
-		if ( empty( $thumbnail_id ) || 0 === $thumbnail_id ) {
368
-			$this->log->info( "Featured image not set for post $post_id." );
369
-
370
-			return false;
371
-		}
372
-
373
-		// Get the uploads base URL.
374
-		$uploads_dir = wp_upload_dir();
375
-
376
-		// Get the attachment metadata.
377
-		$metadata = wp_get_attachment_metadata( $thumbnail_id );
378
-
379
-		// Bail out if the file isn't set.
380
-		if ( ! isset( $metadata['file'] ) ) {
381
-			$this->log->warn( "Featured image file not found for post $post_id." );
382
-
383
-			return false;
384
-		}
385
-
386
-		// Retrieve the relative filename, e.g. "2018/05/logo_publisher.png"
387
-		$path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file'];
388
-
389
-		// Use image src, if local file does not exist. @see https://github.com/insideout10/wordlift-plugin/issues/1149
390
-		if ( ! file_exists( $path ) ) {
391
-			$this->log->warn( "Featured image file $path doesn't exist for post $post_id." );
392
-
393
-			$attachment_image_src = wp_get_attachment_image_src( $thumbnail_id, '' );
394
-			if ( $attachment_image_src ) {
395
-				return array(
396
-					'url'    => $attachment_image_src[0],
397
-					'width'  => $attachment_image_src[1],
398
-					'height' => $attachment_image_src[2],
399
-				);
400
-			}
401
-
402
-			// Bail out if we cant fetch wp_get_attachment_image_src
403
-			return false;
404
-
405
-		}
406
-
407
-		// Try to get the image editor and bail out if the editor cannot be instantiated.
408
-		$original_file_editor = wp_get_image_editor( $path );
409
-		if ( is_wp_error( $original_file_editor ) ) {
410
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." );
411
-
412
-			return false;
413
-		}
414
-
415
-		// Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling
416
-		// and we don't actually know the end values.
417
-		$publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' );
418
-
419
-		// If the file doesn't exist yet, create it.
420
-		if ( ! file_exists( $publisher_logo_path ) ) {
421
-			$original_file_editor->resize( 600, 60 );
422
-			$original_file_editor->save( $publisher_logo_path );
423
-		}
424
-
425
-		// Try to get the image editor and bail out if the editor cannot be instantiated.
426
-		$publisher_logo_editor = wp_get_image_editor( $publisher_logo_path );
427
-		if ( is_wp_error( $publisher_logo_editor ) ) {
428
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." );
429
-
430
-			return false;
431
-		}
432
-
433
-		// Get the actual size.
434
-		$size = $publisher_logo_editor->get_size();
435
-
436
-		// Finally return the array with data.
437
-		return array(
438
-			'url'    => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ),
439
-			'width'  => $size['width'],
440
-			'height' => $size['height'],
441
-		);
442
-	}
443
-
444
-	/**
445
-	 * @param $references
446
-	 * @param $post
447
-	 * @param $jsonld
448
-	 *
449
-	 * @return void
450
-	 *
451
-	 */
452
-	private function set_mentions_and_about( $references, $post, &$jsonld ) {
453
-
454
-		if ( count( $references ) === 0 ) {
455
-			return;
456
-		}
457
-
458
-		// Prepare the `about` and `mentions` array.
459
-		$about = $mentions = array();
460
-
461
-		// If the entity is in the title, then it should be an `about`.
462
-		foreach ( $references as $reference ) {
463
-
464
-			if ( ! $reference instanceof Reference ) {
465
-				// This condition should never be reached.
466
-				continue;
467
-			}
468
-
469
-			// Get the entity labels.
470
-			$labels = Wordlift_Entity_Service::get_instance()->get_labels( $reference->get_id(), $reference->get_type() );
471
-			// Get the entity URI.
472
-			$item = array(
473
-				'@id' => Wordlift_Entity_Service::get_instance()->get_uri( $reference->get_id(), $reference->get_type() ),
474
-			);
475
-
476
-			$escaped_labels = array_map( function ( $value ) {
477
-				return preg_quote( $value, '/' );
478
-			}, $labels );
479
-
480
-
481
-			$matches = false;
482
-
483
-			// When the title is empty, then we shouldn't yield a match to about section.
484
-			if ( array_filter( $escaped_labels ) ) {
485
-				// Check if the labels match any part of the title.
486
-				$matches = 1 === preg_match( '/' . implode( '|', $escaped_labels ) . '/', $post->post_title );
487
-			}
488
-
489
-			// If the title matches, assign the entity to the about, otherwise to the mentions.
490
-			if ( $matches ) {
491
-				$about[] = $item;
492
-			} else {
493
-				$mentions[] = $item;
494
-			}
495
-		}
496
-
497
-		// If we have abouts, assign them to the JSON-LD.
498
-		if ( 0 < count( $about ) ) {
499
-			$jsonld['about'] = $about;
500
-		}
501
-
502
-		// If we have mentions, assign them to the JSON-LD.
503
-		if ( 0 < count( $mentions ) ) {
504
-			$jsonld['mentions'] = $mentions;
505
-		}
506
-
507
-		return $jsonld;
508
-	}
509
-
510
-	/**
511
-	 * Convert references to abstract data type if we find any.
512
-	 *
513
-	 * @param $references array<int|Reference>
514
-	 *
515
-	 * @return Reference[]
516
-	 */
517
-	private function convert_references( $references ) {
518
-		return array_map( function ( $reference ) {
519
-			// Legacy code may still push numerical references to this
520
-			// $references variable, so convert it to post references.
521
-			if ( is_numeric( $reference ) ) {
522
-				return new Post_Reference( $reference );
523
-			}
524
-
525
-			return $reference;
526
-
527
-		}, $references );
528
-	}
154
+        if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) {
155
+            $post_adapter    = new Wordlift_Post_Adapter( $post_id );
156
+            $keywords        = $post_adapter->keywords();
157
+            $article_section = $post_adapter->article_section();
158
+            $comment_count   = $post_adapter->comment_count();
159
+            $locale          = $post_adapter->locale();
160
+
161
+            if ( isset( $keywords ) ) {
162
+                $jsonld['keywords'] = $keywords;
163
+            }
164
+            if ( ! empty( $article_section ) ) {
165
+                $jsonld['articleSection'] = $article_section;
166
+            }
167
+            $jsonld['commentCount'] = $comment_count;
168
+            $jsonld['inLanguage']   = $locale;
169
+            $post_adapter->add_references( $post_id, $references );
170
+        }
171
+
172
+        // Set the publisher.
173
+        $this->set_publisher( $jsonld );
174
+
175
+        $references = $this->convert_references( $references );
176
+
177
+        // Process the references if any.
178
+        $this->set_mentions_and_about( $references, $post, $jsonld );
179
+
180
+        // Finally set the author.
181
+        $jsonld['author'] = $this->get_author( $post->post_author, $references );
182
+
183
+        // Return the JSON-LD if filters are disabled by the client.
184
+        if ( $this->disable_convert_filters ) {
185
+            return $jsonld;
186
+        }
187
+
188
+        /**
189
+         * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references.
190
+         *
191
+         * @param array $value {
192
+         *
193
+         * @type array $jsonld The JSON-LD structure.
194
+         * @type int[] $references An array of post IDs.
195
+         * }
196
+         * @since 3.25.0
197
+         *
198
+         * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/
199
+         *
200
+         * @api
201
+         */
202
+        $ret_val = apply_filters( 'wl_post_jsonld_array', array(
203
+            'jsonld'     => $jsonld,
204
+            'references' => $references,
205
+        ), $post_id );
206
+
207
+        $jsonld     = $ret_val['jsonld'];
208
+        $references = $ret_val['references'];
209
+
210
+        /**
211
+         * Call the `wl_post_jsonld` filter.
212
+         *
213
+         * @param array $jsonld The JSON-LD structure.
214
+         * @param int $post_id The {@link WP_Post} `id`.
215
+         * @param array $references The array of referenced entities.
216
+         *
217
+         * @since 3.14.0
218
+         *
219
+         * @api
220
+         */
221
+        return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references );
222
+    }
223
+
224
+    /**
225
+     * Get the author's JSON-LD fragment.
226
+     *
227
+     * The JSON-LD fragment is generated using the {@link WP_User}'s data or
228
+     * the referenced entity if configured for the {@link WP_User}.
229
+     *
230
+     * @param int $author_id The author {@link WP_User}'s `id`.
231
+     * @param array $references An array of referenced entities.
232
+     *
233
+     * @return string|array A JSON-LD structure.
234
+     * @since 3.14.0
235
+     *
236
+     */
237
+    public function get_author( $author_id, &$references ) {
238
+
239
+        // Get the entity bound to this user.
240
+        $entity_id = $this->user_service->get_entity( $author_id );
241
+
242
+        // If there's no entity bound return a simple author structure.
243
+        if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) {
244
+
245
+            $author            = get_the_author_meta( 'display_name', $author_id );
246
+            $author_first_name = get_the_author_meta( 'first_name', $author_id );
247
+            $author_last_name  = get_the_author_meta( 'last_name', $author_id );
248
+            $author_uri        = $this->user_service->get_uri( $author_id );
249
+
250
+            return array(
251
+                '@type'      => 'Person',
252
+                '@id'        => $author_uri,
253
+                'name'       => $author,
254
+                'givenName'  => $author_first_name,
255
+                'familyName' => $author_last_name,
256
+                'url'        => get_author_posts_url( $author_id ),
257
+            );
258
+        }
259
+
260
+        // Add the author to the references.
261
+        $author_uri   = Wordlift_Entity_Service::get_instance()->get_uri( $entity_id );
262
+        $references[] = $entity_id;
263
+
264
+        // Return the JSON-LD for the referenced entity.
265
+        return array(
266
+            '@id' => $author_uri,
267
+        );
268
+    }
269
+
270
+    /**
271
+     * Enrich the provided params array with publisher data, if available.
272
+     *
273
+     * @param array $params The parameters array.
274
+     *
275
+     * @since 3.10.0
276
+     *
277
+     */
278
+    protected function set_publisher( &$params ) {
279
+
280
+        // If the publisher id isn't set don't do anything.
281
+        if ( null === $publisher_id = Wordlift_Configuration_Service::get_instance()->get_publisher_id() ) {
282
+            return;
283
+        }
284
+
285
+        // Get the post instance.
286
+        if ( null === $post = get_post( $publisher_id ) ) {
287
+            // Publisher not found.
288
+            return;
289
+        }
290
+
291
+        // Get the item id.
292
+        $id = Wordlift_Entity_Service::get_instance()->get_uri( $publisher_id );
293
+
294
+        // Get the type.
295
+        $type = $this->entity_type_service->get( $publisher_id );
296
+
297
+        // Get the name.
298
+        $name = $post->post_title;
299
+
300
+        // Set the publisher data.
301
+        $params['publisher'] = array(
302
+            '@type' => $this->relative_to_context( $type['uri'] ),
303
+            '@id'   => $id,
304
+            'name'  => $name,
305
+        );
306
+
307
+        // Add the sameAs values associated with the publisher.
308
+        $storage_factory = Wordlift_Storage_Factory::get_instance();
309
+        $sameas          = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id );
310
+        if ( ! empty( $sameas ) ) {
311
+            $params['publisher']['sameAs'] = $sameas;
312
+        }
313
+
314
+        // Set the logo, only for http://schema.org/Organization as Person doesn't
315
+        // support the logo property.
316
+        //
317
+        // See http://schema.org/logo.
318
+        if ( 1 !== preg_match( '~Organization$~', $type['uri'] ) ) {
319
+            return;
320
+        }
321
+
322
+        // Get the publisher logo.
323
+        $publisher_logo = $this->get_publisher_logo( $post->ID );
324
+
325
+        // Bail out if the publisher logo isn't set.
326
+        if ( false === $publisher_logo ) {
327
+            return;
328
+        }
329
+
330
+        // Copy over some useful properties.
331
+        //
332
+        // See https://developers.google.com/search/docs/data-types/articles.
333
+        $params['publisher']['logo']['@type'] = 'ImageObject';
334
+        $params['publisher']['logo']['url']   = $publisher_logo['url'];
335
+
336
+        // If you specify a "width" or "height" value you should leave out
337
+        // 'px'. For example: "width":"4608px" should be "width":"4608".
338
+        //
339
+        // See https://github.com/insideout10/wordlift-plugin/issues/451.
340
+        $params['publisher']['logo']['width']  = $publisher_logo['width'];
341
+        $params['publisher']['logo']['height'] = $publisher_logo['height'];
342
+
343
+    }
344
+
345
+    /**
346
+     * Get the publisher logo structure.
347
+     *
348
+     * The function returns false when the publisher logo cannot be determined, i.e.:
349
+     *  - the post has no featured image.
350
+     *  - the featured image has no file.
351
+     *  - a wp_image_editor instance cannot be instantiated on the original file or on the publisher logo file.
352
+     *
353
+     * @param int $post_id The post id.
354
+     *
355
+     * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case
356
+     *  of errors.
357
+     * @since 3.19.2
358
+     * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue.
359
+     *
360
+     */
361
+    private function get_publisher_logo( $post_id ) {
362
+
363
+        // Get the featured image for the post.
364
+        $thumbnail_id = get_post_thumbnail_id( $post_id );
365
+
366
+        // Bail out if thumbnail not available.
367
+        if ( empty( $thumbnail_id ) || 0 === $thumbnail_id ) {
368
+            $this->log->info( "Featured image not set for post $post_id." );
369
+
370
+            return false;
371
+        }
372
+
373
+        // Get the uploads base URL.
374
+        $uploads_dir = wp_upload_dir();
375
+
376
+        // Get the attachment metadata.
377
+        $metadata = wp_get_attachment_metadata( $thumbnail_id );
378
+
379
+        // Bail out if the file isn't set.
380
+        if ( ! isset( $metadata['file'] ) ) {
381
+            $this->log->warn( "Featured image file not found for post $post_id." );
382
+
383
+            return false;
384
+        }
385
+
386
+        // Retrieve the relative filename, e.g. "2018/05/logo_publisher.png"
387
+        $path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file'];
388
+
389
+        // Use image src, if local file does not exist. @see https://github.com/insideout10/wordlift-plugin/issues/1149
390
+        if ( ! file_exists( $path ) ) {
391
+            $this->log->warn( "Featured image file $path doesn't exist for post $post_id." );
392
+
393
+            $attachment_image_src = wp_get_attachment_image_src( $thumbnail_id, '' );
394
+            if ( $attachment_image_src ) {
395
+                return array(
396
+                    'url'    => $attachment_image_src[0],
397
+                    'width'  => $attachment_image_src[1],
398
+                    'height' => $attachment_image_src[2],
399
+                );
400
+            }
401
+
402
+            // Bail out if we cant fetch wp_get_attachment_image_src
403
+            return false;
404
+
405
+        }
406
+
407
+        // Try to get the image editor and bail out if the editor cannot be instantiated.
408
+        $original_file_editor = wp_get_image_editor( $path );
409
+        if ( is_wp_error( $original_file_editor ) ) {
410
+            $this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." );
411
+
412
+            return false;
413
+        }
414
+
415
+        // Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling
416
+        // and we don't actually know the end values.
417
+        $publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' );
418
+
419
+        // If the file doesn't exist yet, create it.
420
+        if ( ! file_exists( $publisher_logo_path ) ) {
421
+            $original_file_editor->resize( 600, 60 );
422
+            $original_file_editor->save( $publisher_logo_path );
423
+        }
424
+
425
+        // Try to get the image editor and bail out if the editor cannot be instantiated.
426
+        $publisher_logo_editor = wp_get_image_editor( $publisher_logo_path );
427
+        if ( is_wp_error( $publisher_logo_editor ) ) {
428
+            $this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." );
429
+
430
+            return false;
431
+        }
432
+
433
+        // Get the actual size.
434
+        $size = $publisher_logo_editor->get_size();
435
+
436
+        // Finally return the array with data.
437
+        return array(
438
+            'url'    => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ),
439
+            'width'  => $size['width'],
440
+            'height' => $size['height'],
441
+        );
442
+    }
443
+
444
+    /**
445
+     * @param $references
446
+     * @param $post
447
+     * @param $jsonld
448
+     *
449
+     * @return void
450
+     *
451
+     */
452
+    private function set_mentions_and_about( $references, $post, &$jsonld ) {
453
+
454
+        if ( count( $references ) === 0 ) {
455
+            return;
456
+        }
457
+
458
+        // Prepare the `about` and `mentions` array.
459
+        $about = $mentions = array();
460
+
461
+        // If the entity is in the title, then it should be an `about`.
462
+        foreach ( $references as $reference ) {
463
+
464
+            if ( ! $reference instanceof Reference ) {
465
+                // This condition should never be reached.
466
+                continue;
467
+            }
468
+
469
+            // Get the entity labels.
470
+            $labels = Wordlift_Entity_Service::get_instance()->get_labels( $reference->get_id(), $reference->get_type() );
471
+            // Get the entity URI.
472
+            $item = array(
473
+                '@id' => Wordlift_Entity_Service::get_instance()->get_uri( $reference->get_id(), $reference->get_type() ),
474
+            );
475
+
476
+            $escaped_labels = array_map( function ( $value ) {
477
+                return preg_quote( $value, '/' );
478
+            }, $labels );
479
+
480
+
481
+            $matches = false;
482
+
483
+            // When the title is empty, then we shouldn't yield a match to about section.
484
+            if ( array_filter( $escaped_labels ) ) {
485
+                // Check if the labels match any part of the title.
486
+                $matches = 1 === preg_match( '/' . implode( '|', $escaped_labels ) . '/', $post->post_title );
487
+            }
488
+
489
+            // If the title matches, assign the entity to the about, otherwise to the mentions.
490
+            if ( $matches ) {
491
+                $about[] = $item;
492
+            } else {
493
+                $mentions[] = $item;
494
+            }
495
+        }
496
+
497
+        // If we have abouts, assign them to the JSON-LD.
498
+        if ( 0 < count( $about ) ) {
499
+            $jsonld['about'] = $about;
500
+        }
501
+
502
+        // If we have mentions, assign them to the JSON-LD.
503
+        if ( 0 < count( $mentions ) ) {
504
+            $jsonld['mentions'] = $mentions;
505
+        }
506
+
507
+        return $jsonld;
508
+    }
509
+
510
+    /**
511
+     * Convert references to abstract data type if we find any.
512
+     *
513
+     * @param $references array<int|Reference>
514
+     *
515
+     * @return Reference[]
516
+     */
517
+    private function convert_references( $references ) {
518
+        return array_map( function ( $reference ) {
519
+            // Legacy code may still push numerical references to this
520
+            // $references variable, so convert it to post references.
521
+            if ( is_numeric( $reference ) ) {
522
+                return new Post_Reference( $reference );
523
+            }
524
+
525
+            return $reference;
526
+
527
+        }, $references );
528
+    }
529 529
 
530 530
 }
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	 * @since 3.10.0
53 53
 	 *
54 54
 	 */
55
-	public function __construct( $entity_type_service, $user_service, $attachment_service, $disable_convert_filters = false ) {
56
-		parent::__construct( $entity_type_service, $user_service, $attachment_service );
55
+	public function __construct($entity_type_service, $user_service, $attachment_service, $disable_convert_filters = false) {
56
+		parent::__construct($entity_type_service, $user_service, $attachment_service);
57 57
 		$this->disable_convert_filters = $disable_convert_filters;
58 58
 		$this->object_relation_service = Object_Relation_Service::get_instance();
59 59
 		// Set a reference to the logger.
60
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
60
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Post_To_Jsonld_Converter');
61 61
 
62 62
 		self::$instance = $this;
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	public function new_instance_with_filters_disabled() {
72
-		return new static( $this->entity_type_service, $this->user_service, $this->attachment_service, true );
72
+		return new static($this->entity_type_service, $this->user_service, $this->attachment_service, true);
73 73
 	}
74 74
 
75 75
 	/**
@@ -83,27 +83,27 @@  discard block
 block discarded – undo
83 83
 	 * @return array A JSON-LD array.
84 84
 	 * @since 3.10.0
85 85
 	 */
86
-	public function convert( $post_id, &$references = array(), &$references_infos = array() ) {
86
+	public function convert($post_id, &$references = array(), &$references_infos = array()) {
87 87
 
88 88
 		// Get the post instance.
89
-		if ( null === $post = get_post( $post_id ) ) {
89
+		if (null === $post = get_post($post_id)) {
90 90
 			// Post not found.
91 91
 			return null;
92 92
 		}
93 93
 
94 94
 		// Get the base JSON-LD and the list of entities referenced by this entity.
95
-		$jsonld = parent::convert( $post_id, $references, $references_infos );
95
+		$jsonld = parent::convert($post_id, $references, $references_infos);
96 96
 
97 97
 		// Set WebPage by default.
98
-		if ( empty( $jsonld['@type'] ) ) {
98
+		if (empty($jsonld['@type'])) {
99 99
 			$jsonld['@type'] = 'WebPage';
100 100
 		}
101 101
 
102 102
 		// Get the entity name.
103 103
 		$jsonld['headline'] = $post->post_title;
104
-		$urls               = Wordlift_Schema_Url_Property_Service::get_instance()->get( $post->ID );
105
-		if ( ! empty( $urls ) ) {
106
-			$jsonld['url'] = self::make_one( $urls );
104
+		$urls               = Wordlift_Schema_Url_Property_Service::get_instance()->get($post->ID);
105
+		if ( ! empty($urls)) {
106
+			$jsonld['url'] = self::make_one($urls);
107 107
 		}
108 108
 
109 109
 		// Set the published and modified dates.
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 		 */
117 117
 		try {
118 118
 			$default_timezone = date_default_timezone_get();
119
-			$timezone         = get_option( 'timezone_string' );
120
-			if ( ! empty( $timezone ) ) {
121
-				date_default_timezone_set( $timezone );
122
-				$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i:sP', false, $post );
123
-				$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i:sP', false, $post );
124
-				date_default_timezone_set( $default_timezone );
119
+			$timezone         = get_option('timezone_string');
120
+			if ( ! empty($timezone)) {
121
+				date_default_timezone_set($timezone);
122
+				$jsonld['datePublished'] = get_post_time('Y-m-d\TH:i:sP', false, $post);
123
+				$jsonld['dateModified']  = get_post_modified_time('Y-m-d\TH:i:sP', false, $post);
124
+				date_default_timezone_set($default_timezone);
125 125
 			} else {
126
-				$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
127
-				$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
126
+				$jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false);
127
+				$jsonld['dateModified']  = get_post_modified_time('Y-m-d\TH:i', true, $post, false);
128 128
 			}
129
-		} catch ( Exception $e ) {
130
-			$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
131
-			$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
129
+		} catch (Exception $e) {
130
+			$jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false);
131
+			$jsonld['dateModified']  = get_post_modified_time('Y-m-d\TH:i', true, $post, false);
132 132
 		}
133 133
 
134 134
 		// Get the word count for the post.
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 		 *
140 140
 		 * @since 3.20.0
141 141
 		 */
142
-		if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) {
143
-			$post_adapter        = new Wordlift_Post_Adapter( $post_id );
142
+		if ( ! empty($jsonld['@type']) && 'WebPage' !== $jsonld['@type']) {
143
+			$post_adapter        = new Wordlift_Post_Adapter($post_id);
144 144
 			$jsonld['wordCount'] = $post_adapter->word_count();
145 145
 		}
146 146
 
@@ -151,37 +151,37 @@  discard block
 block discarded – undo
151 151
 		 *
152 152
 		 * @since 3.27.2
153 153
 		 */
154
-		if ( ! empty( $jsonld['@type'] ) && 'WebPage' !== $jsonld['@type'] ) {
155
-			$post_adapter    = new Wordlift_Post_Adapter( $post_id );
154
+		if ( ! empty($jsonld['@type']) && 'WebPage' !== $jsonld['@type']) {
155
+			$post_adapter    = new Wordlift_Post_Adapter($post_id);
156 156
 			$keywords        = $post_adapter->keywords();
157 157
 			$article_section = $post_adapter->article_section();
158 158
 			$comment_count   = $post_adapter->comment_count();
159 159
 			$locale          = $post_adapter->locale();
160 160
 
161
-			if ( isset( $keywords ) ) {
161
+			if (isset($keywords)) {
162 162
 				$jsonld['keywords'] = $keywords;
163 163
 			}
164
-			if ( ! empty( $article_section ) ) {
164
+			if ( ! empty($article_section)) {
165 165
 				$jsonld['articleSection'] = $article_section;
166 166
 			}
167 167
 			$jsonld['commentCount'] = $comment_count;
168 168
 			$jsonld['inLanguage']   = $locale;
169
-			$post_adapter->add_references( $post_id, $references );
169
+			$post_adapter->add_references($post_id, $references);
170 170
 		}
171 171
 
172 172
 		// Set the publisher.
173
-		$this->set_publisher( $jsonld );
173
+		$this->set_publisher($jsonld);
174 174
 
175
-		$references = $this->convert_references( $references );
175
+		$references = $this->convert_references($references);
176 176
 
177 177
 		// Process the references if any.
178
-		$this->set_mentions_and_about( $references, $post, $jsonld );
178
+		$this->set_mentions_and_about($references, $post, $jsonld);
179 179
 
180 180
 		// Finally set the author.
181
-		$jsonld['author'] = $this->get_author( $post->post_author, $references );
181
+		$jsonld['author'] = $this->get_author($post->post_author, $references);
182 182
 
183 183
 		// Return the JSON-LD if filters are disabled by the client.
184
-		if ( $this->disable_convert_filters ) {
184
+		if ($this->disable_convert_filters) {
185 185
 			return $jsonld;
186 186
 		}
187 187
 
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 		 *
200 200
 		 * @api
201 201
 		 */
202
-		$ret_val = apply_filters( 'wl_post_jsonld_array', array(
202
+		$ret_val = apply_filters('wl_post_jsonld_array', array(
203 203
 			'jsonld'     => $jsonld,
204 204
 			'references' => $references,
205
-		), $post_id );
205
+		), $post_id);
206 206
 
207 207
 		$jsonld     = $ret_val['jsonld'];
208 208
 		$references = $ret_val['references'];
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		 *
219 219
 		 * @api
220 220
 		 */
221
-		return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references );
221
+		return apply_filters('wl_post_jsonld', $jsonld, $post_id, $references);
222 222
 	}
223 223
 
224 224
 	/**
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 	 * @since 3.14.0
235 235
 	 *
236 236
 	 */
237
-	public function get_author( $author_id, &$references ) {
237
+	public function get_author($author_id, &$references) {
238 238
 
239 239
 		// Get the entity bound to this user.
240
-		$entity_id = $this->user_service->get_entity( $author_id );
240
+		$entity_id = $this->user_service->get_entity($author_id);
241 241
 
242 242
 		// If there's no entity bound return a simple author structure.
243
-		if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) {
243
+		if (empty($entity_id) || 'publish' !== get_post_status($entity_id)) {
244 244
 
245
-			$author            = get_the_author_meta( 'display_name', $author_id );
246
-			$author_first_name = get_the_author_meta( 'first_name', $author_id );
247
-			$author_last_name  = get_the_author_meta( 'last_name', $author_id );
248
-			$author_uri        = $this->user_service->get_uri( $author_id );
245
+			$author            = get_the_author_meta('display_name', $author_id);
246
+			$author_first_name = get_the_author_meta('first_name', $author_id);
247
+			$author_last_name  = get_the_author_meta('last_name', $author_id);
248
+			$author_uri        = $this->user_service->get_uri($author_id);
249 249
 
250 250
 			return array(
251 251
 				'@type'      => 'Person',
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 				'name'       => $author,
254 254
 				'givenName'  => $author_first_name,
255 255
 				'familyName' => $author_last_name,
256
-				'url'        => get_author_posts_url( $author_id ),
256
+				'url'        => get_author_posts_url($author_id),
257 257
 			);
258 258
 		}
259 259
 
260 260
 		// Add the author to the references.
261
-		$author_uri   = Wordlift_Entity_Service::get_instance()->get_uri( $entity_id );
261
+		$author_uri   = Wordlift_Entity_Service::get_instance()->get_uri($entity_id);
262 262
 		$references[] = $entity_id;
263 263
 
264 264
 		// Return the JSON-LD for the referenced entity.
@@ -275,39 +275,39 @@  discard block
 block discarded – undo
275 275
 	 * @since 3.10.0
276 276
 	 *
277 277
 	 */
278
-	protected function set_publisher( &$params ) {
278
+	protected function set_publisher(&$params) {
279 279
 
280 280
 		// If the publisher id isn't set don't do anything.
281
-		if ( null === $publisher_id = Wordlift_Configuration_Service::get_instance()->get_publisher_id() ) {
281
+		if (null === $publisher_id = Wordlift_Configuration_Service::get_instance()->get_publisher_id()) {
282 282
 			return;
283 283
 		}
284 284
 
285 285
 		// Get the post instance.
286
-		if ( null === $post = get_post( $publisher_id ) ) {
286
+		if (null === $post = get_post($publisher_id)) {
287 287
 			// Publisher not found.
288 288
 			return;
289 289
 		}
290 290
 
291 291
 		// Get the item id.
292
-		$id = Wordlift_Entity_Service::get_instance()->get_uri( $publisher_id );
292
+		$id = Wordlift_Entity_Service::get_instance()->get_uri($publisher_id);
293 293
 
294 294
 		// Get the type.
295
-		$type = $this->entity_type_service->get( $publisher_id );
295
+		$type = $this->entity_type_service->get($publisher_id);
296 296
 
297 297
 		// Get the name.
298 298
 		$name = $post->post_title;
299 299
 
300 300
 		// Set the publisher data.
301 301
 		$params['publisher'] = array(
302
-			'@type' => $this->relative_to_context( $type['uri'] ),
302
+			'@type' => $this->relative_to_context($type['uri']),
303 303
 			'@id'   => $id,
304 304
 			'name'  => $name,
305 305
 		);
306 306
 
307 307
 		// Add the sameAs values associated with the publisher.
308 308
 		$storage_factory = Wordlift_Storage_Factory::get_instance();
309
-		$sameas          = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id );
310
-		if ( ! empty( $sameas ) ) {
309
+		$sameas          = $storage_factory->post_meta(Wordlift_Schema_Service::FIELD_SAME_AS)->get($publisher_id);
310
+		if ( ! empty($sameas)) {
311 311
 			$params['publisher']['sameAs'] = $sameas;
312 312
 		}
313 313
 
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 		// support the logo property.
316 316
 		//
317 317
 		// See http://schema.org/logo.
318
-		if ( 1 !== preg_match( '~Organization$~', $type['uri'] ) ) {
318
+		if (1 !== preg_match('~Organization$~', $type['uri'])) {
319 319
 			return;
320 320
 		}
321 321
 
322 322
 		// Get the publisher logo.
323
-		$publisher_logo = $this->get_publisher_logo( $post->ID );
323
+		$publisher_logo = $this->get_publisher_logo($post->ID);
324 324
 
325 325
 		// Bail out if the publisher logo isn't set.
326
-		if ( false === $publisher_logo ) {
326
+		if (false === $publisher_logo) {
327 327
 			return;
328 328
 		}
329 329
 
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 	 * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue.
359 359
 	 *
360 360
 	 */
361
-	private function get_publisher_logo( $post_id ) {
361
+	private function get_publisher_logo($post_id) {
362 362
 
363 363
 		// Get the featured image for the post.
364
-		$thumbnail_id = get_post_thumbnail_id( $post_id );
364
+		$thumbnail_id = get_post_thumbnail_id($post_id);
365 365
 
366 366
 		// Bail out if thumbnail not available.
367
-		if ( empty( $thumbnail_id ) || 0 === $thumbnail_id ) {
368
-			$this->log->info( "Featured image not set for post $post_id." );
367
+		if (empty($thumbnail_id) || 0 === $thumbnail_id) {
368
+			$this->log->info("Featured image not set for post $post_id.");
369 369
 
370 370
 			return false;
371 371
 		}
@@ -374,24 +374,24 @@  discard block
 block discarded – undo
374 374
 		$uploads_dir = wp_upload_dir();
375 375
 
376 376
 		// Get the attachment metadata.
377
-		$metadata = wp_get_attachment_metadata( $thumbnail_id );
377
+		$metadata = wp_get_attachment_metadata($thumbnail_id);
378 378
 
379 379
 		// Bail out if the file isn't set.
380
-		if ( ! isset( $metadata['file'] ) ) {
381
-			$this->log->warn( "Featured image file not found for post $post_id." );
380
+		if ( ! isset($metadata['file'])) {
381
+			$this->log->warn("Featured image file not found for post $post_id.");
382 382
 
383 383
 			return false;
384 384
 		}
385 385
 
386 386
 		// Retrieve the relative filename, e.g. "2018/05/logo_publisher.png"
387
-		$path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file'];
387
+		$path = $uploads_dir['basedir'].DIRECTORY_SEPARATOR.$metadata['file'];
388 388
 
389 389
 		// Use image src, if local file does not exist. @see https://github.com/insideout10/wordlift-plugin/issues/1149
390
-		if ( ! file_exists( $path ) ) {
391
-			$this->log->warn( "Featured image file $path doesn't exist for post $post_id." );
390
+		if ( ! file_exists($path)) {
391
+			$this->log->warn("Featured image file $path doesn't exist for post $post_id.");
392 392
 
393
-			$attachment_image_src = wp_get_attachment_image_src( $thumbnail_id, '' );
394
-			if ( $attachment_image_src ) {
393
+			$attachment_image_src = wp_get_attachment_image_src($thumbnail_id, '');
394
+			if ($attachment_image_src) {
395 395
 				return array(
396 396
 					'url'    => $attachment_image_src[0],
397 397
 					'width'  => $attachment_image_src[1],
@@ -405,27 +405,27 @@  discard block
 block discarded – undo
405 405
 		}
406 406
 
407 407
 		// Try to get the image editor and bail out if the editor cannot be instantiated.
408
-		$original_file_editor = wp_get_image_editor( $path );
409
-		if ( is_wp_error( $original_file_editor ) ) {
410
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." );
408
+		$original_file_editor = wp_get_image_editor($path);
409
+		if (is_wp_error($original_file_editor)) {
410
+			$this->log->warn("Cannot instantiate WP Image Editor on file $path for post $post_id.");
411 411
 
412 412
 			return false;
413 413
 		}
414 414
 
415 415
 		// Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling
416 416
 		// and we don't actually know the end values.
417
-		$publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' );
417
+		$publisher_logo_path = $original_file_editor->generate_filename('-publisher-logo');
418 418
 
419 419
 		// If the file doesn't exist yet, create it.
420
-		if ( ! file_exists( $publisher_logo_path ) ) {
421
-			$original_file_editor->resize( 600, 60 );
422
-			$original_file_editor->save( $publisher_logo_path );
420
+		if ( ! file_exists($publisher_logo_path)) {
421
+			$original_file_editor->resize(600, 60);
422
+			$original_file_editor->save($publisher_logo_path);
423 423
 		}
424 424
 
425 425
 		// Try to get the image editor and bail out if the editor cannot be instantiated.
426
-		$publisher_logo_editor = wp_get_image_editor( $publisher_logo_path );
427
-		if ( is_wp_error( $publisher_logo_editor ) ) {
428
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." );
426
+		$publisher_logo_editor = wp_get_image_editor($publisher_logo_path);
427
+		if (is_wp_error($publisher_logo_editor)) {
428
+			$this->log->warn("Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id.");
429 429
 
430 430
 			return false;
431 431
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
 		// Finally return the array with data.
437 437
 		return array(
438
-			'url'    => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ),
438
+			'url'    => $uploads_dir['baseurl'].substr($publisher_logo_path, strlen($uploads_dir['basedir'])),
439 439
 			'width'  => $size['width'],
440 440
 			'height' => $size['height'],
441 441
 		);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	 * @return void
450 450
 	 *
451 451
 	 */
452
-	private function set_mentions_and_about( $references, $post, &$jsonld ) {
452
+	private function set_mentions_and_about($references, $post, &$jsonld) {
453 453
 
454
-		if ( count( $references ) === 0 ) {
454
+		if (count($references) === 0) {
455 455
 			return;
456 456
 		}
457 457
 
@@ -459,35 +459,35 @@  discard block
 block discarded – undo
459 459
 		$about = $mentions = array();
460 460
 
461 461
 		// If the entity is in the title, then it should be an `about`.
462
-		foreach ( $references as $reference ) {
462
+		foreach ($references as $reference) {
463 463
 
464
-			if ( ! $reference instanceof Reference ) {
464
+			if ( ! $reference instanceof Reference) {
465 465
 				// This condition should never be reached.
466 466
 				continue;
467 467
 			}
468 468
 
469 469
 			// Get the entity labels.
470
-			$labels = Wordlift_Entity_Service::get_instance()->get_labels( $reference->get_id(), $reference->get_type() );
470
+			$labels = Wordlift_Entity_Service::get_instance()->get_labels($reference->get_id(), $reference->get_type());
471 471
 			// Get the entity URI.
472 472
 			$item = array(
473
-				'@id' => Wordlift_Entity_Service::get_instance()->get_uri( $reference->get_id(), $reference->get_type() ),
473
+				'@id' => Wordlift_Entity_Service::get_instance()->get_uri($reference->get_id(), $reference->get_type()),
474 474
 			);
475 475
 
476
-			$escaped_labels = array_map( function ( $value ) {
477
-				return preg_quote( $value, '/' );
478
-			}, $labels );
476
+			$escaped_labels = array_map(function($value) {
477
+				return preg_quote($value, '/');
478
+			}, $labels);
479 479
 
480 480
 
481 481
 			$matches = false;
482 482
 
483 483
 			// When the title is empty, then we shouldn't yield a match to about section.
484
-			if ( array_filter( $escaped_labels ) ) {
484
+			if (array_filter($escaped_labels)) {
485 485
 				// Check if the labels match any part of the title.
486
-				$matches = 1 === preg_match( '/' . implode( '|', $escaped_labels ) . '/', $post->post_title );
486
+				$matches = 1 === preg_match('/'.implode('|', $escaped_labels).'/', $post->post_title);
487 487
 			}
488 488
 
489 489
 			// If the title matches, assign the entity to the about, otherwise to the mentions.
490
-			if ( $matches ) {
490
+			if ($matches) {
491 491
 				$about[] = $item;
492 492
 			} else {
493 493
 				$mentions[] = $item;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 		}
496 496
 
497 497
 		// If we have abouts, assign them to the JSON-LD.
498
-		if ( 0 < count( $about ) ) {
498
+		if (0 < count($about)) {
499 499
 			$jsonld['about'] = $about;
500 500
 		}
501 501
 
502 502
 		// If we have mentions, assign them to the JSON-LD.
503
-		if ( 0 < count( $mentions ) ) {
503
+		if (0 < count($mentions)) {
504 504
 			$jsonld['mentions'] = $mentions;
505 505
 		}
506 506
 
@@ -514,17 +514,17 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @return Reference[]
516 516
 	 */
517
-	private function convert_references( $references ) {
518
-		return array_map( function ( $reference ) {
517
+	private function convert_references($references) {
518
+		return array_map(function($reference) {
519 519
 			// Legacy code may still push numerical references to this
520 520
 			// $references variable, so convert it to post references.
521
-			if ( is_numeric( $reference ) ) {
522
-				return new Post_Reference( $reference );
521
+			if (is_numeric($reference)) {
522
+				return new Post_Reference($reference);
523 523
 			}
524 524
 
525 525
 			return $reference;
526 526
 
527
-		}, $references );
527
+		}, $references);
528 528
 	}
529 529
 
530 530
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-post-adapter.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -19,254 +19,254 @@
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Post_Adapter {
21 21
 
22
-	/**
23
-	 * The post id to which the adopter relates.
24
-	 *
25
-	 * @since 3.14.0
26
-	 *
27
-	 * @var integer $post_id .
28
-	 */
29
-	private $post_id;
30
-
31
-	const TYPE_ENTITY_LINK = 0;
32
-	const TYPE_TERM_LINK = 1;
33
-
34
-	/**
35
-	 * Create the {@link Wordlift_Post_Adatpter} instance.
36
-	 *
37
-	 * @param integer $post_id the post ID of the post the adopter relates to.
38
-	 *
39
-	 * @since 3.14.0
40
-	 *
41
-	 */
42
-	public function __construct( $post_id ) {
43
-
44
-		$this->post_id = $post_id;
45
-
46
-	}
47
-
48
-	/**
49
-	 * Get the word count of the post content.
50
-	 *
51
-	 * The count is calculated over the post content after stripping shortcodes and html tags.
52
-	 *
53
-	 * @return integer the number of words in the content after stripping shortcodes and html tags..
54
-	 * @since 3.14.0
55
-	 *
56
-	 */
57
-	public function word_count() {
58
-
59
-		$post = get_post( $this->post_id );
60
-
61
-		/*
22
+    /**
23
+     * The post id to which the adopter relates.
24
+     *
25
+     * @since 3.14.0
26
+     *
27
+     * @var integer $post_id .
28
+     */
29
+    private $post_id;
30
+
31
+    const TYPE_ENTITY_LINK = 0;
32
+    const TYPE_TERM_LINK = 1;
33
+
34
+    /**
35
+     * Create the {@link Wordlift_Post_Adatpter} instance.
36
+     *
37
+     * @param integer $post_id the post ID of the post the adopter relates to.
38
+     *
39
+     * @since 3.14.0
40
+     *
41
+     */
42
+    public function __construct( $post_id ) {
43
+
44
+        $this->post_id = $post_id;
45
+
46
+    }
47
+
48
+    /**
49
+     * Get the word count of the post content.
50
+     *
51
+     * The count is calculated over the post content after stripping shortcodes and html tags.
52
+     *
53
+     * @return integer the number of words in the content after stripping shortcodes and html tags..
54
+     * @since 3.14.0
55
+     *
56
+     */
57
+    public function word_count() {
58
+
59
+        $post = get_post( $this->post_id );
60
+
61
+        /*
62 62
 		 * Apply the `wl_post_content` filter, in case 3rd parties want to change the post content, e.g.
63 63
 		 * because the content is written elsewhere.
64 64
 		 *
65 65
 		 * @since 3.20.0
66 66
 		 */
67
-		$post_content = apply_filters( 'wl_post_content', $post->post_content, $post );
68
-
69
-		return self::str_word_count_utf8( wp_strip_all_tags( strip_shortcodes( $post_content ) ) );
70
-	}
71
-
72
-	/**
73
-	 * Count words in the string, taking into account UTF-8 characters.
74
-	 *
75
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/884
76
-	 *
77
-	 * @since 3.20.0
78
-	 *
79
-	 * @param string $str The target string.
80
-	 *
81
-	 * @return int The number of words.
82
-	 */
83
-	private static function str_word_count_utf8( $str ) {
84
-
85
-		return count( preg_split( '~[^\p{L}\p{N}\']+~u', $str ) );
86
-	}
87
-
88
-	/**
89
-	 * Get the {@link WP_Post} permalink allowing 3rd parties to alter the URL.
90
-	 *
91
-	 * @param int $post_id Post ID.
92
-	 *
93
-	 * @return string The post permalink.
94
-	 * @since 3.20.0
95
-	 *
96
-	 */
97
-	public static function get_production_permalink( $post_id, $object_type = Object_Type_Enum::POST ) {
98
-
99
-		$object_link_service = Object_Link_Provider::get_instance();
100
-		$permalink           = $object_link_service->get_permalink( $post_id, $object_type );
101
-
102
-		/**
103
-		 * WordPress 4.4 doesn't support meta queries for terms, therefore we only support post permalinks here.
104
-		 *
105
-		 * Later on for WordPress 4.5+ we look for terms bound to the entity and we use the term link instead of the
106
-		 * post permalink if we find them.
107
-		 */
108
-		global $wp_version;
109
-		if ( version_compare( $wp_version, '4.5', '<' ) ) {
110
-			return apply_filters( 'wl_production_permalink', $permalink, $post_id, self::TYPE_ENTITY_LINK, null );
111
-		}
112
-
113
-		/**
114
-		 * The `wl_production_permalink` filter allows to change the permalink, this is useful in contexts
115
-		 * when the production environment is copied over from a staging environment with staging
116
-		 * URLs.
117
-		 *
118
-		 * @param string $permalink_url The default permalink.
119
-		 * @param int $post_id The post id.
120
-		 *
121
-		 * @since 3.23.0 we check whether the entity is bound to a term and, in that case, we link to the term.
122
-		 * @since 3.20.0
123
-		 *
124
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/850
125
-		 *
126
-		 */
127
-
128
-
129
-		$uris = $object_link_service->get_same_as_uris(
130
-			$post_id,
131
-			$object_type
132
-		);
133
-
134
-		// Only try to link a term if `WL_ENABLE_TERM_LINKING` is enabled.
135
-		$terms = array();
136
-		if ( defined( 'WL_ENABLE_TERM_LINKING' ) && WL_ENABLE_TERM_LINKING ) {
137
-			// Try to find one term matching the entity.
138
-			$terms = get_terms( array(
139
-				'number'                 => 1,
140
-				'hide_empty'             => false,
141
-				'update_term_meta_cache' => false,
142
-				'meta_key'               => '_wl_entity_id',
143
-				'meta_value'             => $uris,
144
-				'meta_compare'           => 'IN',
145
-			) );
146
-		}
147
-
148
-		$type = self::TYPE_ENTITY_LINK;
149
-		$term = null;
150
-		// If found use the term link, otherwise the permalink.
151
-		if ( 1 === count( $terms ) ) {
152
-			$term      = current( $terms );
153
-			$permalink = get_term_link( $term );
154
-			$type      = self::TYPE_TERM_LINK;
155
-		}
156
-
157
-		/**
158
-		 * Apply the `wl_production_permalink` filter.
159
-		 *
160
-		 * @param string $permalink The permalink.
161
-		 * @param int $post_id The post id.
162
-		 * @param int $type The permalink type: 0 = entity permalink, 1 = term link.
163
-		 * @param WP_Term $term The term if type is term link, otherwise null.
164
-		 *
165
-		 * @since 3.23.0 add the permalink type and term parameters.
166
-		 *
167
-		 */
168
-		return apply_filters( 'wl_production_permalink', $permalink, $post_id, $type, $term );
169
-	}
170
-
171
-	/**
172
-	 * Get comma separated tags to be used as keywords
173
-	 *
174
-	 * @return string|void Comma separated tags
175
-	 *
176
-	 * @since 3.27.2
177
-	 */
178
-	public function keywords() {
179
-		$tags = get_the_tags( $this->post_id );
180
-
181
-		if ( empty( $tags ) ) {
182
-			return;
183
-		}
184
-
185
-		return implode( ',', array_map( function ( $tag ) {
186
-			return $tag->name;
187
-		}, $tags ) );
188
-	}
189
-
190
-	/**
191
-	 * Get comma separated categories to be used as article section
192
-	 *
193
-	 * @return string[] Comma separated categories
194
-	 *
195
-	 * @since 3.27.2
196
-	 */
197
-	public function article_section() {
198
-		$categories = get_the_category( $this->post_id );
199
-
200
-		return array_column( $categories, 'cat_name' );
201
-	}
202
-
203
-	/**
204
-	 * Get comment count
205
-	 *
206
-	 * @return string|void Comment count
207
-	 *
208
-	 * @since 3.27.2
209
-	 */
210
-	public function comment_count() {
211
-		return get_comments_number( $this->post_id );
212
-	}
213
-
214
-	/**
215
-	 * Get Language
216
-	 * Try WPML, Polylang for post specific languages, else fallback on get_locale()
217
-	 *
218
-	 * @return string|void Language code (locale)
219
-	 *
220
-	 * @since 3.27.2
221
-	 */
222
-	public function locale() {
223
-		$language = 'en-US';
224
-
225
-		if ( function_exists( 'wpml_get_language_information' ) ) {
226
-			// WPML handling
227
-			// WPML: Updated function signature.
228
-			// function wpml_get_language_information( $empty_value = null, $post_id = null )
229
-			$post_language = wpml_get_language_information( null, $this->post_id );
230
-			if ( ! $post_language instanceof WP_Error ) {
231
-				$language = $post_language['locale'];
232
-			}
233
-		} else if ( function_exists( 'pll_get_post_language' ) ) {
234
-			// Polylang handling
235
-			$language = pll_get_post_language( $this->post_id, 'locale' );
236
-		} else {
237
-			$language = get_locale();
238
-		}
239
-
240
-		return str_replace( '_', '-', $language );
241
-	}
242
-
243
-	/**
244
-	 * Add mentions to an article.
245
-	 * To add mentions we just push the referenced entities to mentions.
246
-	 *
247
-	 * @param $post_id int
248
-	 * @param $references int[]
249
-	 */
250
-	public function add_references( $post_id, &$references ) {
251
-		$tags = get_the_tags( $post_id );
252
-
253
-		if ( $tags && ! is_wp_error( $tags ) ) {
254
-			// Loop through the tags and push it to references.
255
-			foreach ( $tags as $tag ) {
256
-				/**
257
-				 * @var $tag WP_Term
258
-				 */
259
-				$entity_uris = get_term_meta( $tag->term_id, '_wl_entity_id' );
260
-				foreach ( $entity_uris as $uri ) {
261
-					$referenced_entity = Wordlift_Entity_Uri_Service::get_instance()->get_entity( $uri );
262
-					if ( $referenced_entity instanceof WP_Post ) {
263
-						// push the referenced entities to references.
264
-						$references[] = $referenced_entity->ID;
265
-					}
266
-				}
267
-			}
268
-		}
269
-
270
-	}
67
+        $post_content = apply_filters( 'wl_post_content', $post->post_content, $post );
68
+
69
+        return self::str_word_count_utf8( wp_strip_all_tags( strip_shortcodes( $post_content ) ) );
70
+    }
71
+
72
+    /**
73
+     * Count words in the string, taking into account UTF-8 characters.
74
+     *
75
+     * @see https://github.com/insideout10/wordlift-plugin/issues/884
76
+     *
77
+     * @since 3.20.0
78
+     *
79
+     * @param string $str The target string.
80
+     *
81
+     * @return int The number of words.
82
+     */
83
+    private static function str_word_count_utf8( $str ) {
84
+
85
+        return count( preg_split( '~[^\p{L}\p{N}\']+~u', $str ) );
86
+    }
87
+
88
+    /**
89
+     * Get the {@link WP_Post} permalink allowing 3rd parties to alter the URL.
90
+     *
91
+     * @param int $post_id Post ID.
92
+     *
93
+     * @return string The post permalink.
94
+     * @since 3.20.0
95
+     *
96
+     */
97
+    public static function get_production_permalink( $post_id, $object_type = Object_Type_Enum::POST ) {
98
+
99
+        $object_link_service = Object_Link_Provider::get_instance();
100
+        $permalink           = $object_link_service->get_permalink( $post_id, $object_type );
101
+
102
+        /**
103
+         * WordPress 4.4 doesn't support meta queries for terms, therefore we only support post permalinks here.
104
+         *
105
+         * Later on for WordPress 4.5+ we look for terms bound to the entity and we use the term link instead of the
106
+         * post permalink if we find them.
107
+         */
108
+        global $wp_version;
109
+        if ( version_compare( $wp_version, '4.5', '<' ) ) {
110
+            return apply_filters( 'wl_production_permalink', $permalink, $post_id, self::TYPE_ENTITY_LINK, null );
111
+        }
112
+
113
+        /**
114
+         * The `wl_production_permalink` filter allows to change the permalink, this is useful in contexts
115
+         * when the production environment is copied over from a staging environment with staging
116
+         * URLs.
117
+         *
118
+         * @param string $permalink_url The default permalink.
119
+         * @param int $post_id The post id.
120
+         *
121
+         * @since 3.23.0 we check whether the entity is bound to a term and, in that case, we link to the term.
122
+         * @since 3.20.0
123
+         *
124
+         * @see https://github.com/insideout10/wordlift-plugin/issues/850
125
+         *
126
+         */
127
+
128
+
129
+        $uris = $object_link_service->get_same_as_uris(
130
+            $post_id,
131
+            $object_type
132
+        );
133
+
134
+        // Only try to link a term if `WL_ENABLE_TERM_LINKING` is enabled.
135
+        $terms = array();
136
+        if ( defined( 'WL_ENABLE_TERM_LINKING' ) && WL_ENABLE_TERM_LINKING ) {
137
+            // Try to find one term matching the entity.
138
+            $terms = get_terms( array(
139
+                'number'                 => 1,
140
+                'hide_empty'             => false,
141
+                'update_term_meta_cache' => false,
142
+                'meta_key'               => '_wl_entity_id',
143
+                'meta_value'             => $uris,
144
+                'meta_compare'           => 'IN',
145
+            ) );
146
+        }
147
+
148
+        $type = self::TYPE_ENTITY_LINK;
149
+        $term = null;
150
+        // If found use the term link, otherwise the permalink.
151
+        if ( 1 === count( $terms ) ) {
152
+            $term      = current( $terms );
153
+            $permalink = get_term_link( $term );
154
+            $type      = self::TYPE_TERM_LINK;
155
+        }
156
+
157
+        /**
158
+         * Apply the `wl_production_permalink` filter.
159
+         *
160
+         * @param string $permalink The permalink.
161
+         * @param int $post_id The post id.
162
+         * @param int $type The permalink type: 0 = entity permalink, 1 = term link.
163
+         * @param WP_Term $term The term if type is term link, otherwise null.
164
+         *
165
+         * @since 3.23.0 add the permalink type and term parameters.
166
+         *
167
+         */
168
+        return apply_filters( 'wl_production_permalink', $permalink, $post_id, $type, $term );
169
+    }
170
+
171
+    /**
172
+     * Get comma separated tags to be used as keywords
173
+     *
174
+     * @return string|void Comma separated tags
175
+     *
176
+     * @since 3.27.2
177
+     */
178
+    public function keywords() {
179
+        $tags = get_the_tags( $this->post_id );
180
+
181
+        if ( empty( $tags ) ) {
182
+            return;
183
+        }
184
+
185
+        return implode( ',', array_map( function ( $tag ) {
186
+            return $tag->name;
187
+        }, $tags ) );
188
+    }
189
+
190
+    /**
191
+     * Get comma separated categories to be used as article section
192
+     *
193
+     * @return string[] Comma separated categories
194
+     *
195
+     * @since 3.27.2
196
+     */
197
+    public function article_section() {
198
+        $categories = get_the_category( $this->post_id );
199
+
200
+        return array_column( $categories, 'cat_name' );
201
+    }
202
+
203
+    /**
204
+     * Get comment count
205
+     *
206
+     * @return string|void Comment count
207
+     *
208
+     * @since 3.27.2
209
+     */
210
+    public function comment_count() {
211
+        return get_comments_number( $this->post_id );
212
+    }
213
+
214
+    /**
215
+     * Get Language
216
+     * Try WPML, Polylang for post specific languages, else fallback on get_locale()
217
+     *
218
+     * @return string|void Language code (locale)
219
+     *
220
+     * @since 3.27.2
221
+     */
222
+    public function locale() {
223
+        $language = 'en-US';
224
+
225
+        if ( function_exists( 'wpml_get_language_information' ) ) {
226
+            // WPML handling
227
+            // WPML: Updated function signature.
228
+            // function wpml_get_language_information( $empty_value = null, $post_id = null )
229
+            $post_language = wpml_get_language_information( null, $this->post_id );
230
+            if ( ! $post_language instanceof WP_Error ) {
231
+                $language = $post_language['locale'];
232
+            }
233
+        } else if ( function_exists( 'pll_get_post_language' ) ) {
234
+            // Polylang handling
235
+            $language = pll_get_post_language( $this->post_id, 'locale' );
236
+        } else {
237
+            $language = get_locale();
238
+        }
239
+
240
+        return str_replace( '_', '-', $language );
241
+    }
242
+
243
+    /**
244
+     * Add mentions to an article.
245
+     * To add mentions we just push the referenced entities to mentions.
246
+     *
247
+     * @param $post_id int
248
+     * @param $references int[]
249
+     */
250
+    public function add_references( $post_id, &$references ) {
251
+        $tags = get_the_tags( $post_id );
252
+
253
+        if ( $tags && ! is_wp_error( $tags ) ) {
254
+            // Loop through the tags and push it to references.
255
+            foreach ( $tags as $tag ) {
256
+                /**
257
+                 * @var $tag WP_Term
258
+                 */
259
+                $entity_uris = get_term_meta( $tag->term_id, '_wl_entity_id' );
260
+                foreach ( $entity_uris as $uri ) {
261
+                    $referenced_entity = Wordlift_Entity_Uri_Service::get_instance()->get_entity( $uri );
262
+                    if ( $referenced_entity instanceof WP_Post ) {
263
+                        // push the referenced entities to references.
264
+                        $references[] = $referenced_entity->ID;
265
+                    }
266
+                }
267
+            }
268
+        }
269
+
270
+    }
271 271
 
272 272
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @since 3.14.0
40 40
 	 *
41 41
 	 */
42
-	public function __construct( $post_id ) {
42
+	public function __construct($post_id) {
43 43
 
44 44
 		$this->post_id = $post_id;
45 45
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function word_count() {
58 58
 
59
-		$post = get_post( $this->post_id );
59
+		$post = get_post($this->post_id);
60 60
 
61 61
 		/*
62 62
 		 * Apply the `wl_post_content` filter, in case 3rd parties want to change the post content, e.g.
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @since 3.20.0
66 66
 		 */
67
-		$post_content = apply_filters( 'wl_post_content', $post->post_content, $post );
67
+		$post_content = apply_filters('wl_post_content', $post->post_content, $post);
68 68
 
69
-		return self::str_word_count_utf8( wp_strip_all_tags( strip_shortcodes( $post_content ) ) );
69
+		return self::str_word_count_utf8(wp_strip_all_tags(strip_shortcodes($post_content)));
70 70
 	}
71 71
 
72 72
 	/**
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return int The number of words.
82 82
 	 */
83
-	private static function str_word_count_utf8( $str ) {
83
+	private static function str_word_count_utf8($str) {
84 84
 
85
-		return count( preg_split( '~[^\p{L}\p{N}\']+~u', $str ) );
85
+		return count(preg_split('~[^\p{L}\p{N}\']+~u', $str));
86 86
 	}
87 87
 
88 88
 	/**
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @since 3.20.0
95 95
 	 *
96 96
 	 */
97
-	public static function get_production_permalink( $post_id, $object_type = Object_Type_Enum::POST ) {
97
+	public static function get_production_permalink($post_id, $object_type = Object_Type_Enum::POST) {
98 98
 
99 99
 		$object_link_service = Object_Link_Provider::get_instance();
100
-		$permalink           = $object_link_service->get_permalink( $post_id, $object_type );
100
+		$permalink           = $object_link_service->get_permalink($post_id, $object_type);
101 101
 
102 102
 		/**
103 103
 		 * WordPress 4.4 doesn't support meta queries for terms, therefore we only support post permalinks here.
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		 * post permalink if we find them.
107 107
 		 */
108 108
 		global $wp_version;
109
-		if ( version_compare( $wp_version, '4.5', '<' ) ) {
110
-			return apply_filters( 'wl_production_permalink', $permalink, $post_id, self::TYPE_ENTITY_LINK, null );
109
+		if (version_compare($wp_version, '4.5', '<')) {
110
+			return apply_filters('wl_production_permalink', $permalink, $post_id, self::TYPE_ENTITY_LINK, null);
111 111
 		}
112 112
 
113 113
 		/**
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
 
134 134
 		// Only try to link a term if `WL_ENABLE_TERM_LINKING` is enabled.
135 135
 		$terms = array();
136
-		if ( defined( 'WL_ENABLE_TERM_LINKING' ) && WL_ENABLE_TERM_LINKING ) {
136
+		if (defined('WL_ENABLE_TERM_LINKING') && WL_ENABLE_TERM_LINKING) {
137 137
 			// Try to find one term matching the entity.
138
-			$terms = get_terms( array(
138
+			$terms = get_terms(array(
139 139
 				'number'                 => 1,
140 140
 				'hide_empty'             => false,
141 141
 				'update_term_meta_cache' => false,
142 142
 				'meta_key'               => '_wl_entity_id',
143 143
 				'meta_value'             => $uris,
144 144
 				'meta_compare'           => 'IN',
145
-			) );
145
+			));
146 146
 		}
147 147
 
148 148
 		$type = self::TYPE_ENTITY_LINK;
149 149
 		$term = null;
150 150
 		// If found use the term link, otherwise the permalink.
151
-		if ( 1 === count( $terms ) ) {
152
-			$term      = current( $terms );
153
-			$permalink = get_term_link( $term );
151
+		if (1 === count($terms)) {
152
+			$term      = current($terms);
153
+			$permalink = get_term_link($term);
154 154
 			$type      = self::TYPE_TERM_LINK;
155 155
 		}
156 156
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		 * @since 3.23.0 add the permalink type and term parameters.
166 166
 		 *
167 167
 		 */
168
-		return apply_filters( 'wl_production_permalink', $permalink, $post_id, $type, $term );
168
+		return apply_filters('wl_production_permalink', $permalink, $post_id, $type, $term);
169 169
 	}
170 170
 
171 171
 	/**
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
 	 * @since 3.27.2
177 177
 	 */
178 178
 	public function keywords() {
179
-		$tags = get_the_tags( $this->post_id );
179
+		$tags = get_the_tags($this->post_id);
180 180
 
181
-		if ( empty( $tags ) ) {
181
+		if (empty($tags)) {
182 182
 			return;
183 183
 		}
184 184
 
185
-		return implode( ',', array_map( function ( $tag ) {
185
+		return implode(',', array_map(function($tag) {
186 186
 			return $tag->name;
187
-		}, $tags ) );
187
+		}, $tags));
188 188
 	}
189 189
 
190 190
 	/**
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 	 * @since 3.27.2
196 196
 	 */
197 197
 	public function article_section() {
198
-		$categories = get_the_category( $this->post_id );
198
+		$categories = get_the_category($this->post_id);
199 199
 
200
-		return array_column( $categories, 'cat_name' );
200
+		return array_column($categories, 'cat_name');
201 201
 	}
202 202
 
203 203
 	/**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @since 3.27.2
209 209
 	 */
210 210
 	public function comment_count() {
211
-		return get_comments_number( $this->post_id );
211
+		return get_comments_number($this->post_id);
212 212
 	}
213 213
 
214 214
 	/**
@@ -222,22 +222,22 @@  discard block
 block discarded – undo
222 222
 	public function locale() {
223 223
 		$language = 'en-US';
224 224
 
225
-		if ( function_exists( 'wpml_get_language_information' ) ) {
225
+		if (function_exists('wpml_get_language_information')) {
226 226
 			// WPML handling
227 227
 			// WPML: Updated function signature.
228 228
 			// function wpml_get_language_information( $empty_value = null, $post_id = null )
229
-			$post_language = wpml_get_language_information( null, $this->post_id );
230
-			if ( ! $post_language instanceof WP_Error ) {
229
+			$post_language = wpml_get_language_information(null, $this->post_id);
230
+			if ( ! $post_language instanceof WP_Error) {
231 231
 				$language = $post_language['locale'];
232 232
 			}
233
-		} else if ( function_exists( 'pll_get_post_language' ) ) {
233
+		} else if (function_exists('pll_get_post_language')) {
234 234
 			// Polylang handling
235
-			$language = pll_get_post_language( $this->post_id, 'locale' );
235
+			$language = pll_get_post_language($this->post_id, 'locale');
236 236
 		} else {
237 237
 			$language = get_locale();
238 238
 		}
239 239
 
240
-		return str_replace( '_', '-', $language );
240
+		return str_replace('_', '-', $language);
241 241
 	}
242 242
 
243 243
 	/**
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 	 * @param $post_id int
248 248
 	 * @param $references int[]
249 249
 	 */
250
-	public function add_references( $post_id, &$references ) {
251
-		$tags = get_the_tags( $post_id );
250
+	public function add_references($post_id, &$references) {
251
+		$tags = get_the_tags($post_id);
252 252
 
253
-		if ( $tags && ! is_wp_error( $tags ) ) {
253
+		if ($tags && ! is_wp_error($tags)) {
254 254
 			// Loop through the tags and push it to references.
255
-			foreach ( $tags as $tag ) {
255
+			foreach ($tags as $tag) {
256 256
 				/**
257 257
 				 * @var $tag WP_Term
258 258
 				 */
259
-				$entity_uris = get_term_meta( $tag->term_id, '_wl_entity_id' );
260
-				foreach ( $entity_uris as $uri ) {
261
-					$referenced_entity = Wordlift_Entity_Uri_Service::get_instance()->get_entity( $uri );
262
-					if ( $referenced_entity instanceof WP_Post ) {
259
+				$entity_uris = get_term_meta($tag->term_id, '_wl_entity_id');
260
+				foreach ($entity_uris as $uri) {
261
+					$referenced_entity = Wordlift_Entity_Uri_Service::get_instance()->get_entity($uri);
262
+					if ($referenced_entity instanceof WP_Post) {
263 263
 						// push the referenced entities to references.
264 264
 						$references[] = $referenced_entity->ID;
265 265
 					}
Please login to merge, or discard this patch.