@@ -9,24 +9,24 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | function wordlift_mce_css( $mce_css ) { |
| 11 | 11 | |
| 12 | - /* |
|
| 12 | + /* |
|
| 13 | 13 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 14 | 14 | * |
| 15 | 15 | * @since 3.20.3 |
| 16 | 16 | * |
| 17 | 17 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 18 | 18 | */ |
| 19 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 20 | - return $mce_css; |
|
| 21 | - } |
|
| 19 | + if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 20 | + return $mce_css; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - if ( ! empty( $mce_css ) ) { |
|
| 24 | - $mce_css .= ','; |
|
| 25 | - } |
|
| 23 | + if ( ! empty( $mce_css ) ) { |
|
| 24 | + $mce_css .= ','; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - $mce_css .= plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css'; |
|
| 27 | + $mce_css .= plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css'; |
|
| 28 | 28 | |
| 29 | - return $mce_css; |
|
| 29 | + return $mce_css; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // hook the TinyMCE custom styles function. |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function wordlift_filter_tiny_mce_before_init( $options ) { |
| 43 | 43 | |
| 44 | - if ( ! isset( $options['extended_valid_elements'] ) ) { |
|
| 45 | - $options['extended_valid_elements'] = ''; |
|
| 46 | - } |
|
| 44 | + if ( ! isset( $options['extended_valid_elements'] ) ) { |
|
| 45 | + $options['extended_valid_elements'] = ''; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $options['extended_valid_elements'] .= ",span[*]"; |
|
| 48 | + $options['extended_valid_elements'] .= ",span[*]"; |
|
| 49 | 49 | |
| 50 | - return $options; |
|
| 50 | + return $options; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | add_filter( 'tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init' ); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | * @return string The updated list of styles, including the custom style provided by WordLift. |
| 9 | 9 | */ |
| 10 | -function wordlift_mce_css( $mce_css ) { |
|
| 10 | +function wordlift_mce_css($mce_css) { |
|
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | 13 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
@@ -16,21 +16,21 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 18 | 18 | */ |
| 19 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 19 | + if ( ! apply_filters('wl_can_see_classification_box', true)) { |
|
| 20 | 20 | return $mce_css; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if ( ! empty( $mce_css ) ) { |
|
| 23 | + if ( ! empty($mce_css)) { |
|
| 24 | 24 | $mce_css .= ','; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $mce_css .= plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css'; |
|
| 27 | + $mce_css .= plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css'; |
|
| 28 | 28 | |
| 29 | 29 | return $mce_css; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // hook the TinyMCE custom styles function. |
| 33 | -add_filter( 'mce_css', 'wordlift_mce_css' ); |
|
| 33 | +add_filter('mce_css', 'wordlift_mce_css'); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Set TinyMCE options, in particular enable microdata tagging. |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return mixed |
| 41 | 41 | */ |
| 42 | -function wordlift_filter_tiny_mce_before_init( $options ) { |
|
| 42 | +function wordlift_filter_tiny_mce_before_init($options) { |
|
| 43 | 43 | |
| 44 | - if ( ! isset( $options['extended_valid_elements'] ) ) { |
|
| 44 | + if ( ! isset($options['extended_valid_elements'])) { |
|
| 45 | 45 | $options['extended_valid_elements'] = ''; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -50,4 +50,4 @@ discard block |
||
| 50 | 50 | return $options; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_filter( 'tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init' ); |
|
| 53 | +add_filter('tiny_mce_before_init', 'wordlift_filter_tiny_mce_before_init'); |
|
@@ -14,65 +14,65 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Wordlift_Tinymce_Adapter { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The {@link Wordlift} plugin instance. |
|
| 19 | - * |
|
| 20 | - * @since 3.12.0 |
|
| 21 | - * @access private |
|
| 22 | - * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 23 | - */ |
|
| 24 | - private $plugin; |
|
| 17 | + /** |
|
| 18 | + * The {@link Wordlift} plugin instance. |
|
| 19 | + * |
|
| 20 | + * @since 3.12.0 |
|
| 21 | + * @access private |
|
| 22 | + * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 23 | + */ |
|
| 24 | + private $plugin; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Wordlift_Tinymce_Adapter constructor. |
|
| 28 | - * |
|
| 29 | - * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 30 | - */ |
|
| 31 | - public function __construct( $plugin ) { |
|
| 26 | + /** |
|
| 27 | + * Wordlift_Tinymce_Adapter constructor. |
|
| 28 | + * |
|
| 29 | + * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 30 | + */ |
|
| 31 | + public function __construct( $plugin ) { |
|
| 32 | 32 | |
| 33 | - $this->plugin = $plugin; |
|
| 33 | + $this->plugin = $plugin; |
|
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook. |
|
| 39 | - * |
|
| 40 | - * @param array $plugins The existing plugins array. |
|
| 41 | - * |
|
| 42 | - * @return array The modified plugins array. |
|
| 43 | - * @since 3.12.0 |
|
| 44 | - */ |
|
| 45 | - function mce_external_plugins( $plugins ) { |
|
| 37 | + /** |
|
| 38 | + * Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook. |
|
| 39 | + * |
|
| 40 | + * @param array $plugins The existing plugins array. |
|
| 41 | + * |
|
| 42 | + * @return array The modified plugins array. |
|
| 43 | + * @since 3.12.0 |
|
| 44 | + */ |
|
| 45 | + function mce_external_plugins( $plugins ) { |
|
| 46 | 46 | |
| 47 | - /* |
|
| 47 | + /* |
|
| 48 | 48 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 49 | 49 | * |
| 50 | 50 | * @since 3.20.3 |
| 51 | 51 | * |
| 52 | 52 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 53 | 53 | */ |
| 54 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 55 | - return $plugins; |
|
| 56 | - } |
|
| 54 | + if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 55 | + return $plugins; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - // Get WordLift's version as a cache killer. |
|
| 59 | - $version = $this->plugin->get_version(); |
|
| 58 | + // Get WordLift's version as a cache killer. |
|
| 59 | + $version = $this->plugin->get_version(); |
|
| 60 | 60 | |
| 61 | - // User can edit? |
|
| 62 | - $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
| 61 | + // User can edit? |
|
| 62 | + $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
| 63 | 63 | |
| 64 | - // If user can't edit or rich editing isn't enabled, bail out. |
|
| 65 | - if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
| 66 | - return $plugins; |
|
| 67 | - } |
|
| 64 | + // If user can't edit or rich editing isn't enabled, bail out. |
|
| 65 | + if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
| 66 | + return $plugins; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - // Add our own JavaScript file to TinyMCE's extensions. |
|
| 70 | - // DO NOT use the minified version, it'll yield errors with AngularJS. |
|
| 71 | - $plugins['wordlift'] = plugin_dir_url( dirname( __FILE__ ) ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
| 72 | - $plugins['wl_shortcodes'] = plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
| 73 | - $plugins['wl_tinymce'] = plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
| 69 | + // Add our own JavaScript file to TinyMCE's extensions. |
|
| 70 | + // DO NOT use the minified version, it'll yield errors with AngularJS. |
|
| 71 | + $plugins['wordlift'] = plugin_dir_url( dirname( __FILE__ ) ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
| 72 | + $plugins['wl_shortcodes'] = plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
| 73 | + $plugins['wl_tinymce'] = plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
| 74 | 74 | |
| 75 | - return $plugins; |
|
| 76 | - } |
|
| 75 | + return $plugins; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
| 30 | 30 | */ |
| 31 | - public function __construct( $plugin ) { |
|
| 31 | + public function __construct($plugin) { |
|
| 32 | 32 | |
| 33 | 33 | $this->plugin = $plugin; |
| 34 | 34 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return array The modified plugins array. |
| 43 | 43 | * @since 3.12.0 |
| 44 | 44 | */ |
| 45 | - function mce_external_plugins( $plugins ) { |
|
| 45 | + function mce_external_plugins($plugins) { |
|
| 46 | 46 | |
| 47 | 47 | /* |
| 48 | 48 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 53 | 53 | */ |
| 54 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 54 | + if ( ! apply_filters('wl_can_see_classification_box', true)) { |
|
| 55 | 55 | return $plugins; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -59,18 +59,18 @@ discard block |
||
| 59 | 59 | $version = $this->plugin->get_version(); |
| 60 | 60 | |
| 61 | 61 | // User can edit? |
| 62 | - $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
| 62 | + $can_edit = current_user_can('edit_posts') || current_user_can('edit_pages'); |
|
| 63 | 63 | |
| 64 | 64 | // If user can't edit or rich editing isn't enabled, bail out. |
| 65 | - if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
| 65 | + if ( ! $can_edit || ! get_user_option('rich_editing')) { |
|
| 66 | 66 | return $plugins; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Add our own JavaScript file to TinyMCE's extensions. |
| 70 | 70 | // DO NOT use the minified version, it'll yield errors with AngularJS. |
| 71 | - $plugins['wordlift'] = plugin_dir_url( dirname( __FILE__ ) ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
| 72 | - $plugins['wl_shortcodes'] = plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
| 73 | - $plugins['wl_tinymce'] = plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
| 71 | + $plugins['wordlift'] = plugin_dir_url(dirname(__FILE__)).'js/wordlift-reloaded.js?ver='.$version; |
|
| 72 | + $plugins['wl_shortcodes'] = plugin_dir_url(dirname(__FILE__)).'admin/js/wordlift_shortcode_tinymce_plugin.js?ver='.$version; |
|
| 73 | + $plugins['wl_tinymce'] = plugin_dir_url(dirname(__FILE__)).'admin/js/1/tinymce.js?ver='.$version; |
|
| 74 | 74 | |
| 75 | 75 | return $plugins; |
| 76 | 76 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $this->define_public_hooks(); |
| 750 | 750 | |
| 751 | 751 | // If we're in `WP_CLI` load the related files. |
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 752 | + if (class_exists('WP_CLI')) { |
|
| 753 | 753 | $this->load_cli_dependencies(); |
| 754 | 754 | } |
| 755 | 755 | |
@@ -789,378 +789,378 @@ discard block |
||
| 789 | 789 | * The class responsible for orchestrating the actions and filters of the |
| 790 | 790 | * core plugin. |
| 791 | 791 | */ |
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 792 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 793 | 793 | |
| 794 | 794 | // The class responsible for plugin uninstall. |
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 795 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * The class responsible for defining internationalization functionality |
| 799 | 799 | * of the plugin. |
| 800 | 800 | */ |
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 801 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | 804 | * WordLift's supported languages. |
| 805 | 805 | */ |
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 806 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * WordLift's supported countries. |
| 810 | 810 | */ |
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 811 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 812 | 812 | |
| 813 | 813 | /** |
| 814 | 814 | * Provide support functions to sanitize data. |
| 815 | 815 | */ |
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 816 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 817 | 817 | |
| 818 | 818 | /** Services. */ |
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 819 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 829 | 829 | |
| 830 | 830 | /** |
| 831 | 831 | * The Query builder. |
| 832 | 832 | */ |
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 834 | 834 | |
| 835 | 835 | /** |
| 836 | 836 | * The Schema service. |
| 837 | 837 | */ |
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | 841 | * The schema:url property service. |
| 842 | 842 | */ |
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 843 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | 847 | * The UI service. |
| 848 | 848 | */ |
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 850 | 850 | |
| 851 | 851 | /** |
| 852 | 852 | * The Thumbnail service. |
| 853 | 853 | */ |
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | 857 | * The Entity Types Taxonomy service. |
| 858 | 858 | */ |
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 859 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * The Entity service. |
| 863 | 863 | */ |
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 864 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | // Add the entity rating service. |
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 868 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 869 | 869 | |
| 870 | 870 | /** |
| 871 | 871 | * The User service. |
| 872 | 872 | */ |
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 873 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | 876 | * The Timeline service. |
| 877 | 877 | */ |
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 878 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 879 | 879 | |
| 880 | 880 | /** |
| 881 | 881 | * The Topic Taxonomy service. |
| 882 | 882 | */ |
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 883 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | 884 | |
| 885 | 885 | /** |
| 886 | 886 | * The SPARQL service. |
| 887 | 887 | */ |
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 888 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 889 | 889 | |
| 890 | 890 | /** |
| 891 | 891 | * The WordLift import service. |
| 892 | 892 | */ |
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 893 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 894 | 894 | |
| 895 | 895 | /** |
| 896 | 896 | * The WordLift URI service. |
| 897 | 897 | */ |
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 898 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | 910 | |
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 913 | 913 | |
| 914 | 914 | /** |
| 915 | 915 | * Load the converters. |
| 916 | 916 | */ |
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | 923 | |
| 924 | 924 | /** |
| 925 | 925 | * Load cache-related files. |
| 926 | 926 | */ |
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 927 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 928 | 928 | |
| 929 | 929 | /** |
| 930 | 930 | * Load the content filter. |
| 931 | 931 | */ |
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | 933 | |
| 934 | 934 | /* |
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 937 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | 938 | |
| 939 | 939 | /** |
| 940 | 940 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 941 | 941 | * |
| 942 | 942 | * @since 3.8.0 |
| 943 | 943 | */ |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | 945 | |
| 946 | 946 | // The Publisher Service and the AJAX adapter. |
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | 949 | |
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 950 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 951 | 951 | |
| 952 | 952 | /** |
| 953 | 953 | * Load the WordLift key validation service. |
| 954 | 954 | */ |
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | 956 | |
| 957 | 957 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | 959 | |
| 960 | 960 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | 964 | |
| 965 | 965 | /** Linked Data. */ |
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 966 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | 977 | |
| 978 | 978 | /** Linked Data Rendition. */ |
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 979 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | 983 | |
| 984 | 984 | /** Services. */ |
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 988 | 988 | |
| 989 | 989 | /** Adapters. */ |
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** Async Tasks. */ |
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | 1003 | |
| 1004 | 1004 | /** Autocomplete. */ |
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | 1007 | |
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1008 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | 1009 | |
| 1010 | 1010 | /** Analytics */ |
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1011 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | 1012 | |
| 1013 | 1013 | /** |
| 1014 | 1014 | * The class responsible for defining all actions that occur in the admin area. |
| 1015 | 1015 | */ |
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1016 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1017 | 1017 | |
| 1018 | 1018 | /** |
| 1019 | 1019 | * The class to customize the entity list admin page. |
| 1020 | 1020 | */ |
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1021 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | 1022 | |
| 1023 | 1023 | /** |
| 1024 | 1024 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1025 | 1025 | */ |
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1026 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | 1027 | |
| 1028 | 1028 | /** |
| 1029 | 1029 | * The Notice service. |
| 1030 | 1030 | */ |
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1031 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1032 | 1032 | |
| 1033 | 1033 | /** |
| 1034 | 1034 | * The PrimaShop adapter. |
| 1035 | 1035 | */ |
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1036 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | 1039 | * The WordLift Dashboard service. |
| 1040 | 1040 | */ |
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1041 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | 1042 | |
| 1043 | 1043 | /** |
| 1044 | 1044 | * The admin 'Install wizard' page. |
| 1045 | 1045 | */ |
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1046 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | 1049 | * The WordLift entity type list admin page controller. |
| 1050 | 1050 | */ |
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1051 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | 1052 | |
| 1053 | 1053 | /** |
| 1054 | 1054 | * The WordLift entity type settings admin page controller. |
| 1055 | 1055 | */ |
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1056 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | 1057 | |
| 1058 | 1058 | /** |
| 1059 | 1059 | * The admin 'Download Your Data' page. |
| 1060 | 1060 | */ |
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1061 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | 1062 | |
| 1063 | 1063 | /** |
| 1064 | 1064 | * The admin 'WordLift Settings' page. |
| 1065 | 1065 | */ |
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1066 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | 1082 | |
| 1083 | 1083 | /** Admin Pages */ |
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1084 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | 1088 | |
| 1089 | 1089 | /** |
| 1090 | 1090 | * The class responsible for defining all actions that occur in the public-facing |
| 1091 | 1091 | * side of the site. |
| 1092 | 1092 | */ |
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1093 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1094 | 1094 | |
| 1095 | 1095 | /** |
| 1096 | 1096 | * The shortcode abstract class. |
| 1097 | 1097 | */ |
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1098 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1099 | 1099 | |
| 1100 | 1100 | /** |
| 1101 | 1101 | * The Timeline shortcode. |
| 1102 | 1102 | */ |
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1103 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | 1104 | |
| 1105 | 1105 | /** |
| 1106 | 1106 | * The Navigator shortcode. |
| 1107 | 1107 | */ |
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1108 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | 1109 | |
| 1110 | 1110 | /** |
| 1111 | 1111 | * The chord shortcode. |
| 1112 | 1112 | */ |
| 1113 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1113 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | 1114 | |
| 1115 | 1115 | /** |
| 1116 | 1116 | * The geomap shortcode. |
| 1117 | 1117 | */ |
| 1118 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1118 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | 1119 | |
| 1120 | 1120 | /** |
| 1121 | 1121 | * The entity cloud shortcode. |
| 1122 | 1122 | */ |
| 1123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1123 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | 1124 | |
| 1125 | 1125 | /** |
| 1126 | 1126 | * The entity glossary shortcode. |
| 1127 | 1127 | */ |
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1128 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | 1130 | |
| 1131 | 1131 | /** |
| 1132 | 1132 | * Faceted Search shortcode. |
| 1133 | 1133 | */ |
| 1134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1134 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | 1135 | |
| 1136 | 1136 | /** |
| 1137 | 1137 | * The ShareThis service. |
| 1138 | 1138 | */ |
| 1139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1139 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | 1140 | |
| 1141 | 1141 | /** |
| 1142 | 1142 | * The SEO service. |
| 1143 | 1143 | */ |
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1144 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1145 | 1145 | |
| 1146 | 1146 | /** |
| 1147 | 1147 | * The AMP service. |
| 1148 | 1148 | */ |
| 1149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1149 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1150 | 1150 | |
| 1151 | 1151 | /** Widgets */ |
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1152 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1153 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | 1154 | |
| 1155 | 1155 | /* |
| 1156 | 1156 | * Schema.org Services. |
| 1157 | 1157 | * |
| 1158 | 1158 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1159 | 1159 | */ |
| 1160 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1161 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1160 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1161 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1164 | 1164 | new Wordlift_Schemaorg_Sync_Service(); |
| 1165 | 1165 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1166 | 1166 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | |
| 1173 | 1173 | // Instantiate a global logger. |
| 1174 | 1174 | global $wl_logger; |
| 1175 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1175 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1176 | 1176 | |
| 1177 | 1177 | // Load the `wl-api` end-point. |
| 1178 | 1178 | new Wordlift_Http_Api(); |
@@ -1183,13 +1183,13 @@ discard block |
||
| 1183 | 1183 | /** Services. */ |
| 1184 | 1184 | // Create the configuration service. |
| 1185 | 1185 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1186 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1186 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1187 | 1187 | |
| 1188 | 1188 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1189 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1189 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1190 | 1190 | |
| 1191 | 1191 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1192 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1192 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1193 | 1193 | |
| 1194 | 1194 | // Create an instance of the UI service. |
| 1195 | 1195 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1198,34 +1198,34 @@ discard block |
||
| 1198 | 1198 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1199 | 1199 | |
| 1200 | 1200 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1201 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1201 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1202 | 1202 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1203 | 1203 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1204 | 1204 | |
| 1205 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1206 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1207 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1208 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1209 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1205 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1206 | + $this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/'); |
|
| 1207 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1208 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1209 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1210 | 1210 | |
| 1211 | 1211 | // Instantiate the JSON-LD service. |
| 1212 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1212 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1213 | 1213 | |
| 1214 | 1214 | /** Linked Data. */ |
| 1215 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1216 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1215 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1216 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1217 | 1217 | |
| 1218 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1218 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1219 | 1219 | |
| 1220 | 1220 | // Create a new instance of the Redirect service. |
| 1221 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1222 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1223 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1221 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1222 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1223 | + $this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
| 1224 | 1224 | |
| 1225 | 1225 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1226 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1226 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1227 | 1227 | |
| 1228 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1228 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service); |
|
| 1229 | 1229 | |
| 1230 | 1230 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1231 | 1231 | |
@@ -1239,68 +1239,68 @@ discard block |
||
| 1239 | 1239 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1240 | 1240 | |
| 1241 | 1241 | // Create an import service instance to hook later to WP's import function. |
| 1242 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1242 | + $this->import_service = new Wordlift_Import_Service($this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri()); |
|
| 1243 | 1243 | |
| 1244 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1244 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1245 | 1245 | |
| 1246 | 1246 | // Create the entity rating service. |
| 1247 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1247 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1248 | 1248 | |
| 1249 | 1249 | // Create entity list customization (wp-admin/edit.php). |
| 1250 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1250 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1251 | 1251 | |
| 1252 | 1252 | // Create a new instance of the Redirect service. |
| 1253 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1253 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1254 | 1254 | |
| 1255 | 1255 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1256 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1257 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1258 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1256 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1257 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1258 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1259 | 1259 | |
| 1260 | 1260 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1261 | 1261 | |
| 1262 | 1262 | // Instantiate the JSON-LD service. |
| 1263 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1264 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1265 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1266 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1267 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1268 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1269 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1270 | - |
|
| 1271 | - |
|
| 1272 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1273 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1274 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1275 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1276 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1277 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1263 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1264 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service); |
|
| 1265 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1266 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter($this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter); |
|
| 1267 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1268 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service); |
|
| 1269 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1270 | + |
|
| 1271 | + |
|
| 1272 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1273 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1274 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1275 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1276 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1277 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service); |
|
| 1278 | 1278 | |
| 1279 | 1279 | // Initialize the shortcodes. |
| 1280 | 1280 | new Wordlift_Navigator_Shortcode(); |
| 1281 | 1281 | new Wordlift_Chord_Shortcode(); |
| 1282 | 1282 | new Wordlift_Geomap_Shortcode(); |
| 1283 | 1283 | new Wordlift_Timeline_Shortcode(); |
| 1284 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1285 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1284 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1285 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1286 | 1286 | new Wordlift_Faceted_Search_Shortcode(); |
| 1287 | 1287 | |
| 1288 | 1288 | // Initialize the SEO service. |
| 1289 | 1289 | new Wordlift_Seo_Service(); |
| 1290 | 1290 | |
| 1291 | 1291 | // Initialize the AMP service. |
| 1292 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1292 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1293 | 1293 | |
| 1294 | 1294 | /** Services. */ |
| 1295 | 1295 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1296 | 1296 | new Wordlift_Image_Service(); |
| 1297 | 1297 | |
| 1298 | 1298 | /** Adapters. */ |
| 1299 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1300 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1301 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1302 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1303 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1299 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1300 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1301 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1302 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service); |
|
| 1303 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1304 | 1304 | |
| 1305 | 1305 | /* |
| 1306 | 1306 | * Exclude our public js from WP-Rocket. |
@@ -1324,8 +1324,8 @@ discard block |
||
| 1324 | 1324 | new Wordlift_Push_References_Async_Task(); |
| 1325 | 1325 | |
| 1326 | 1326 | /** WL Autocomplete. */ |
| 1327 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1328 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1327 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service); |
|
| 1328 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service); |
|
| 1329 | 1329 | |
| 1330 | 1330 | /** WordPress Admin UI. */ |
| 1331 | 1331 | |
@@ -1336,15 +1336,15 @@ discard block |
||
| 1336 | 1336 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1337 | 1337 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1338 | 1338 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1339 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1340 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1339 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1340 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1341 | 1341 | |
| 1342 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1343 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1344 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1342 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element); |
|
| 1343 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service); |
|
| 1344 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1345 | 1345 | |
| 1346 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1347 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1346 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1347 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1348 | 1348 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1349 | 1349 | |
| 1350 | 1350 | // Pages. |
@@ -1355,9 +1355,9 @@ discard block |
||
| 1355 | 1355 | * |
| 1356 | 1356 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1357 | 1357 | */ |
| 1358 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1359 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1358 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1359 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1361 | 1361 | } |
| 1362 | 1362 | new Wordlift_Entity_Type_Admin_Service(); |
| 1363 | 1363 | |
@@ -1371,23 +1371,23 @@ discard block |
||
| 1371 | 1371 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1372 | 1372 | |
| 1373 | 1373 | /* WordPress Admin. */ |
| 1374 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1375 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1374 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1375 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1376 | 1376 | |
| 1377 | 1377 | // Create an instance of the install wizard. |
| 1378 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1378 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element); |
|
| 1379 | 1379 | |
| 1380 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1380 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1381 | 1381 | |
| 1382 | 1382 | // User Profile. |
| 1383 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1383 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1384 | 1384 | |
| 1385 | 1385 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1386 | 1386 | |
| 1387 | 1387 | // Load the debug service if WP is in debug mode. |
| 1388 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1389 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1390 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1388 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1389 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1390 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | 1393 | // Remote Image Service. |
@@ -1400,12 +1400,12 @@ discard block |
||
| 1400 | 1400 | * |
| 1401 | 1401 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1402 | 1402 | */ |
| 1403 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1403 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1404 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1406 | 1406 | |
| 1407 | 1407 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1408 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1408 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1409 | 1409 | |
| 1410 | 1410 | /* |
| 1411 | 1411 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1414,8 +1414,8 @@ discard block |
||
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 3.20.0 |
| 1416 | 1416 | */ |
| 1417 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1417 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1419 | 1419 | |
| 1420 | 1420 | /* |
| 1421 | 1421 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1424,15 +1424,15 @@ discard block |
||
| 1424 | 1424 | * |
| 1425 | 1425 | * @since 3.20.0 |
| 1426 | 1426 | */ |
| 1427 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1427 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1429 | 1429 | |
| 1430 | 1430 | /* |
| 1431 | 1431 | * Load dependencies for the front-end. |
| 1432 | 1432 | * |
| 1433 | 1433 | * @since 3.20.0 |
| 1434 | 1434 | */ |
| 1435 | - if ( ! is_admin() ) { |
|
| 1435 | + if ( ! is_admin()) { |
|
| 1436 | 1436 | /* |
| 1437 | 1437 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1438 | 1438 | * |
@@ -1440,8 +1440,8 @@ discard block |
||
| 1440 | 1440 | * |
| 1441 | 1441 | * @since 3.20.0 |
| 1442 | 1442 | */ |
| 1443 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1443 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | + new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | } |
@@ -1458,9 +1458,9 @@ discard block |
||
| 1458 | 1458 | private function set_locale() { |
| 1459 | 1459 | |
| 1460 | 1460 | $plugin_i18n = new Wordlift_i18n(); |
| 1461 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1461 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1462 | 1462 | |
| 1463 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1463 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1464 | 1464 | |
| 1465 | 1465 | } |
| 1466 | 1466 | |
@@ -1481,29 +1481,29 @@ discard block |
||
| 1481 | 1481 | $this->user_service |
| 1482 | 1482 | ); |
| 1483 | 1483 | |
| 1484 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1484 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1485 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1486 | 1486 | |
| 1487 | 1487 | // Hook the init action to taxonomy services. |
| 1488 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1489 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1488 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1489 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1490 | 1490 | |
| 1491 | 1491 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1492 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1492 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1493 | 1493 | |
| 1494 | 1494 | // Hook the added_post_meta action to the Thumbnail service. |
| 1495 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1495 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1496 | 1496 | |
| 1497 | 1497 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1498 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1498 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1499 | 1499 | |
| 1500 | 1500 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1501 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1501 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1502 | 1502 | |
| 1503 | 1503 | // Register custom allowed redirect hosts. |
| 1504 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1504 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1505 | 1505 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1506 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1506 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1507 | 1507 | |
| 1508 | 1508 | /* |
| 1509 | 1509 | * The old dashboard is replaced with dashboard v2. |
@@ -1521,80 +1521,80 @@ discard block |
||
| 1521 | 1521 | |
| 1522 | 1522 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1523 | 1523 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1524 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1525 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1524 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1525 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1526 | 1526 | |
| 1527 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1528 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1527 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1528 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1529 | 1529 | |
| 1530 | 1530 | // Entity listing customization (wp-admin/edit.php) |
| 1531 | 1531 | // Add custom columns. |
| 1532 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1532 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1533 | 1533 | // no explicit entity as it prevents handling of other post types. |
| 1534 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1534 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1535 | 1535 | // Add 4W selection. |
| 1536 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1537 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1538 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1539 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1536 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1537 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1538 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1539 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1540 | 1540 | |
| 1541 | 1541 | /* |
| 1542 | 1542 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1543 | 1543 | * |
| 1544 | 1544 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1545 | 1545 | */ |
| 1546 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1547 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1546 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1547 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1551 | 1551 | // entities. |
| 1552 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1552 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1553 | 1553 | |
| 1554 | 1554 | // Filter imported post meta. |
| 1555 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1555 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1556 | 1556 | |
| 1557 | 1557 | // Notify the import service when an import starts and ends. |
| 1558 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1559 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1558 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1559 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1560 | 1560 | |
| 1561 | 1561 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1562 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1563 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1562 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1563 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1564 | 1564 | |
| 1565 | 1565 | // Hook the menu to the Download Your Data page. |
| 1566 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1567 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1568 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1566 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1567 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1568 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1569 | 1569 | |
| 1570 | 1570 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1571 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1571 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1572 | 1572 | |
| 1573 | 1573 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1574 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1575 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1576 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1574 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1575 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1576 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1577 | 1577 | |
| 1578 | 1578 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1579 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1579 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1580 | 1580 | |
| 1581 | 1581 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1582 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1582 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1583 | 1583 | |
| 1584 | 1584 | // Hook the `admin_init` function to the Admin Setup. |
| 1585 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1585 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1586 | 1586 | |
| 1587 | 1587 | // Hook the admin_init to the settings page. |
| 1588 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1589 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1588 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1589 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1590 | 1590 | |
| 1591 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1591 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1592 | 1592 | |
| 1593 | 1593 | // Hook the menu creation on the general wordlift menu creation. |
| 1594 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1595 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1594 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1595 | + if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) { |
|
| 1596 | 1596 | // Add the functionality only if a flag is set in wp-config.php . |
| 1597 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1597 | + $this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2); |
|
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | /* |
@@ -1604,72 +1604,72 @@ discard block |
||
| 1604 | 1604 | * |
| 1605 | 1605 | * @since 3.20.0 |
| 1606 | 1606 | */ |
| 1607 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1607 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
| 1608 | 1608 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
| 1609 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1609 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | // Hook key update. |
| 1613 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1614 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1613 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1614 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1615 | 1615 | |
| 1616 | 1616 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1617 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1618 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1617 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1618 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1); |
|
| 1619 | 1619 | |
| 1620 | 1620 | // Hook the AJAX `wl_publisher` action name. |
| 1621 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1621 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1622 | 1622 | |
| 1623 | 1623 | // Hook row actions for the entity type list admin. |
| 1624 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1624 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1625 | 1625 | |
| 1626 | 1626 | /** Ajax actions. */ |
| 1627 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1627 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1628 | 1628 | |
| 1629 | 1629 | // Hook capabilities manipulation to allow access to entity type admin |
| 1630 | 1630 | // page on WordPress versions before 4.7. |
| 1631 | 1631 | global $wp_version; |
| 1632 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1633 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1632 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1633 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1636 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1637 | 1637 | |
| 1638 | 1638 | /** Adapters. */ |
| 1639 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1640 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1641 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1642 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1643 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1644 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1639 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1640 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit'); |
|
| 1641 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts'); |
|
| 1642 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel'); |
|
| 1643 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning'); |
|
| 1644 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1645 | 1645 | |
| 1646 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1647 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1646 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1647 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1648 | 1648 | |
| 1649 | 1649 | |
| 1650 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1651 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1650 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1651 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1652 | 1652 | |
| 1653 | 1653 | // Handle the autocomplete request. |
| 1654 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1654 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1655 | 1655 | $this->autocomplete_adapter, |
| 1656 | 1656 | 'wl_autocomplete', |
| 1657 | - ) ); |
|
| 1658 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1657 | + )); |
|
| 1658 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1659 | 1659 | $this->autocomplete_adapter, |
| 1660 | 1660 | 'wl_autocomplete', |
| 1661 | - ) ); |
|
| 1661 | + )); |
|
| 1662 | 1662 | |
| 1663 | 1663 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1664 | - if ( is_multisite() ) { |
|
| 1665 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1664 | + if (is_multisite()) { |
|
| 1665 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1668 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1669 | 1669 | |
| 1670 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1671 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1672 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1670 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1671 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1672 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1673 | 1673 | } |
| 1674 | 1674 | |
| 1675 | 1675 | /** |
@@ -1681,56 +1681,56 @@ discard block |
||
| 1681 | 1681 | */ |
| 1682 | 1682 | private function define_public_hooks() { |
| 1683 | 1683 | |
| 1684 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1684 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1685 | 1685 | |
| 1686 | 1686 | // Register the entity post type. |
| 1687 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1688 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1687 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1688 | + $this->loader->add_action('init', $this->install_service, 'install'); |
|
| 1689 | 1689 | |
| 1690 | 1690 | // Bind the link generation and handling hooks to the entity link service. |
| 1691 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1692 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1693 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1694 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1691 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1692 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1693 | + $this->loader->add_filter('wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3); |
|
| 1694 | + $this->loader->add_filter('wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4); |
|
| 1695 | 1695 | |
| 1696 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1697 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1696 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1697 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1698 | 1698 | |
| 1699 | 1699 | // Hook the content filter service to add entity links. |
| 1700 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1701 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1700 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1701 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | 1704 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1705 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1705 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1706 | 1706 | |
| 1707 | 1707 | // Hook the ShareThis service. |
| 1708 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1709 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1708 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1709 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1710 | 1710 | |
| 1711 | 1711 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1712 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1712 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1713 | 1713 | |
| 1714 | 1714 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1715 | 1715 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1716 | 1716 | // to categories. |
| 1717 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1717 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1718 | 1718 | |
| 1719 | 1719 | /* |
| 1720 | 1720 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1721 | 1721 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1722 | 1722 | * order of start time. |
| 1723 | 1723 | */ |
| 1724 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1724 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1725 | 1725 | |
| 1726 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1726 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1727 | 1727 | |
| 1728 | 1728 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1729 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1729 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1730 | 1730 | |
| 1731 | 1731 | // Analytics Script Frontend. |
| 1732 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1733 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1732 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1733 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | 1736 | } |
@@ -1783,11 +1783,11 @@ discard block |
||
| 1783 | 1783 | */ |
| 1784 | 1784 | private function load_cli_dependencies() { |
| 1785 | 1785 | |
| 1786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1786 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1787 | 1787 | |
| 1788 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1788 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command($this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service); |
|
| 1789 | 1789 | |
| 1790 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1790 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1791 | 1791 | |
| 1792 | 1792 | } |
| 1793 | 1793 | |
@@ -28,1484 +28,1484 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class Wordlift { |
| 30 | 30 | |
| 31 | - //<editor-fold desc="## FIELDS"> |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | - * the plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access protected |
|
| 39 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | - */ |
|
| 41 | - protected $loader; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * The unique identifier of this plugin. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * @access protected |
|
| 48 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | - */ |
|
| 50 | - protected $plugin_name; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * The current version of the plugin. |
|
| 54 | - * |
|
| 55 | - * @since 1.0.0 |
|
| 56 | - * @access protected |
|
| 57 | - * @var string $version The current version of the plugin. |
|
| 58 | - */ |
|
| 59 | - protected $version; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | - * |
|
| 64 | - * @since 3.12.0 |
|
| 65 | - * @access protected |
|
| 66 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | - */ |
|
| 68 | - protected $tinymce_adapter; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The Thumbnail service. |
|
| 72 | - * |
|
| 73 | - * @since 3.1.5 |
|
| 74 | - * @access private |
|
| 75 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | - */ |
|
| 77 | - private $thumbnail_service; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * The UI service. |
|
| 81 | - * |
|
| 82 | - * @since 3.2.0 |
|
| 83 | - * @access private |
|
| 84 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | - */ |
|
| 86 | - private $ui_service; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * The Schema service. |
|
| 90 | - * |
|
| 91 | - * @since 3.3.0 |
|
| 92 | - * @access protected |
|
| 93 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | - */ |
|
| 95 | - protected $schema_service; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * The Entity service. |
|
| 99 | - * |
|
| 100 | - * @since 3.1.0 |
|
| 101 | - * @access protected |
|
| 102 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | - */ |
|
| 104 | - protected $entity_service; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * The Topic Taxonomy service. |
|
| 108 | - * |
|
| 109 | - * @since 3.5.0 |
|
| 110 | - * @access private |
|
| 111 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | - */ |
|
| 113 | - private $topic_taxonomy_service; |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * The Entity Types Taxonomy service. |
|
| 117 | - * |
|
| 118 | - * @since 3.18.0 |
|
| 119 | - * @access private |
|
| 120 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | - */ |
|
| 122 | - private $entity_types_taxonomy_service; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * The User service. |
|
| 126 | - * |
|
| 127 | - * @since 3.1.7 |
|
| 128 | - * @access protected |
|
| 129 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | - */ |
|
| 131 | - protected $user_service; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * The Timeline service. |
|
| 135 | - * |
|
| 136 | - * @since 3.1.0 |
|
| 137 | - * @access private |
|
| 138 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | - */ |
|
| 140 | - private $timeline_service; |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * The Redirect service. |
|
| 144 | - * |
|
| 145 | - * @since 3.2.0 |
|
| 146 | - * @access private |
|
| 147 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | - */ |
|
| 149 | - private $redirect_service; |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * The Notice service. |
|
| 153 | - * |
|
| 154 | - * @since 3.3.0 |
|
| 155 | - * @access private |
|
| 156 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | - */ |
|
| 158 | - private $notice_service; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The Entity list customization. |
|
| 162 | - * |
|
| 163 | - * @since 3.3.0 |
|
| 164 | - * @access protected |
|
| 165 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | - */ |
|
| 167 | - protected $entity_list_service; |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * The Entity Types Taxonomy Walker. |
|
| 171 | - * |
|
| 172 | - * @since 3.1.0 |
|
| 173 | - * @access private |
|
| 174 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | - */ |
|
| 176 | - private $entity_types_taxonomy_walker; |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * The ShareThis service. |
|
| 180 | - * |
|
| 181 | - * @since 3.2.0 |
|
| 182 | - * @access private |
|
| 183 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | - */ |
|
| 185 | - private $sharethis_service; |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * The PrimaShop adapter. |
|
| 189 | - * |
|
| 190 | - * @since 3.2.3 |
|
| 191 | - * @access private |
|
| 192 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | - */ |
|
| 194 | - private $primashop_adapter; |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * The WordLift Dashboard adapter. |
|
| 198 | - * |
|
| 199 | - * @since 3.4.0 |
|
| 200 | - * @access private |
|
| 201 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | - */ |
|
| 203 | - private $dashboard_service; |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * The entity type service. |
|
| 207 | - * |
|
| 208 | - * @since 3.6.0 |
|
| 209 | - * @access private |
|
| 210 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | - */ |
|
| 212 | - private $entity_post_type_service; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | - * |
|
| 217 | - * @since 3.6.0 |
|
| 218 | - * @access private |
|
| 219 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 220 | - */ |
|
| 221 | - private $entity_link_service; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | - * |
|
| 226 | - * @since 3.6.0 |
|
| 227 | - * @access protected |
|
| 228 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | - */ |
|
| 230 | - protected $sparql_service; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * A {@link Wordlift_Import_Service} instance. |
|
| 234 | - * |
|
| 235 | - * @since 3.6.0 |
|
| 236 | - * @access private |
|
| 237 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | - */ |
|
| 239 | - private $import_service; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | - * |
|
| 244 | - * @since 3.6.0 |
|
| 245 | - * @access private |
|
| 246 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | - */ |
|
| 248 | - private $rebuild_service; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | - * |
|
| 253 | - * @since 3.7.0 |
|
| 254 | - * @access protected |
|
| 255 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | - */ |
|
| 257 | - protected $jsonld_service; |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | - * |
|
| 262 | - * @since 3.14.0 |
|
| 263 | - * @access protected |
|
| 264 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | - */ |
|
| 266 | - protected $jsonld_website_converter; |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | - * |
|
| 271 | - * @since 3.7.0 |
|
| 272 | - * @access private |
|
| 273 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | - */ |
|
| 275 | - private $property_factory; |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * The 'Download Your Data' page. |
|
| 279 | - * |
|
| 280 | - * @since 3.6.0 |
|
| 281 | - * @access private |
|
| 282 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | - */ |
|
| 284 | - private $download_your_data_page; |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * The 'WordLift Settings' page. |
|
| 288 | - * |
|
| 289 | - * @since 3.11.0 |
|
| 290 | - * @access protected |
|
| 291 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | - */ |
|
| 293 | - protected $settings_page; |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * The 'WordLift Batch analysis' page. |
|
| 297 | - * |
|
| 298 | - * @since 3.14.0 |
|
| 299 | - * @access protected |
|
| 300 | - * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | - */ |
|
| 302 | - protected $batch_analysis_page; |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * The install wizard page. |
|
| 306 | - * |
|
| 307 | - * @since 3.9.0 |
|
| 308 | - * @access private |
|
| 309 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | - */ |
|
| 311 | - private $admin_setup; |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | - * linking of entities to their pages. |
|
| 316 | - * |
|
| 317 | - * @since 3.8.0 |
|
| 318 | - * @access private |
|
| 319 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | - */ |
|
| 321 | - private $content_filter_service; |
|
| 322 | - |
|
| 323 | - /** |
|
| 324 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | - * |
|
| 326 | - * @since 3.9.0 |
|
| 327 | - * @access private |
|
| 328 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | - */ |
|
| 330 | - private $key_validation_service; |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | - * |
|
| 335 | - * @since 3.10.0 |
|
| 336 | - * @access private |
|
| 337 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | - */ |
|
| 339 | - private $rating_service; |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | - * |
|
| 344 | - * @since 3.10.0 |
|
| 345 | - * @access protected |
|
| 346 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | - */ |
|
| 348 | - protected $post_to_jsonld_converter; |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | - * |
|
| 353 | - * @since 3.10.0 |
|
| 354 | - * @access protected |
|
| 355 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | - */ |
|
| 357 | - protected $configuration_service; |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * A {@link Wordlift_Install_Service} instance. |
|
| 361 | - * |
|
| 362 | - * @since 3.18.0 |
|
| 363 | - * @access protected |
|
| 364 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | - */ |
|
| 366 | - protected $install_service; |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | - * |
|
| 371 | - * @since 3.10.0 |
|
| 372 | - * @access protected |
|
| 373 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | - */ |
|
| 375 | - protected $entity_type_service; |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | - * |
|
| 380 | - * @since 3.10.0 |
|
| 381 | - * @access protected |
|
| 382 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | - */ |
|
| 384 | - protected $entity_post_to_jsonld_converter; |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | - * |
|
| 389 | - * @since 3.10.0 |
|
| 390 | - * @access protected |
|
| 391 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | - */ |
|
| 393 | - protected $postid_to_jsonld_converter; |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | - * |
|
| 398 | - * @since 3.9.8 |
|
| 399 | - * @access private |
|
| 400 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | - */ |
|
| 402 | - private $status_page; |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | - * |
|
| 407 | - * @since 3.11.0 |
|
| 408 | - * @access protected |
|
| 409 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | - */ |
|
| 411 | - protected $category_taxonomy_service; |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | - * |
|
| 416 | - * @since 3.11.0 |
|
| 417 | - * @access protected |
|
| 418 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | - */ |
|
| 420 | - protected $entity_page_service; |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | - * |
|
| 425 | - * @since 3.11.0 |
|
| 426 | - * @access protected |
|
| 427 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | - */ |
|
| 429 | - protected $settings_page_action_link; |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 433 | - * |
|
| 434 | - * @since 3.11.0 |
|
| 435 | - * @access protected |
|
| 436 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | - */ |
|
| 438 | - protected $analytics_settings_page_action_link; |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | - * |
|
| 443 | - * @since 3.11.0 |
|
| 444 | - * @access protected |
|
| 445 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | - */ |
|
| 447 | - protected $analytics_connect; |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | - * |
|
| 452 | - * @since 3.11.0 |
|
| 453 | - * @access protected |
|
| 454 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | - */ |
|
| 456 | - protected $publisher_ajax_adapter; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | - * |
|
| 461 | - * @since 3.11.0 |
|
| 462 | - * @access protected |
|
| 463 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | - */ |
|
| 465 | - protected $input_element; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | - * |
|
| 470 | - * @since 3.13.0 |
|
| 471 | - * @access protected |
|
| 472 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | - */ |
|
| 474 | - protected $radio_input_element; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | - * |
|
| 479 | - * @since 3.11.0 |
|
| 480 | - * @access protected |
|
| 481 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | - */ |
|
| 483 | - protected $language_select_element; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | - * |
|
| 488 | - * @since 3.18.0 |
|
| 489 | - * @access protected |
|
| 490 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | - */ |
|
| 492 | - protected $country_select_element; |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | - * |
|
| 497 | - * @since 3.11.0 |
|
| 498 | - * @access protected |
|
| 499 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | - */ |
|
| 501 | - protected $publisher_element; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | - * |
|
| 506 | - * @since 3.11.0 |
|
| 507 | - * @access protected |
|
| 508 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | - */ |
|
| 510 | - protected $select2_element; |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * The controller for the entity type list admin page |
|
| 514 | - * |
|
| 515 | - * @since 3.11.0 |
|
| 516 | - * @access private |
|
| 517 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | - */ |
|
| 519 | - private $entity_type_admin_page; |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * The controller for the entity type settings admin page |
|
| 523 | - * |
|
| 524 | - * @since 3.11.0 |
|
| 525 | - * @access private |
|
| 526 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | - */ |
|
| 528 | - private $entity_type_settings_admin_page; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | - * |
|
| 533 | - * @since 3.11.0 |
|
| 534 | - * @access protected |
|
| 535 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | - */ |
|
| 537 | - protected $related_entities_cloud_widget; |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | - * |
|
| 542 | - * @since 3.14.0 |
|
| 543 | - * @access protected |
|
| 544 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | - */ |
|
| 546 | - protected $author_element; |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | - * |
|
| 551 | - * @since 3.14.0 |
|
| 552 | - * @access protected |
|
| 553 | - * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | - */ |
|
| 555 | - protected $batch_analysis_service; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | - * |
|
| 560 | - * @since 3.12.0 |
|
| 561 | - * @access protected |
|
| 562 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | - */ |
|
| 564 | - protected $sample_data_service; |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | - * |
|
| 569 | - * @since 3.12.0 |
|
| 570 | - * @access protected |
|
| 571 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | - */ |
|
| 573 | - protected $sample_data_ajax_adapter; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.14.2 |
|
| 579 | - * @access protected |
|
| 580 | - * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | - */ |
|
| 582 | - private $batch_analysis_adapter; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.14.3 |
|
| 588 | - * @access private |
|
| 589 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | - */ |
|
| 591 | - private $relation_rebuild_service; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | - * |
|
| 596 | - * @since 3.14.3 |
|
| 597 | - * @access private |
|
| 598 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | - */ |
|
| 600 | - private $relation_rebuild_adapter; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | - * |
|
| 605 | - * @since 3.18.0 |
|
| 606 | - * @access private |
|
| 607 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | - */ |
|
| 609 | - private $reference_rebuild_service; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | - * |
|
| 614 | - * @since 3.16.0 |
|
| 615 | - * @access protected |
|
| 616 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | - */ |
|
| 618 | - protected $google_analytics_export_service; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * {@link Wordlift}'s singleton instance. |
|
| 622 | - * |
|
| 623 | - * @since 3.15.0 |
|
| 624 | - * @access protected |
|
| 625 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | - */ |
|
| 627 | - protected $entity_type_adapter; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | - * |
|
| 632 | - * @since 3.15.0 |
|
| 633 | - * @access protected |
|
| 634 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | - */ |
|
| 636 | - protected $linked_data_service; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | - * |
|
| 641 | - * @since 3.15.0 |
|
| 642 | - * @access protected |
|
| 643 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | - */ |
|
| 645 | - protected $storage_factory; |
|
| 646 | - |
|
| 647 | - /** |
|
| 648 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | - * |
|
| 650 | - * @since 3.15.0 |
|
| 651 | - * @access protected |
|
| 652 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | - */ |
|
| 654 | - protected $rendition_factory; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | - * |
|
| 659 | - * @since 3.15.0 |
|
| 660 | - * @access private |
|
| 661 | - * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | - */ |
|
| 663 | - private $autocomplete_service; |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | - * |
|
| 668 | - * @since 3.15.0 |
|
| 669 | - * @access private |
|
| 670 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | - */ |
|
| 672 | - private $autocomplete_adapter; |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | - * |
|
| 677 | - * @since 3.15.0 |
|
| 678 | - * @access protected |
|
| 679 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | - */ |
|
| 681 | - protected $relation_service; |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | - * |
|
| 686 | - * @since 3.16.0 |
|
| 687 | - * @access protected |
|
| 688 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | - * |
|
| 690 | - */ |
|
| 691 | - protected $cached_postid_to_jsonld_converter; |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | - * |
|
| 696 | - * @since 3.16.0 |
|
| 697 | - * @access protected |
|
| 698 | - * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | - */ |
|
| 700 | - protected $file_cache_service; |
|
| 701 | - |
|
| 702 | - /** |
|
| 703 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | - * |
|
| 705 | - * @since 3.16.3 |
|
| 706 | - * @access protected |
|
| 707 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | - */ |
|
| 709 | - protected $entity_uri_service; |
|
| 710 | - |
|
| 711 | - /** |
|
| 712 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | - * |
|
| 714 | - * @since 3.19.0 |
|
| 715 | - * @access protected |
|
| 716 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | - */ |
|
| 718 | - protected $publisher_service; |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * {@link Wordlift}'s singleton instance. |
|
| 722 | - * |
|
| 723 | - * @since 3.11.2 |
|
| 724 | - * @access private |
|
| 725 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | - */ |
|
| 727 | - private static $instance; |
|
| 728 | - |
|
| 729 | - //</editor-fold> |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Define the core functionality of the plugin. |
|
| 733 | - * |
|
| 734 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | - * the public-facing side of the site. |
|
| 737 | - * |
|
| 738 | - * @since 1.0.0 |
|
| 739 | - */ |
|
| 740 | - public function __construct() { |
|
| 741 | - |
|
| 742 | - self::$instance = $this; |
|
| 743 | - |
|
| 744 | - $this->plugin_name = 'wordlift'; |
|
| 745 | - $this->version = '3.21.0'; |
|
| 746 | - $this->load_dependencies(); |
|
| 747 | - $this->set_locale(); |
|
| 748 | - $this->define_admin_hooks(); |
|
| 749 | - $this->define_public_hooks(); |
|
| 750 | - |
|
| 751 | - // If we're in `WP_CLI` load the related files. |
|
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | - $this->load_cli_dependencies(); |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - /** |
|
| 759 | - * Get the singleton instance. |
|
| 760 | - * |
|
| 761 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 762 | - * @since 3.11.2 |
|
| 763 | - * |
|
| 764 | - */ |
|
| 765 | - public static function get_instance() { |
|
| 766 | - |
|
| 767 | - return self::$instance; |
|
| 768 | - } |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * Load the required dependencies for this plugin. |
|
| 772 | - * |
|
| 773 | - * Include the following files that make up the plugin: |
|
| 774 | - * |
|
| 775 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | - * |
|
| 780 | - * Create an instance of the loader which will be used to register the hooks |
|
| 781 | - * with WordPress. |
|
| 782 | - * |
|
| 783 | - * @since 1.0.0 |
|
| 784 | - * @access private |
|
| 785 | - */ |
|
| 786 | - private function load_dependencies() { |
|
| 787 | - |
|
| 788 | - /** |
|
| 789 | - * The class responsible for orchestrating the actions and filters of the |
|
| 790 | - * core plugin. |
|
| 791 | - */ |
|
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | - |
|
| 794 | - // The class responsible for plugin uninstall. |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * The class responsible for defining internationalization functionality |
|
| 799 | - * of the plugin. |
|
| 800 | - */ |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * WordLift's supported languages. |
|
| 805 | - */ |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * WordLift's supported countries. |
|
| 810 | - */ |
|
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * Provide support functions to sanitize data. |
|
| 815 | - */ |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | - |
|
| 818 | - /** Services. */ |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * The Query builder. |
|
| 832 | - */ |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | - |
|
| 835 | - /** |
|
| 836 | - * The Schema service. |
|
| 837 | - */ |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | - |
|
| 840 | - /** |
|
| 841 | - * The schema:url property service. |
|
| 842 | - */ |
|
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The UI service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * The Thumbnail service. |
|
| 853 | - */ |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | - |
|
| 856 | - /** |
|
| 857 | - * The Entity Types Taxonomy service. |
|
| 858 | - */ |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | - |
|
| 861 | - /** |
|
| 862 | - * The Entity service. |
|
| 863 | - */ |
|
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | - |
|
| 867 | - // Add the entity rating service. |
|
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | - |
|
| 870 | - /** |
|
| 871 | - * The User service. |
|
| 872 | - */ |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * The Timeline service. |
|
| 877 | - */ |
|
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | - |
|
| 880 | - /** |
|
| 881 | - * The Topic Taxonomy service. |
|
| 882 | - */ |
|
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | - |
|
| 885 | - /** |
|
| 886 | - * The SPARQL service. |
|
| 887 | - */ |
|
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * The WordLift import service. |
|
| 892 | - */ |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | - |
|
| 895 | - /** |
|
| 896 | - * The WordLift URI service. |
|
| 897 | - */ |
|
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | - |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | - |
|
| 914 | - /** |
|
| 915 | - * Load the converters. |
|
| 916 | - */ |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | - |
|
| 924 | - /** |
|
| 925 | - * Load cache-related files. |
|
| 926 | - */ |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | - |
|
| 929 | - /** |
|
| 930 | - * Load the content filter. |
|
| 931 | - */ |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | - |
|
| 934 | - /* |
|
| 31 | + //<editor-fold desc="## FIELDS"> |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | + * the plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access protected |
|
| 39 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | + */ |
|
| 41 | + protected $loader; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * The unique identifier of this plugin. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * @access protected |
|
| 48 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | + */ |
|
| 50 | + protected $plugin_name; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * The current version of the plugin. |
|
| 54 | + * |
|
| 55 | + * @since 1.0.0 |
|
| 56 | + * @access protected |
|
| 57 | + * @var string $version The current version of the plugin. |
|
| 58 | + */ |
|
| 59 | + protected $version; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | + * |
|
| 64 | + * @since 3.12.0 |
|
| 65 | + * @access protected |
|
| 66 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | + */ |
|
| 68 | + protected $tinymce_adapter; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The Thumbnail service. |
|
| 72 | + * |
|
| 73 | + * @since 3.1.5 |
|
| 74 | + * @access private |
|
| 75 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | + */ |
|
| 77 | + private $thumbnail_service; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * The UI service. |
|
| 81 | + * |
|
| 82 | + * @since 3.2.0 |
|
| 83 | + * @access private |
|
| 84 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | + */ |
|
| 86 | + private $ui_service; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * The Schema service. |
|
| 90 | + * |
|
| 91 | + * @since 3.3.0 |
|
| 92 | + * @access protected |
|
| 93 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | + */ |
|
| 95 | + protected $schema_service; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * The Entity service. |
|
| 99 | + * |
|
| 100 | + * @since 3.1.0 |
|
| 101 | + * @access protected |
|
| 102 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | + */ |
|
| 104 | + protected $entity_service; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * The Topic Taxonomy service. |
|
| 108 | + * |
|
| 109 | + * @since 3.5.0 |
|
| 110 | + * @access private |
|
| 111 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | + */ |
|
| 113 | + private $topic_taxonomy_service; |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * The Entity Types Taxonomy service. |
|
| 117 | + * |
|
| 118 | + * @since 3.18.0 |
|
| 119 | + * @access private |
|
| 120 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | + */ |
|
| 122 | + private $entity_types_taxonomy_service; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * The User service. |
|
| 126 | + * |
|
| 127 | + * @since 3.1.7 |
|
| 128 | + * @access protected |
|
| 129 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | + */ |
|
| 131 | + protected $user_service; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * The Timeline service. |
|
| 135 | + * |
|
| 136 | + * @since 3.1.0 |
|
| 137 | + * @access private |
|
| 138 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | + */ |
|
| 140 | + private $timeline_service; |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * The Redirect service. |
|
| 144 | + * |
|
| 145 | + * @since 3.2.0 |
|
| 146 | + * @access private |
|
| 147 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | + */ |
|
| 149 | + private $redirect_service; |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * The Notice service. |
|
| 153 | + * |
|
| 154 | + * @since 3.3.0 |
|
| 155 | + * @access private |
|
| 156 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | + */ |
|
| 158 | + private $notice_service; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The Entity list customization. |
|
| 162 | + * |
|
| 163 | + * @since 3.3.0 |
|
| 164 | + * @access protected |
|
| 165 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | + */ |
|
| 167 | + protected $entity_list_service; |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * The Entity Types Taxonomy Walker. |
|
| 171 | + * |
|
| 172 | + * @since 3.1.0 |
|
| 173 | + * @access private |
|
| 174 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | + */ |
|
| 176 | + private $entity_types_taxonomy_walker; |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * The ShareThis service. |
|
| 180 | + * |
|
| 181 | + * @since 3.2.0 |
|
| 182 | + * @access private |
|
| 183 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | + */ |
|
| 185 | + private $sharethis_service; |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * The PrimaShop adapter. |
|
| 189 | + * |
|
| 190 | + * @since 3.2.3 |
|
| 191 | + * @access private |
|
| 192 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | + */ |
|
| 194 | + private $primashop_adapter; |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * The WordLift Dashboard adapter. |
|
| 198 | + * |
|
| 199 | + * @since 3.4.0 |
|
| 200 | + * @access private |
|
| 201 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | + */ |
|
| 203 | + private $dashboard_service; |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * The entity type service. |
|
| 207 | + * |
|
| 208 | + * @since 3.6.0 |
|
| 209 | + * @access private |
|
| 210 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | + */ |
|
| 212 | + private $entity_post_type_service; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | + * |
|
| 217 | + * @since 3.6.0 |
|
| 218 | + * @access private |
|
| 219 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 220 | + */ |
|
| 221 | + private $entity_link_service; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | + * |
|
| 226 | + * @since 3.6.0 |
|
| 227 | + * @access protected |
|
| 228 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | + */ |
|
| 230 | + protected $sparql_service; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * A {@link Wordlift_Import_Service} instance. |
|
| 234 | + * |
|
| 235 | + * @since 3.6.0 |
|
| 236 | + * @access private |
|
| 237 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | + */ |
|
| 239 | + private $import_service; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | + * |
|
| 244 | + * @since 3.6.0 |
|
| 245 | + * @access private |
|
| 246 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | + */ |
|
| 248 | + private $rebuild_service; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | + * |
|
| 253 | + * @since 3.7.0 |
|
| 254 | + * @access protected |
|
| 255 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | + */ |
|
| 257 | + protected $jsonld_service; |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | + * |
|
| 262 | + * @since 3.14.0 |
|
| 263 | + * @access protected |
|
| 264 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | + */ |
|
| 266 | + protected $jsonld_website_converter; |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | + * |
|
| 271 | + * @since 3.7.0 |
|
| 272 | + * @access private |
|
| 273 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | + */ |
|
| 275 | + private $property_factory; |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * The 'Download Your Data' page. |
|
| 279 | + * |
|
| 280 | + * @since 3.6.0 |
|
| 281 | + * @access private |
|
| 282 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | + */ |
|
| 284 | + private $download_your_data_page; |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * The 'WordLift Settings' page. |
|
| 288 | + * |
|
| 289 | + * @since 3.11.0 |
|
| 290 | + * @access protected |
|
| 291 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | + */ |
|
| 293 | + protected $settings_page; |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * The 'WordLift Batch analysis' page. |
|
| 297 | + * |
|
| 298 | + * @since 3.14.0 |
|
| 299 | + * @access protected |
|
| 300 | + * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | + */ |
|
| 302 | + protected $batch_analysis_page; |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * The install wizard page. |
|
| 306 | + * |
|
| 307 | + * @since 3.9.0 |
|
| 308 | + * @access private |
|
| 309 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | + */ |
|
| 311 | + private $admin_setup; |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | + * linking of entities to their pages. |
|
| 316 | + * |
|
| 317 | + * @since 3.8.0 |
|
| 318 | + * @access private |
|
| 319 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | + */ |
|
| 321 | + private $content_filter_service; |
|
| 322 | + |
|
| 323 | + /** |
|
| 324 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | + * |
|
| 326 | + * @since 3.9.0 |
|
| 327 | + * @access private |
|
| 328 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | + */ |
|
| 330 | + private $key_validation_service; |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | + * |
|
| 335 | + * @since 3.10.0 |
|
| 336 | + * @access private |
|
| 337 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | + */ |
|
| 339 | + private $rating_service; |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | + * |
|
| 344 | + * @since 3.10.0 |
|
| 345 | + * @access protected |
|
| 346 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | + */ |
|
| 348 | + protected $post_to_jsonld_converter; |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | + * |
|
| 353 | + * @since 3.10.0 |
|
| 354 | + * @access protected |
|
| 355 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | + */ |
|
| 357 | + protected $configuration_service; |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * A {@link Wordlift_Install_Service} instance. |
|
| 361 | + * |
|
| 362 | + * @since 3.18.0 |
|
| 363 | + * @access protected |
|
| 364 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | + */ |
|
| 366 | + protected $install_service; |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | + * |
|
| 371 | + * @since 3.10.0 |
|
| 372 | + * @access protected |
|
| 373 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | + */ |
|
| 375 | + protected $entity_type_service; |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | + * |
|
| 380 | + * @since 3.10.0 |
|
| 381 | + * @access protected |
|
| 382 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | + */ |
|
| 384 | + protected $entity_post_to_jsonld_converter; |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | + * |
|
| 389 | + * @since 3.10.0 |
|
| 390 | + * @access protected |
|
| 391 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | + */ |
|
| 393 | + protected $postid_to_jsonld_converter; |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | + * |
|
| 398 | + * @since 3.9.8 |
|
| 399 | + * @access private |
|
| 400 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | + */ |
|
| 402 | + private $status_page; |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | + * |
|
| 407 | + * @since 3.11.0 |
|
| 408 | + * @access protected |
|
| 409 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | + */ |
|
| 411 | + protected $category_taxonomy_service; |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | + * |
|
| 416 | + * @since 3.11.0 |
|
| 417 | + * @access protected |
|
| 418 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | + */ |
|
| 420 | + protected $entity_page_service; |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | + * |
|
| 425 | + * @since 3.11.0 |
|
| 426 | + * @access protected |
|
| 427 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | + */ |
|
| 429 | + protected $settings_page_action_link; |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 433 | + * |
|
| 434 | + * @since 3.11.0 |
|
| 435 | + * @access protected |
|
| 436 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | + */ |
|
| 438 | + protected $analytics_settings_page_action_link; |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | + * |
|
| 443 | + * @since 3.11.0 |
|
| 444 | + * @access protected |
|
| 445 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | + */ |
|
| 447 | + protected $analytics_connect; |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | + * |
|
| 452 | + * @since 3.11.0 |
|
| 453 | + * @access protected |
|
| 454 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | + */ |
|
| 456 | + protected $publisher_ajax_adapter; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | + * |
|
| 461 | + * @since 3.11.0 |
|
| 462 | + * @access protected |
|
| 463 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | + */ |
|
| 465 | + protected $input_element; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | + * |
|
| 470 | + * @since 3.13.0 |
|
| 471 | + * @access protected |
|
| 472 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | + */ |
|
| 474 | + protected $radio_input_element; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | + * |
|
| 479 | + * @since 3.11.0 |
|
| 480 | + * @access protected |
|
| 481 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | + */ |
|
| 483 | + protected $language_select_element; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | + * |
|
| 488 | + * @since 3.18.0 |
|
| 489 | + * @access protected |
|
| 490 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | + */ |
|
| 492 | + protected $country_select_element; |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | + * |
|
| 497 | + * @since 3.11.0 |
|
| 498 | + * @access protected |
|
| 499 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | + */ |
|
| 501 | + protected $publisher_element; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | + * |
|
| 506 | + * @since 3.11.0 |
|
| 507 | + * @access protected |
|
| 508 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | + */ |
|
| 510 | + protected $select2_element; |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * The controller for the entity type list admin page |
|
| 514 | + * |
|
| 515 | + * @since 3.11.0 |
|
| 516 | + * @access private |
|
| 517 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | + */ |
|
| 519 | + private $entity_type_admin_page; |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * The controller for the entity type settings admin page |
|
| 523 | + * |
|
| 524 | + * @since 3.11.0 |
|
| 525 | + * @access private |
|
| 526 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | + */ |
|
| 528 | + private $entity_type_settings_admin_page; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | + * |
|
| 533 | + * @since 3.11.0 |
|
| 534 | + * @access protected |
|
| 535 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | + */ |
|
| 537 | + protected $related_entities_cloud_widget; |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | + * |
|
| 542 | + * @since 3.14.0 |
|
| 543 | + * @access protected |
|
| 544 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | + */ |
|
| 546 | + protected $author_element; |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | + * |
|
| 551 | + * @since 3.14.0 |
|
| 552 | + * @access protected |
|
| 553 | + * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | + */ |
|
| 555 | + protected $batch_analysis_service; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | + * |
|
| 560 | + * @since 3.12.0 |
|
| 561 | + * @access protected |
|
| 562 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | + */ |
|
| 564 | + protected $sample_data_service; |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | + * |
|
| 569 | + * @since 3.12.0 |
|
| 570 | + * @access protected |
|
| 571 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | + */ |
|
| 573 | + protected $sample_data_ajax_adapter; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.14.2 |
|
| 579 | + * @access protected |
|
| 580 | + * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | + */ |
|
| 582 | + private $batch_analysis_adapter; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.14.3 |
|
| 588 | + * @access private |
|
| 589 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | + */ |
|
| 591 | + private $relation_rebuild_service; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | + * |
|
| 596 | + * @since 3.14.3 |
|
| 597 | + * @access private |
|
| 598 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | + */ |
|
| 600 | + private $relation_rebuild_adapter; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | + * |
|
| 605 | + * @since 3.18.0 |
|
| 606 | + * @access private |
|
| 607 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | + */ |
|
| 609 | + private $reference_rebuild_service; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | + * |
|
| 614 | + * @since 3.16.0 |
|
| 615 | + * @access protected |
|
| 616 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | + */ |
|
| 618 | + protected $google_analytics_export_service; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * {@link Wordlift}'s singleton instance. |
|
| 622 | + * |
|
| 623 | + * @since 3.15.0 |
|
| 624 | + * @access protected |
|
| 625 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | + */ |
|
| 627 | + protected $entity_type_adapter; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | + * |
|
| 632 | + * @since 3.15.0 |
|
| 633 | + * @access protected |
|
| 634 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | + */ |
|
| 636 | + protected $linked_data_service; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | + * |
|
| 641 | + * @since 3.15.0 |
|
| 642 | + * @access protected |
|
| 643 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | + */ |
|
| 645 | + protected $storage_factory; |
|
| 646 | + |
|
| 647 | + /** |
|
| 648 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | + * |
|
| 650 | + * @since 3.15.0 |
|
| 651 | + * @access protected |
|
| 652 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | + */ |
|
| 654 | + protected $rendition_factory; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | + * |
|
| 659 | + * @since 3.15.0 |
|
| 660 | + * @access private |
|
| 661 | + * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | + */ |
|
| 663 | + private $autocomplete_service; |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | + * |
|
| 668 | + * @since 3.15.0 |
|
| 669 | + * @access private |
|
| 670 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | + */ |
|
| 672 | + private $autocomplete_adapter; |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | + * |
|
| 677 | + * @since 3.15.0 |
|
| 678 | + * @access protected |
|
| 679 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | + */ |
|
| 681 | + protected $relation_service; |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | + * |
|
| 686 | + * @since 3.16.0 |
|
| 687 | + * @access protected |
|
| 688 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | + * |
|
| 690 | + */ |
|
| 691 | + protected $cached_postid_to_jsonld_converter; |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | + * |
|
| 696 | + * @since 3.16.0 |
|
| 697 | + * @access protected |
|
| 698 | + * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | + */ |
|
| 700 | + protected $file_cache_service; |
|
| 701 | + |
|
| 702 | + /** |
|
| 703 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | + * |
|
| 705 | + * @since 3.16.3 |
|
| 706 | + * @access protected |
|
| 707 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | + */ |
|
| 709 | + protected $entity_uri_service; |
|
| 710 | + |
|
| 711 | + /** |
|
| 712 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | + * |
|
| 714 | + * @since 3.19.0 |
|
| 715 | + * @access protected |
|
| 716 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | + */ |
|
| 718 | + protected $publisher_service; |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * {@link Wordlift}'s singleton instance. |
|
| 722 | + * |
|
| 723 | + * @since 3.11.2 |
|
| 724 | + * @access private |
|
| 725 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | + */ |
|
| 727 | + private static $instance; |
|
| 728 | + |
|
| 729 | + //</editor-fold> |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Define the core functionality of the plugin. |
|
| 733 | + * |
|
| 734 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | + * the public-facing side of the site. |
|
| 737 | + * |
|
| 738 | + * @since 1.0.0 |
|
| 739 | + */ |
|
| 740 | + public function __construct() { |
|
| 741 | + |
|
| 742 | + self::$instance = $this; |
|
| 743 | + |
|
| 744 | + $this->plugin_name = 'wordlift'; |
|
| 745 | + $this->version = '3.21.0'; |
|
| 746 | + $this->load_dependencies(); |
|
| 747 | + $this->set_locale(); |
|
| 748 | + $this->define_admin_hooks(); |
|
| 749 | + $this->define_public_hooks(); |
|
| 750 | + |
|
| 751 | + // If we're in `WP_CLI` load the related files. |
|
| 752 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | + $this->load_cli_dependencies(); |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + /** |
|
| 759 | + * Get the singleton instance. |
|
| 760 | + * |
|
| 761 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 762 | + * @since 3.11.2 |
|
| 763 | + * |
|
| 764 | + */ |
|
| 765 | + public static function get_instance() { |
|
| 766 | + |
|
| 767 | + return self::$instance; |
|
| 768 | + } |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * Load the required dependencies for this plugin. |
|
| 772 | + * |
|
| 773 | + * Include the following files that make up the plugin: |
|
| 774 | + * |
|
| 775 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | + * |
|
| 780 | + * Create an instance of the loader which will be used to register the hooks |
|
| 781 | + * with WordPress. |
|
| 782 | + * |
|
| 783 | + * @since 1.0.0 |
|
| 784 | + * @access private |
|
| 785 | + */ |
|
| 786 | + private function load_dependencies() { |
|
| 787 | + |
|
| 788 | + /** |
|
| 789 | + * The class responsible for orchestrating the actions and filters of the |
|
| 790 | + * core plugin. |
|
| 791 | + */ |
|
| 792 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | + |
|
| 794 | + // The class responsible for plugin uninstall. |
|
| 795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * The class responsible for defining internationalization functionality |
|
| 799 | + * of the plugin. |
|
| 800 | + */ |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * WordLift's supported languages. |
|
| 805 | + */ |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * WordLift's supported countries. |
|
| 810 | + */ |
|
| 811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * Provide support functions to sanitize data. |
|
| 815 | + */ |
|
| 816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | + |
|
| 818 | + /** Services. */ |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * The Query builder. |
|
| 832 | + */ |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | + |
|
| 835 | + /** |
|
| 836 | + * The Schema service. |
|
| 837 | + */ |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | + |
|
| 840 | + /** |
|
| 841 | + * The schema:url property service. |
|
| 842 | + */ |
|
| 843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The UI service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * The Thumbnail service. |
|
| 853 | + */ |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | + |
|
| 856 | + /** |
|
| 857 | + * The Entity Types Taxonomy service. |
|
| 858 | + */ |
|
| 859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | + |
|
| 861 | + /** |
|
| 862 | + * The Entity service. |
|
| 863 | + */ |
|
| 864 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | + |
|
| 867 | + // Add the entity rating service. |
|
| 868 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | + |
|
| 870 | + /** |
|
| 871 | + * The User service. |
|
| 872 | + */ |
|
| 873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * The Timeline service. |
|
| 877 | + */ |
|
| 878 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | + |
|
| 880 | + /** |
|
| 881 | + * The Topic Taxonomy service. |
|
| 882 | + */ |
|
| 883 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | + |
|
| 885 | + /** |
|
| 886 | + * The SPARQL service. |
|
| 887 | + */ |
|
| 888 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * The WordLift import service. |
|
| 892 | + */ |
|
| 893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | + |
|
| 895 | + /** |
|
| 896 | + * The WordLift URI service. |
|
| 897 | + */ |
|
| 898 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | + |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | + |
|
| 914 | + /** |
|
| 915 | + * Load the converters. |
|
| 916 | + */ |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | + |
|
| 924 | + /** |
|
| 925 | + * Load cache-related files. |
|
| 926 | + */ |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | + |
|
| 929 | + /** |
|
| 930 | + * Load the content filter. |
|
| 931 | + */ |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | + |
|
| 934 | + /* |
|
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | - |
|
| 939 | - /** |
|
| 940 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | - * |
|
| 942 | - * @since 3.8.0 |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | - |
|
| 946 | - // The Publisher Service and the AJAX adapter. |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | - |
|
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * Load the WordLift key validation service. |
|
| 954 | - */ |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | - |
|
| 957 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | - |
|
| 960 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | - |
|
| 965 | - /** Linked Data. */ |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | - |
|
| 978 | - /** Linked Data Rendition. */ |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | - |
|
| 984 | - /** Services. */ |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | - |
|
| 989 | - /** Adapters. */ |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | - |
|
| 997 | - /** Async Tasks. */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | - |
|
| 1004 | - /** Autocomplete. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | - |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | - |
|
| 1010 | - /** Analytics */ |
|
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | - |
|
| 1013 | - /** |
|
| 1014 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | - */ |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * The class to customize the entity list admin page. |
|
| 1020 | - */ |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | - |
|
| 1023 | - /** |
|
| 1024 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | - */ |
|
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | - |
|
| 1028 | - /** |
|
| 1029 | - * The Notice service. |
|
| 1030 | - */ |
|
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | - |
|
| 1033 | - /** |
|
| 1034 | - * The PrimaShop adapter. |
|
| 1035 | - */ |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | - |
|
| 1038 | - /** |
|
| 1039 | - * The WordLift Dashboard service. |
|
| 1040 | - */ |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | - |
|
| 1043 | - /** |
|
| 1044 | - * The admin 'Install wizard' page. |
|
| 1045 | - */ |
|
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | - |
|
| 1048 | - /** |
|
| 1049 | - * The WordLift entity type list admin page controller. |
|
| 1050 | - */ |
|
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | - |
|
| 1053 | - /** |
|
| 1054 | - * The WordLift entity type settings admin page controller. |
|
| 1055 | - */ |
|
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * The admin 'Download Your Data' page. |
|
| 1060 | - */ |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | - |
|
| 1063 | - /** |
|
| 1064 | - * The admin 'WordLift Settings' page. |
|
| 1065 | - */ |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | - |
|
| 1083 | - /** Admin Pages */ |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | - |
|
| 1089 | - /** |
|
| 1090 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1091 | - * side of the site. |
|
| 1092 | - */ |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | - |
|
| 1095 | - /** |
|
| 1096 | - * The shortcode abstract class. |
|
| 1097 | - */ |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | - |
|
| 1100 | - /** |
|
| 1101 | - * The Timeline shortcode. |
|
| 1102 | - */ |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | - |
|
| 1105 | - /** |
|
| 1106 | - * The Navigator shortcode. |
|
| 1107 | - */ |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * The chord shortcode. |
|
| 1112 | - */ |
|
| 1113 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | - |
|
| 1115 | - /** |
|
| 1116 | - * The geomap shortcode. |
|
| 1117 | - */ |
|
| 1118 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | - |
|
| 1120 | - /** |
|
| 1121 | - * The entity cloud shortcode. |
|
| 1122 | - */ |
|
| 1123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | - |
|
| 1125 | - /** |
|
| 1126 | - * The entity glossary shortcode. |
|
| 1127 | - */ |
|
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | - |
|
| 1131 | - /** |
|
| 1132 | - * Faceted Search shortcode. |
|
| 1133 | - */ |
|
| 1134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | - |
|
| 1136 | - /** |
|
| 1137 | - * The ShareThis service. |
|
| 1138 | - */ |
|
| 1139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | - |
|
| 1141 | - /** |
|
| 1142 | - * The SEO service. |
|
| 1143 | - */ |
|
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | - |
|
| 1146 | - /** |
|
| 1147 | - * The AMP service. |
|
| 1148 | - */ |
|
| 1149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | - |
|
| 1151 | - /** Widgets */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | - |
|
| 1155 | - /* |
|
| 937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | + |
|
| 939 | + /** |
|
| 940 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | + * |
|
| 942 | + * @since 3.8.0 |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | + |
|
| 946 | + // The Publisher Service and the AJAX adapter. |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | + |
|
| 950 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * Load the WordLift key validation service. |
|
| 954 | + */ |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | + |
|
| 957 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | + |
|
| 960 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | + |
|
| 965 | + /** Linked Data. */ |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | + |
|
| 978 | + /** Linked Data Rendition. */ |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | + |
|
| 984 | + /** Services. */ |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | + |
|
| 989 | + /** Adapters. */ |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | + |
|
| 997 | + /** Async Tasks. */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | + |
|
| 1004 | + /** Autocomplete. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | + |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | + |
|
| 1010 | + /** Analytics */ |
|
| 1011 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | + |
|
| 1013 | + /** |
|
| 1014 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | + */ |
|
| 1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * The class to customize the entity list admin page. |
|
| 1020 | + */ |
|
| 1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | + |
|
| 1023 | + /** |
|
| 1024 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | + */ |
|
| 1026 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | + |
|
| 1028 | + /** |
|
| 1029 | + * The Notice service. |
|
| 1030 | + */ |
|
| 1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * The PrimaShop adapter. |
|
| 1035 | + */ |
|
| 1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | + |
|
| 1038 | + /** |
|
| 1039 | + * The WordLift Dashboard service. |
|
| 1040 | + */ |
|
| 1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | + |
|
| 1043 | + /** |
|
| 1044 | + * The admin 'Install wizard' page. |
|
| 1045 | + */ |
|
| 1046 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | + |
|
| 1048 | + /** |
|
| 1049 | + * The WordLift entity type list admin page controller. |
|
| 1050 | + */ |
|
| 1051 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | + |
|
| 1053 | + /** |
|
| 1054 | + * The WordLift entity type settings admin page controller. |
|
| 1055 | + */ |
|
| 1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * The admin 'Download Your Data' page. |
|
| 1060 | + */ |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | + |
|
| 1063 | + /** |
|
| 1064 | + * The admin 'WordLift Settings' page. |
|
| 1065 | + */ |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | + |
|
| 1083 | + /** Admin Pages */ |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | + |
|
| 1089 | + /** |
|
| 1090 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1091 | + * side of the site. |
|
| 1092 | + */ |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | + |
|
| 1095 | + /** |
|
| 1096 | + * The shortcode abstract class. |
|
| 1097 | + */ |
|
| 1098 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | + |
|
| 1100 | + /** |
|
| 1101 | + * The Timeline shortcode. |
|
| 1102 | + */ |
|
| 1103 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | + |
|
| 1105 | + /** |
|
| 1106 | + * The Navigator shortcode. |
|
| 1107 | + */ |
|
| 1108 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * The chord shortcode. |
|
| 1112 | + */ |
|
| 1113 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | + |
|
| 1115 | + /** |
|
| 1116 | + * The geomap shortcode. |
|
| 1117 | + */ |
|
| 1118 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | + |
|
| 1120 | + /** |
|
| 1121 | + * The entity cloud shortcode. |
|
| 1122 | + */ |
|
| 1123 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | + |
|
| 1125 | + /** |
|
| 1126 | + * The entity glossary shortcode. |
|
| 1127 | + */ |
|
| 1128 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | + |
|
| 1131 | + /** |
|
| 1132 | + * Faceted Search shortcode. |
|
| 1133 | + */ |
|
| 1134 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | + |
|
| 1136 | + /** |
|
| 1137 | + * The ShareThis service. |
|
| 1138 | + */ |
|
| 1139 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | + |
|
| 1141 | + /** |
|
| 1142 | + * The SEO service. |
|
| 1143 | + */ |
|
| 1144 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | + |
|
| 1146 | + /** |
|
| 1147 | + * The AMP service. |
|
| 1148 | + */ |
|
| 1149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | + |
|
| 1151 | + /** Widgets */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | + |
|
| 1155 | + /* |
|
| 1156 | 1156 | * Schema.org Services. |
| 1157 | 1157 | * |
| 1158 | 1158 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1159 | 1159 | */ |
| 1160 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1161 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1164 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1165 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1166 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1167 | - } else { |
|
| 1168 | - $schemaorg_property_service = null; |
|
| 1169 | - } |
|
| 1160 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1161 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1164 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1165 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1166 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1167 | + } else { |
|
| 1168 | + $schemaorg_property_service = null; |
|
| 1169 | + } |
|
| 1170 | 1170 | |
| 1171 | - $this->loader = new Wordlift_Loader(); |
|
| 1171 | + $this->loader = new Wordlift_Loader(); |
|
| 1172 | 1172 | |
| 1173 | - // Instantiate a global logger. |
|
| 1174 | - global $wl_logger; |
|
| 1175 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1173 | + // Instantiate a global logger. |
|
| 1174 | + global $wl_logger; |
|
| 1175 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1176 | 1176 | |
| 1177 | - // Load the `wl-api` end-point. |
|
| 1178 | - new Wordlift_Http_Api(); |
|
| 1177 | + // Load the `wl-api` end-point. |
|
| 1178 | + new Wordlift_Http_Api(); |
|
| 1179 | 1179 | |
| 1180 | - // Load the Install Service. |
|
| 1181 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1180 | + // Load the Install Service. |
|
| 1181 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1182 | 1182 | |
| 1183 | - /** Services. */ |
|
| 1184 | - // Create the configuration service. |
|
| 1185 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1186 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1183 | + /** Services. */ |
|
| 1184 | + // Create the configuration service. |
|
| 1185 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1186 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1187 | 1187 | |
| 1188 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1189 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1188 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1189 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1190 | 1190 | |
| 1191 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1192 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1191 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1192 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1193 | 1193 | |
| 1194 | - // Create an instance of the UI service. |
|
| 1195 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1194 | + // Create an instance of the UI service. |
|
| 1195 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1196 | 1196 | |
| 1197 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1198 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1197 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1198 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1199 | 1199 | |
| 1200 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1201 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1202 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1203 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1200 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1201 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1202 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1203 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1204 | 1204 | |
| 1205 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1206 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1207 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1208 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1209 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1205 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1206 | + $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1207 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1208 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1209 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1210 | 1210 | |
| 1211 | - // Instantiate the JSON-LD service. |
|
| 1212 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1211 | + // Instantiate the JSON-LD service. |
|
| 1212 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1213 | 1213 | |
| 1214 | - /** Linked Data. */ |
|
| 1215 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1216 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1214 | + /** Linked Data. */ |
|
| 1215 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1216 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1217 | 1217 | |
| 1218 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1218 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1219 | 1219 | |
| 1220 | - // Create a new instance of the Redirect service. |
|
| 1221 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1222 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1223 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1220 | + // Create a new instance of the Redirect service. |
|
| 1221 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1222 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1223 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1224 | 1224 | |
| 1225 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1226 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1225 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1226 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1227 | 1227 | |
| 1228 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1228 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1229 | 1229 | |
| 1230 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1230 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1231 | 1231 | |
| 1232 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1233 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1232 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1233 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1234 | 1234 | |
| 1235 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1236 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1235 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1236 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1237 | 1237 | |
| 1238 | - // Create an instance of the PrimaShop adapter. |
|
| 1239 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1238 | + // Create an instance of the PrimaShop adapter. |
|
| 1239 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1240 | 1240 | |
| 1241 | - // Create an import service instance to hook later to WP's import function. |
|
| 1242 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1241 | + // Create an import service instance to hook later to WP's import function. |
|
| 1242 | + $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1243 | 1243 | |
| 1244 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1244 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1245 | 1245 | |
| 1246 | - // Create the entity rating service. |
|
| 1247 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1246 | + // Create the entity rating service. |
|
| 1247 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1248 | 1248 | |
| 1249 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1250 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1249 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1250 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1251 | 1251 | |
| 1252 | - // Create a new instance of the Redirect service. |
|
| 1253 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1252 | + // Create a new instance of the Redirect service. |
|
| 1253 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1254 | 1254 | |
| 1255 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1256 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1257 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1258 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1255 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1256 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1257 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1258 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1259 | 1259 | |
| 1260 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1260 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1261 | 1261 | |
| 1262 | - // Instantiate the JSON-LD service. |
|
| 1263 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1264 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1265 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1266 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1267 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1268 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1269 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1262 | + // Instantiate the JSON-LD service. |
|
| 1263 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1264 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1265 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1266 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1267 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1268 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1269 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1270 | 1270 | |
| 1271 | 1271 | |
| 1272 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1273 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1274 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1275 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1276 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1277 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1272 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1273 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1274 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1275 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1276 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1277 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1278 | 1278 | |
| 1279 | - // Initialize the shortcodes. |
|
| 1280 | - new Wordlift_Navigator_Shortcode(); |
|
| 1281 | - new Wordlift_Chord_Shortcode(); |
|
| 1282 | - new Wordlift_Geomap_Shortcode(); |
|
| 1283 | - new Wordlift_Timeline_Shortcode(); |
|
| 1284 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1285 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1286 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1279 | + // Initialize the shortcodes. |
|
| 1280 | + new Wordlift_Navigator_Shortcode(); |
|
| 1281 | + new Wordlift_Chord_Shortcode(); |
|
| 1282 | + new Wordlift_Geomap_Shortcode(); |
|
| 1283 | + new Wordlift_Timeline_Shortcode(); |
|
| 1284 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1285 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1286 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1287 | 1287 | |
| 1288 | - // Initialize the SEO service. |
|
| 1289 | - new Wordlift_Seo_Service(); |
|
| 1288 | + // Initialize the SEO service. |
|
| 1289 | + new Wordlift_Seo_Service(); |
|
| 1290 | 1290 | |
| 1291 | - // Initialize the AMP service. |
|
| 1292 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1291 | + // Initialize the AMP service. |
|
| 1292 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1293 | 1293 | |
| 1294 | - /** Services. */ |
|
| 1295 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1296 | - new Wordlift_Image_Service(); |
|
| 1294 | + /** Services. */ |
|
| 1295 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1296 | + new Wordlift_Image_Service(); |
|
| 1297 | 1297 | |
| 1298 | - /** Adapters. */ |
|
| 1299 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1300 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1301 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1302 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1303 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1298 | + /** Adapters. */ |
|
| 1299 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1300 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1301 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1302 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1303 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1304 | 1304 | |
| 1305 | - /* |
|
| 1305 | + /* |
|
| 1306 | 1306 | * Exclude our public js from WP-Rocket. |
| 1307 | 1307 | * |
| 1308 | 1308 | * @since 3.19.4 |
| 1309 | 1309 | * |
| 1310 | 1310 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1311 | 1311 | */ |
| 1312 | - new Wordlift_WpRocket_Adapter(); |
|
| 1313 | - |
|
| 1314 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1315 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1316 | - $this->sparql_service, |
|
| 1317 | - $uri_service |
|
| 1318 | - ); |
|
| 1319 | - |
|
| 1320 | - /** Async Tasks. */ |
|
| 1321 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1322 | - new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1323 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1324 | - new Wordlift_Push_References_Async_Task(); |
|
| 1325 | - |
|
| 1326 | - /** WL Autocomplete. */ |
|
| 1327 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1328 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1329 | - |
|
| 1330 | - /** WordPress Admin UI. */ |
|
| 1331 | - |
|
| 1332 | - // UI elements. |
|
| 1333 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1334 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1335 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1336 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1337 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1338 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1339 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1340 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1341 | - |
|
| 1342 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1343 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1344 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1345 | - |
|
| 1346 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1347 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1348 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1349 | - |
|
| 1350 | - // Pages. |
|
| 1351 | - /* |
|
| 1312 | + new Wordlift_WpRocket_Adapter(); |
|
| 1313 | + |
|
| 1314 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1315 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1316 | + $this->sparql_service, |
|
| 1317 | + $uri_service |
|
| 1318 | + ); |
|
| 1319 | + |
|
| 1320 | + /** Async Tasks. */ |
|
| 1321 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1322 | + new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1323 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1324 | + new Wordlift_Push_References_Async_Task(); |
|
| 1325 | + |
|
| 1326 | + /** WL Autocomplete. */ |
|
| 1327 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1328 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1329 | + |
|
| 1330 | + /** WordPress Admin UI. */ |
|
| 1331 | + |
|
| 1332 | + // UI elements. |
|
| 1333 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1334 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1335 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1336 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1337 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1338 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1339 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1340 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1341 | + |
|
| 1342 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1343 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1344 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1345 | + |
|
| 1346 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1347 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1348 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1349 | + |
|
| 1350 | + // Pages. |
|
| 1351 | + /* |
|
| 1352 | 1352 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1353 | 1353 | * |
| 1354 | 1354 | * @since 3.20.3 |
| 1355 | 1355 | * |
| 1356 | 1356 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1357 | 1357 | */ |
| 1358 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1359 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1361 | - } |
|
| 1362 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1358 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1359 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1361 | + } |
|
| 1362 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1363 | 1363 | |
| 1364 | - // create an instance of the entity type list admin page controller. |
|
| 1365 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1364 | + // create an instance of the entity type list admin page controller. |
|
| 1365 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1366 | 1366 | |
| 1367 | - // create an instance of the entity type setting admin page controller. |
|
| 1368 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1367 | + // create an instance of the entity type setting admin page controller. |
|
| 1368 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1369 | 1369 | |
| 1370 | - /** Widgets */ |
|
| 1371 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1370 | + /** Widgets */ |
|
| 1371 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1372 | 1372 | |
| 1373 | - /* WordPress Admin. */ |
|
| 1374 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1375 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1373 | + /* WordPress Admin. */ |
|
| 1374 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1375 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1376 | 1376 | |
| 1377 | - // Create an instance of the install wizard. |
|
| 1378 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1377 | + // Create an instance of the install wizard. |
|
| 1378 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1379 | 1379 | |
| 1380 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1380 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1381 | 1381 | |
| 1382 | - // User Profile. |
|
| 1383 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1382 | + // User Profile. |
|
| 1383 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1384 | 1384 | |
| 1385 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1385 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1386 | 1386 | |
| 1387 | - // Load the debug service if WP is in debug mode. |
|
| 1388 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1389 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1390 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1391 | - } |
|
| 1387 | + // Load the debug service if WP is in debug mode. |
|
| 1388 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1389 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1390 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1391 | + } |
|
| 1392 | 1392 | |
| 1393 | - // Remote Image Service. |
|
| 1394 | - new Wordlift_Remote_Image_Service(); |
|
| 1393 | + // Remote Image Service. |
|
| 1394 | + new Wordlift_Remote_Image_Service(); |
|
| 1395 | 1395 | |
| 1396 | - /* |
|
| 1396 | + /* |
|
| 1397 | 1397 | * Provides mappings between post types and entity types. |
| 1398 | 1398 | * |
| 1399 | 1399 | * @since 3.20.0 |
| 1400 | 1400 | * |
| 1401 | 1401 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1402 | 1402 | */ |
| 1403 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1403 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1404 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1406 | 1406 | |
| 1407 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1408 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1407 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1408 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1409 | 1409 | |
| 1410 | - /* |
|
| 1410 | + /* |
|
| 1411 | 1411 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1412 | 1412 | * |
| 1413 | 1413 | * Eventually Batch Actions will become Batch Operations. |
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 3.20.0 |
| 1416 | 1416 | */ |
| 1417 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1417 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1419 | 1419 | |
| 1420 | - /* |
|
| 1420 | + /* |
|
| 1421 | 1421 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1422 | 1422 | * |
| 1423 | 1423 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1424 | 1424 | * |
| 1425 | 1425 | * @since 3.20.0 |
| 1426 | 1426 | */ |
| 1427 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1427 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1429 | 1429 | |
| 1430 | - /* |
|
| 1430 | + /* |
|
| 1431 | 1431 | * Load dependencies for the front-end. |
| 1432 | 1432 | * |
| 1433 | 1433 | * @since 3.20.0 |
| 1434 | 1434 | */ |
| 1435 | - if ( ! is_admin() ) { |
|
| 1436 | - /* |
|
| 1435 | + if ( ! is_admin() ) { |
|
| 1436 | + /* |
|
| 1437 | 1437 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1438 | 1438 | * |
| 1439 | 1439 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1440 | 1440 | * |
| 1441 | 1441 | * @since 3.20.0 |
| 1442 | 1442 | */ |
| 1443 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1445 | - } |
|
| 1446 | - |
|
| 1447 | - } |
|
| 1448 | - |
|
| 1449 | - /** |
|
| 1450 | - * Define the locale for this plugin for internationalization. |
|
| 1451 | - * |
|
| 1452 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1453 | - * with WordPress. |
|
| 1454 | - * |
|
| 1455 | - * @since 1.0.0 |
|
| 1456 | - * @access private |
|
| 1457 | - */ |
|
| 1458 | - private function set_locale() { |
|
| 1459 | - |
|
| 1460 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1461 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1462 | - |
|
| 1463 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1464 | - |
|
| 1465 | - } |
|
| 1466 | - |
|
| 1467 | - /** |
|
| 1468 | - * Register all of the hooks related to the admin area functionality |
|
| 1469 | - * of the plugin. |
|
| 1470 | - * |
|
| 1471 | - * @since 1.0.0 |
|
| 1472 | - * @access private |
|
| 1473 | - */ |
|
| 1474 | - private function define_admin_hooks() { |
|
| 1475 | - |
|
| 1476 | - $plugin_admin = new Wordlift_Admin( |
|
| 1477 | - $this->get_plugin_name(), |
|
| 1478 | - $this->get_version(), |
|
| 1479 | - $this->configuration_service, |
|
| 1480 | - $this->notice_service, |
|
| 1481 | - $this->user_service |
|
| 1482 | - ); |
|
| 1483 | - |
|
| 1484 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1486 | - |
|
| 1487 | - // Hook the init action to taxonomy services. |
|
| 1488 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1489 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1490 | - |
|
| 1491 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1492 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1493 | - |
|
| 1494 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1495 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1496 | - |
|
| 1497 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1498 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1499 | - |
|
| 1500 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1501 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1502 | - |
|
| 1503 | - // Register custom allowed redirect hosts. |
|
| 1504 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1505 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1506 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1507 | - |
|
| 1508 | - /* |
|
| 1443 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | + new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1445 | + } |
|
| 1446 | + |
|
| 1447 | + } |
|
| 1448 | + |
|
| 1449 | + /** |
|
| 1450 | + * Define the locale for this plugin for internationalization. |
|
| 1451 | + * |
|
| 1452 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1453 | + * with WordPress. |
|
| 1454 | + * |
|
| 1455 | + * @since 1.0.0 |
|
| 1456 | + * @access private |
|
| 1457 | + */ |
|
| 1458 | + private function set_locale() { |
|
| 1459 | + |
|
| 1460 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1461 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1462 | + |
|
| 1463 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1464 | + |
|
| 1465 | + } |
|
| 1466 | + |
|
| 1467 | + /** |
|
| 1468 | + * Register all of the hooks related to the admin area functionality |
|
| 1469 | + * of the plugin. |
|
| 1470 | + * |
|
| 1471 | + * @since 1.0.0 |
|
| 1472 | + * @access private |
|
| 1473 | + */ |
|
| 1474 | + private function define_admin_hooks() { |
|
| 1475 | + |
|
| 1476 | + $plugin_admin = new Wordlift_Admin( |
|
| 1477 | + $this->get_plugin_name(), |
|
| 1478 | + $this->get_version(), |
|
| 1479 | + $this->configuration_service, |
|
| 1480 | + $this->notice_service, |
|
| 1481 | + $this->user_service |
|
| 1482 | + ); |
|
| 1483 | + |
|
| 1484 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1486 | + |
|
| 1487 | + // Hook the init action to taxonomy services. |
|
| 1488 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1489 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1490 | + |
|
| 1491 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1492 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1493 | + |
|
| 1494 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1495 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1496 | + |
|
| 1497 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1498 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1499 | + |
|
| 1500 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1501 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1502 | + |
|
| 1503 | + // Register custom allowed redirect hosts. |
|
| 1504 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1505 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1506 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1507 | + |
|
| 1508 | + /* |
|
| 1509 | 1509 | * The old dashboard is replaced with dashboard v2. |
| 1510 | 1510 | * |
| 1511 | 1511 | * The old dashboard service is still loaded because its functions are used. |
@@ -1514,292 +1514,292 @@ discard block |
||
| 1514 | 1514 | * |
| 1515 | 1515 | * @since 3.20.0 |
| 1516 | 1516 | */ |
| 1517 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1518 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1519 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1520 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1521 | - |
|
| 1522 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1523 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1524 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1525 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1526 | - |
|
| 1527 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1528 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1529 | - |
|
| 1530 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1531 | - // Add custom columns. |
|
| 1532 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1533 | - // no explicit entity as it prevents handling of other post types. |
|
| 1534 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1535 | - // Add 4W selection. |
|
| 1536 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1537 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1538 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1539 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1540 | - |
|
| 1541 | - /* |
|
| 1517 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1518 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1519 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1520 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1521 | + |
|
| 1522 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1523 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1524 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1525 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1526 | + |
|
| 1527 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1528 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1529 | + |
|
| 1530 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1531 | + // Add custom columns. |
|
| 1532 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1533 | + // no explicit entity as it prevents handling of other post types. |
|
| 1534 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1535 | + // Add 4W selection. |
|
| 1536 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1537 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1538 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1539 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1540 | + |
|
| 1541 | + /* |
|
| 1542 | 1542 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1543 | 1543 | * |
| 1544 | 1544 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1545 | 1545 | */ |
| 1546 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1547 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1548 | - } |
|
| 1546 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1547 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1548 | + } |
|
| 1549 | 1549 | |
| 1550 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1551 | - // entities. |
|
| 1552 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1550 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1551 | + // entities. |
|
| 1552 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1553 | 1553 | |
| 1554 | - // Filter imported post meta. |
|
| 1555 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1554 | + // Filter imported post meta. |
|
| 1555 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1556 | 1556 | |
| 1557 | - // Notify the import service when an import starts and ends. |
|
| 1558 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1559 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1557 | + // Notify the import service when an import starts and ends. |
|
| 1558 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1559 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1560 | 1560 | |
| 1561 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1562 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1563 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1561 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1562 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1563 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1564 | 1564 | |
| 1565 | - // Hook the menu to the Download Your Data page. |
|
| 1566 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1567 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1568 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1565 | + // Hook the menu to the Download Your Data page. |
|
| 1566 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1567 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1568 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1569 | 1569 | |
| 1570 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1571 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1570 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1571 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1572 | 1572 | |
| 1573 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1574 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1575 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1576 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1573 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1574 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1575 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1576 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1577 | 1577 | |
| 1578 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1579 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1578 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1579 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1580 | 1580 | |
| 1581 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1582 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1581 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1582 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1583 | 1583 | |
| 1584 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1585 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1584 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1585 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1586 | 1586 | |
| 1587 | - // Hook the admin_init to the settings page. |
|
| 1588 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1589 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1587 | + // Hook the admin_init to the settings page. |
|
| 1588 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1589 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1590 | 1590 | |
| 1591 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1591 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1592 | 1592 | |
| 1593 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1594 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1595 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1596 | - // Add the functionality only if a flag is set in wp-config.php . |
|
| 1597 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1598 | - } |
|
| 1593 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1594 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1595 | + if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1596 | + // Add the functionality only if a flag is set in wp-config.php . |
|
| 1597 | + $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1598 | + } |
|
| 1599 | 1599 | |
| 1600 | - /* |
|
| 1600 | + /* |
|
| 1601 | 1601 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1602 | 1602 | * |
| 1603 | 1603 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1604 | 1604 | * |
| 1605 | 1605 | * @since 3.20.0 |
| 1606 | 1606 | */ |
| 1607 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1608 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1609 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1610 | - } |
|
| 1611 | - |
|
| 1612 | - // Hook key update. |
|
| 1613 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1614 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1615 | - |
|
| 1616 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1617 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1618 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1619 | - |
|
| 1620 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1621 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1622 | - |
|
| 1623 | - // Hook row actions for the entity type list admin. |
|
| 1624 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1625 | - |
|
| 1626 | - /** Ajax actions. */ |
|
| 1627 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1628 | - |
|
| 1629 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1630 | - // page on WordPress versions before 4.7. |
|
| 1631 | - global $wp_version; |
|
| 1632 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1633 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1634 | - } |
|
| 1635 | - |
|
| 1636 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1637 | - |
|
| 1638 | - /** Adapters. */ |
|
| 1639 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1640 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1641 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1642 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1643 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1644 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1645 | - |
|
| 1646 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1647 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1648 | - |
|
| 1649 | - |
|
| 1650 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1651 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1652 | - |
|
| 1653 | - // Handle the autocomplete request. |
|
| 1654 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1655 | - $this->autocomplete_adapter, |
|
| 1656 | - 'wl_autocomplete', |
|
| 1657 | - ) ); |
|
| 1658 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1659 | - $this->autocomplete_adapter, |
|
| 1660 | - 'wl_autocomplete', |
|
| 1661 | - ) ); |
|
| 1662 | - |
|
| 1663 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1664 | - if ( is_multisite() ) { |
|
| 1665 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1666 | - } |
|
| 1667 | - |
|
| 1668 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1669 | - |
|
| 1670 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1671 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1672 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1673 | - } |
|
| 1674 | - |
|
| 1675 | - /** |
|
| 1676 | - * Register all of the hooks related to the public-facing functionality |
|
| 1677 | - * of the plugin. |
|
| 1678 | - * |
|
| 1679 | - * @since 1.0.0 |
|
| 1680 | - * @access private |
|
| 1681 | - */ |
|
| 1682 | - private function define_public_hooks() { |
|
| 1683 | - |
|
| 1684 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1685 | - |
|
| 1686 | - // Register the entity post type. |
|
| 1687 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1688 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1689 | - |
|
| 1690 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1691 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1692 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1693 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1694 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1695 | - |
|
| 1696 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1697 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1698 | - |
|
| 1699 | - // Hook the content filter service to add entity links. |
|
| 1700 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1701 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1702 | - } |
|
| 1703 | - |
|
| 1704 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1705 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1706 | - |
|
| 1707 | - // Hook the ShareThis service. |
|
| 1708 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1709 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1710 | - |
|
| 1711 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1712 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1713 | - |
|
| 1714 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1715 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1716 | - // to categories. |
|
| 1717 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1718 | - |
|
| 1719 | - /* |
|
| 1607 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1608 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1609 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1610 | + } |
|
| 1611 | + |
|
| 1612 | + // Hook key update. |
|
| 1613 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1614 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1615 | + |
|
| 1616 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1617 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1618 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1619 | + |
|
| 1620 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1621 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1622 | + |
|
| 1623 | + // Hook row actions for the entity type list admin. |
|
| 1624 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1625 | + |
|
| 1626 | + /** Ajax actions. */ |
|
| 1627 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1628 | + |
|
| 1629 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1630 | + // page on WordPress versions before 4.7. |
|
| 1631 | + global $wp_version; |
|
| 1632 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1633 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1634 | + } |
|
| 1635 | + |
|
| 1636 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1637 | + |
|
| 1638 | + /** Adapters. */ |
|
| 1639 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1640 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1641 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1642 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1643 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1644 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1645 | + |
|
| 1646 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1647 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1648 | + |
|
| 1649 | + |
|
| 1650 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1651 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1652 | + |
|
| 1653 | + // Handle the autocomplete request. |
|
| 1654 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1655 | + $this->autocomplete_adapter, |
|
| 1656 | + 'wl_autocomplete', |
|
| 1657 | + ) ); |
|
| 1658 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1659 | + $this->autocomplete_adapter, |
|
| 1660 | + 'wl_autocomplete', |
|
| 1661 | + ) ); |
|
| 1662 | + |
|
| 1663 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1664 | + if ( is_multisite() ) { |
|
| 1665 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1666 | + } |
|
| 1667 | + |
|
| 1668 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1669 | + |
|
| 1670 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1671 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1672 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1673 | + } |
|
| 1674 | + |
|
| 1675 | + /** |
|
| 1676 | + * Register all of the hooks related to the public-facing functionality |
|
| 1677 | + * of the plugin. |
|
| 1678 | + * |
|
| 1679 | + * @since 1.0.0 |
|
| 1680 | + * @access private |
|
| 1681 | + */ |
|
| 1682 | + private function define_public_hooks() { |
|
| 1683 | + |
|
| 1684 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1685 | + |
|
| 1686 | + // Register the entity post type. |
|
| 1687 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1688 | + $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1689 | + |
|
| 1690 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1691 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1692 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1693 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1694 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1695 | + |
|
| 1696 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1697 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1698 | + |
|
| 1699 | + // Hook the content filter service to add entity links. |
|
| 1700 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1701 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1702 | + } |
|
| 1703 | + |
|
| 1704 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1705 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1706 | + |
|
| 1707 | + // Hook the ShareThis service. |
|
| 1708 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1709 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1710 | + |
|
| 1711 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1712 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1713 | + |
|
| 1714 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1715 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1716 | + // to categories. |
|
| 1717 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1718 | + |
|
| 1719 | + /* |
|
| 1720 | 1720 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1721 | 1721 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1722 | 1722 | * order of start time. |
| 1723 | 1723 | */ |
| 1724 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1725 | - |
|
| 1726 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1727 | - |
|
| 1728 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1729 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1730 | - |
|
| 1731 | - // Analytics Script Frontend. |
|
| 1732 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1733 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1734 | - } |
|
| 1735 | - |
|
| 1736 | - } |
|
| 1737 | - |
|
| 1738 | - /** |
|
| 1739 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1740 | - * |
|
| 1741 | - * @since 1.0.0 |
|
| 1742 | - */ |
|
| 1743 | - public function run() { |
|
| 1744 | - $this->loader->run(); |
|
| 1745 | - } |
|
| 1746 | - |
|
| 1747 | - /** |
|
| 1748 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1749 | - * WordPress and to define internationalization functionality. |
|
| 1750 | - * |
|
| 1751 | - * @return string The name of the plugin. |
|
| 1752 | - * @since 1.0.0 |
|
| 1753 | - */ |
|
| 1754 | - public function get_plugin_name() { |
|
| 1755 | - return $this->plugin_name; |
|
| 1756 | - } |
|
| 1757 | - |
|
| 1758 | - /** |
|
| 1759 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1760 | - * |
|
| 1761 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1762 | - * @since 1.0.0 |
|
| 1763 | - */ |
|
| 1764 | - public function get_loader() { |
|
| 1765 | - return $this->loader; |
|
| 1766 | - } |
|
| 1767 | - |
|
| 1768 | - /** |
|
| 1769 | - * Retrieve the version number of the plugin. |
|
| 1770 | - * |
|
| 1771 | - * @return string The version number of the plugin. |
|
| 1772 | - * @since 1.0.0 |
|
| 1773 | - */ |
|
| 1774 | - public function get_version() { |
|
| 1775 | - return $this->version; |
|
| 1776 | - } |
|
| 1777 | - |
|
| 1778 | - /** |
|
| 1779 | - * Load dependencies for WP-CLI. |
|
| 1780 | - * |
|
| 1781 | - * @throws Exception |
|
| 1782 | - * @since 3.18.0 |
|
| 1783 | - */ |
|
| 1784 | - private function load_cli_dependencies() { |
|
| 1785 | - |
|
| 1786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1787 | - |
|
| 1788 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1789 | - |
|
| 1790 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1791 | - |
|
| 1792 | - } |
|
| 1793 | - |
|
| 1794 | - /** |
|
| 1795 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1796 | - * |
|
| 1797 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1798 | - * @since 3.20.0 |
|
| 1799 | - */ |
|
| 1800 | - public function get_dashboard_service() { |
|
| 1801 | - |
|
| 1802 | - return $this->dashboard_service; |
|
| 1803 | - } |
|
| 1724 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1725 | + |
|
| 1726 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1727 | + |
|
| 1728 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1729 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1730 | + |
|
| 1731 | + // Analytics Script Frontend. |
|
| 1732 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1733 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1734 | + } |
|
| 1735 | + |
|
| 1736 | + } |
|
| 1737 | + |
|
| 1738 | + /** |
|
| 1739 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1740 | + * |
|
| 1741 | + * @since 1.0.0 |
|
| 1742 | + */ |
|
| 1743 | + public function run() { |
|
| 1744 | + $this->loader->run(); |
|
| 1745 | + } |
|
| 1746 | + |
|
| 1747 | + /** |
|
| 1748 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1749 | + * WordPress and to define internationalization functionality. |
|
| 1750 | + * |
|
| 1751 | + * @return string The name of the plugin. |
|
| 1752 | + * @since 1.0.0 |
|
| 1753 | + */ |
|
| 1754 | + public function get_plugin_name() { |
|
| 1755 | + return $this->plugin_name; |
|
| 1756 | + } |
|
| 1757 | + |
|
| 1758 | + /** |
|
| 1759 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1760 | + * |
|
| 1761 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1762 | + * @since 1.0.0 |
|
| 1763 | + */ |
|
| 1764 | + public function get_loader() { |
|
| 1765 | + return $this->loader; |
|
| 1766 | + } |
|
| 1767 | + |
|
| 1768 | + /** |
|
| 1769 | + * Retrieve the version number of the plugin. |
|
| 1770 | + * |
|
| 1771 | + * @return string The version number of the plugin. |
|
| 1772 | + * @since 1.0.0 |
|
| 1773 | + */ |
|
| 1774 | + public function get_version() { |
|
| 1775 | + return $this->version; |
|
| 1776 | + } |
|
| 1777 | + |
|
| 1778 | + /** |
|
| 1779 | + * Load dependencies for WP-CLI. |
|
| 1780 | + * |
|
| 1781 | + * @throws Exception |
|
| 1782 | + * @since 3.18.0 |
|
| 1783 | + */ |
|
| 1784 | + private function load_cli_dependencies() { |
|
| 1785 | + |
|
| 1786 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1787 | + |
|
| 1788 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1789 | + |
|
| 1790 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1791 | + |
|
| 1792 | + } |
|
| 1793 | + |
|
| 1794 | + /** |
|
| 1795 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1796 | + * |
|
| 1797 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1798 | + * @since 3.20.0 |
|
| 1799 | + */ |
|
| 1800 | + public function get_dashboard_service() { |
|
| 1801 | + |
|
| 1802 | + return $this->dashboard_service; |
|
| 1803 | + } |
|
| 1804 | 1804 | |
| 1805 | 1805 | } |
@@ -18,85 +18,85 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Admin_Post_Edit_Page { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The {@link Wordlift} plugin instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.11.0 |
|
| 25 | - * |
|
| 26 | - * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 27 | - */ |
|
| 28 | - private $plugin; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * A {@link Wordlift_Log_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.15.4 |
|
| 34 | - * |
|
| 35 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private $log; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Create the {@link Wordlift_Admin_Post_Edit_Page} instance. |
|
| 41 | - * |
|
| 42 | - * @since 3.11.0 |
|
| 43 | - * |
|
| 44 | - * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 45 | - */ |
|
| 46 | - function __construct( $plugin ) { |
|
| 47 | - |
|
| 48 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 49 | - |
|
| 50 | - // Bail out if we're in the UX Builder editor. |
|
| 51 | - if ( $this->is_ux_builder_editor() ) { |
|
| 52 | - $this->log->info( 'WordLift will not show, since we are in UX Builder editor.' ); |
|
| 53 | - |
|
| 54 | - return; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - // Define the callbacks. |
|
| 58 | - $callback = array( $this, 'enqueue_scripts', ); |
|
| 59 | - $callback_gutenberg = array( $this, 'enqueue_scripts_gutenberg', ); |
|
| 60 | - $callback_block_categories = array($this, 'block_categories'); |
|
| 61 | - |
|
| 62 | - // Set a hook to enqueue scripts only when the edit page is displayed. |
|
| 63 | - add_action( 'admin_print_scripts-post.php', $callback ); |
|
| 64 | - add_action( 'admin_print_scripts-post-new.php', $callback ); |
|
| 65 | - add_action( 'enqueue_block_editor_assets', $callback_gutenberg ); |
|
| 66 | - |
|
| 67 | - $this->plugin = $plugin; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Check if we're in UX builder. |
|
| 72 | - * |
|
| 73 | - * @see https://github.com/insideout10/wordlift-plugin/issues/691 |
|
| 74 | - * |
|
| 75 | - * @since 3.15.4 |
|
| 76 | - * |
|
| 77 | - * @return bool True if we're in UX builder, otherwise false. |
|
| 78 | - */ |
|
| 79 | - private function is_ux_builder_editor() { |
|
| 80 | - |
|
| 81 | - return function_exists( 'ux_builder_is_editor' ) |
|
| 82 | - && ux_builder_is_editor(); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Enqueue scripts and styles for the edit page. |
|
| 87 | - * |
|
| 88 | - * @since 3.11.0 |
|
| 89 | - */ |
|
| 90 | - public function enqueue_scripts() { |
|
| 91 | - |
|
| 92 | - // Dequeue potentially conflicting ontrapages angular scripts which any *are not* used on the edit screen. |
|
| 93 | - // |
|
| 94 | - // @see https://github.com/insideout10/wordlift-plugin/issues/832 |
|
| 95 | - wp_dequeue_script( 'ontrapagesAngular' ); |
|
| 96 | - wp_dequeue_script( 'ontrapagesApp' ); |
|
| 97 | - wp_dequeue_script( 'ontrapagesController' ); |
|
| 98 | - |
|
| 99 | - /* |
|
| 21 | + /** |
|
| 22 | + * The {@link Wordlift} plugin instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.11.0 |
|
| 25 | + * |
|
| 26 | + * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 27 | + */ |
|
| 28 | + private $plugin; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * A {@link Wordlift_Log_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.15.4 |
|
| 34 | + * |
|
| 35 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private $log; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Create the {@link Wordlift_Admin_Post_Edit_Page} instance. |
|
| 41 | + * |
|
| 42 | + * @since 3.11.0 |
|
| 43 | + * |
|
| 44 | + * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 45 | + */ |
|
| 46 | + function __construct( $plugin ) { |
|
| 47 | + |
|
| 48 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 49 | + |
|
| 50 | + // Bail out if we're in the UX Builder editor. |
|
| 51 | + if ( $this->is_ux_builder_editor() ) { |
|
| 52 | + $this->log->info( 'WordLift will not show, since we are in UX Builder editor.' ); |
|
| 53 | + |
|
| 54 | + return; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + // Define the callbacks. |
|
| 58 | + $callback = array( $this, 'enqueue_scripts', ); |
|
| 59 | + $callback_gutenberg = array( $this, 'enqueue_scripts_gutenberg', ); |
|
| 60 | + $callback_block_categories = array($this, 'block_categories'); |
|
| 61 | + |
|
| 62 | + // Set a hook to enqueue scripts only when the edit page is displayed. |
|
| 63 | + add_action( 'admin_print_scripts-post.php', $callback ); |
|
| 64 | + add_action( 'admin_print_scripts-post-new.php', $callback ); |
|
| 65 | + add_action( 'enqueue_block_editor_assets', $callback_gutenberg ); |
|
| 66 | + |
|
| 67 | + $this->plugin = $plugin; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Check if we're in UX builder. |
|
| 72 | + * |
|
| 73 | + * @see https://github.com/insideout10/wordlift-plugin/issues/691 |
|
| 74 | + * |
|
| 75 | + * @since 3.15.4 |
|
| 76 | + * |
|
| 77 | + * @return bool True if we're in UX builder, otherwise false. |
|
| 78 | + */ |
|
| 79 | + private function is_ux_builder_editor() { |
|
| 80 | + |
|
| 81 | + return function_exists( 'ux_builder_is_editor' ) |
|
| 82 | + && ux_builder_is_editor(); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Enqueue scripts and styles for the edit page. |
|
| 87 | + * |
|
| 88 | + * @since 3.11.0 |
|
| 89 | + */ |
|
| 90 | + public function enqueue_scripts() { |
|
| 91 | + |
|
| 92 | + // Dequeue potentially conflicting ontrapages angular scripts which any *are not* used on the edit screen. |
|
| 93 | + // |
|
| 94 | + // @see https://github.com/insideout10/wordlift-plugin/issues/832 |
|
| 95 | + wp_dequeue_script( 'ontrapagesAngular' ); |
|
| 96 | + wp_dequeue_script( 'ontrapagesApp' ); |
|
| 97 | + wp_dequeue_script( 'ontrapagesController' ); |
|
| 98 | + |
|
| 99 | + /* |
|
| 100 | 100 | * Enqueue the edit screen JavaScript. The `wordlift-admin.bundle.js` file |
| 101 | 101 | * is scheduled to replace the older `wordlift-admin.min.js` once client-side |
| 102 | 102 | * code is properly refactored. |
@@ -105,61 +105,61 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @since 3.20.0 edit.js has been migrated to the new webpack configuration. |
| 107 | 107 | */ |
| 108 | - // plugin_dir_url( __FILE__ ) . 'js/1/edit.js' |
|
| 109 | - $script_name = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/edit'; |
|
| 110 | - wp_enqueue_script( |
|
| 111 | - 'wordlift-admin-edit-page', "$script_name.js", |
|
| 112 | - array( |
|
| 113 | - $this->plugin->get_plugin_name(), |
|
| 114 | - 'jquery', |
|
| 115 | - // Require wp.ajax. |
|
| 116 | - 'wp-util', |
|
| 117 | - /* |
|
| 108 | + // plugin_dir_url( __FILE__ ) . 'js/1/edit.js' |
|
| 109 | + $script_name = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/edit'; |
|
| 110 | + wp_enqueue_script( |
|
| 111 | + 'wordlift-admin-edit-page', "$script_name.js", |
|
| 112 | + array( |
|
| 113 | + $this->plugin->get_plugin_name(), |
|
| 114 | + 'jquery', |
|
| 115 | + // Require wp.ajax. |
|
| 116 | + 'wp-util', |
|
| 117 | + /* |
|
| 118 | 118 | * Angular isn't loaded anymore remotely, but it is loaded within wordlift-reloaded.js. |
| 119 | 119 | * |
| 120 | 120 | * See https://github.com/insideout10/wordlift-plugin/issues/865. |
| 121 | 121 | * |
| 122 | 122 | * @since 3.19.6 |
| 123 | 123 | */ |
| 124 | - // // Require Angular. |
|
| 125 | - // 'wl-angular', |
|
| 126 | - // 'wl-angular-geolocation', |
|
| 127 | - // 'wl-angular-touch', |
|
| 128 | - // 'wl-angular-animate', |
|
| 129 | - ), |
|
| 130 | - $this->plugin->get_version(), |
|
| 131 | - false |
|
| 132 | - ); |
|
| 133 | - wp_enqueue_style( 'wordlift-admin-edit-page', "$script_name.css", array(), $this->plugin->get_version() ); |
|
| 134 | - |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * Enqueue scripts and styles for the gutenberg edit page. |
|
| 139 | - * |
|
| 140 | - * @since 3.21.0 |
|
| 141 | - */ |
|
| 142 | - public function enqueue_scripts_gutenberg() { |
|
| 143 | - wp_enqueue_script( |
|
| 144 | - 'wordlift-admin-edit-gutenberg', |
|
| 145 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg.js', |
|
| 146 | - array( |
|
| 147 | - $this->plugin->get_plugin_name(), |
|
| 148 | - 'jquery', |
|
| 149 | - 'wp-blocks', |
|
| 150 | - 'wp-util', |
|
| 151 | - 'wp-element', |
|
| 152 | - 'wp-components', |
|
| 153 | - 'wp-compose', |
|
| 154 | - 'wp-edit-post', |
|
| 155 | - 'wp-plugins', |
|
| 156 | - 'wp-data', |
|
| 157 | - 'wp-annotations' |
|
| 158 | - ), |
|
| 159 | - $this->plugin->get_version(), |
|
| 160 | - false |
|
| 161 | - ); |
|
| 162 | - wp_enqueue_style( 'style-gutenberg', plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg.css', false ); |
|
| 163 | - } |
|
| 124 | + // // Require Angular. |
|
| 125 | + // 'wl-angular', |
|
| 126 | + // 'wl-angular-geolocation', |
|
| 127 | + // 'wl-angular-touch', |
|
| 128 | + // 'wl-angular-animate', |
|
| 129 | + ), |
|
| 130 | + $this->plugin->get_version(), |
|
| 131 | + false |
|
| 132 | + ); |
|
| 133 | + wp_enqueue_style( 'wordlift-admin-edit-page', "$script_name.css", array(), $this->plugin->get_version() ); |
|
| 134 | + |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * Enqueue scripts and styles for the gutenberg edit page. |
|
| 139 | + * |
|
| 140 | + * @since 3.21.0 |
|
| 141 | + */ |
|
| 142 | + public function enqueue_scripts_gutenberg() { |
|
| 143 | + wp_enqueue_script( |
|
| 144 | + 'wordlift-admin-edit-gutenberg', |
|
| 145 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg.js', |
|
| 146 | + array( |
|
| 147 | + $this->plugin->get_plugin_name(), |
|
| 148 | + 'jquery', |
|
| 149 | + 'wp-blocks', |
|
| 150 | + 'wp-util', |
|
| 151 | + 'wp-element', |
|
| 152 | + 'wp-components', |
|
| 153 | + 'wp-compose', |
|
| 154 | + 'wp-edit-post', |
|
| 155 | + 'wp-plugins', |
|
| 156 | + 'wp-data', |
|
| 157 | + 'wp-annotations' |
|
| 158 | + ), |
|
| 159 | + $this->plugin->get_version(), |
|
| 160 | + false |
|
| 161 | + ); |
|
| 162 | + wp_enqueue_style( 'style-gutenberg', plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg.css', false ); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | 165 | } |
@@ -43,26 +43,26 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
| 45 | 45 | */ |
| 46 | - function __construct( $plugin ) { |
|
| 46 | + function __construct($plugin) { |
|
| 47 | 47 | |
| 48 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 48 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 49 | 49 | |
| 50 | 50 | // Bail out if we're in the UX Builder editor. |
| 51 | - if ( $this->is_ux_builder_editor() ) { |
|
| 52 | - $this->log->info( 'WordLift will not show, since we are in UX Builder editor.' ); |
|
| 51 | + if ($this->is_ux_builder_editor()) { |
|
| 52 | + $this->log->info('WordLift will not show, since we are in UX Builder editor.'); |
|
| 53 | 53 | |
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Define the callbacks. |
| 58 | - $callback = array( $this, 'enqueue_scripts', ); |
|
| 59 | - $callback_gutenberg = array( $this, 'enqueue_scripts_gutenberg', ); |
|
| 58 | + $callback = array($this, 'enqueue_scripts',); |
|
| 59 | + $callback_gutenberg = array($this, 'enqueue_scripts_gutenberg',); |
|
| 60 | 60 | $callback_block_categories = array($this, 'block_categories'); |
| 61 | 61 | |
| 62 | 62 | // Set a hook to enqueue scripts only when the edit page is displayed. |
| 63 | - add_action( 'admin_print_scripts-post.php', $callback ); |
|
| 64 | - add_action( 'admin_print_scripts-post-new.php', $callback ); |
|
| 65 | - add_action( 'enqueue_block_editor_assets', $callback_gutenberg ); |
|
| 63 | + add_action('admin_print_scripts-post.php', $callback); |
|
| 64 | + add_action('admin_print_scripts-post-new.php', $callback); |
|
| 65 | + add_action('enqueue_block_editor_assets', $callback_gutenberg); |
|
| 66 | 66 | |
| 67 | 67 | $this->plugin = $plugin; |
| 68 | 68 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | private function is_ux_builder_editor() { |
| 80 | 80 | |
| 81 | - return function_exists( 'ux_builder_is_editor' ) |
|
| 81 | + return function_exists('ux_builder_is_editor') |
|
| 82 | 82 | && ux_builder_is_editor(); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | // Dequeue potentially conflicting ontrapages angular scripts which any *are not* used on the edit screen. |
| 93 | 93 | // |
| 94 | 94 | // @see https://github.com/insideout10/wordlift-plugin/issues/832 |
| 95 | - wp_dequeue_script( 'ontrapagesAngular' ); |
|
| 96 | - wp_dequeue_script( 'ontrapagesApp' ); |
|
| 97 | - wp_dequeue_script( 'ontrapagesController' ); |
|
| 95 | + wp_dequeue_script('ontrapagesAngular'); |
|
| 96 | + wp_dequeue_script('ontrapagesApp'); |
|
| 97 | + wp_dequeue_script('ontrapagesController'); |
|
| 98 | 98 | |
| 99 | 99 | /* |
| 100 | 100 | * Enqueue the edit screen JavaScript. The `wordlift-admin.bundle.js` file |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @since 3.20.0 edit.js has been migrated to the new webpack configuration. |
| 107 | 107 | */ |
| 108 | 108 | // plugin_dir_url( __FILE__ ) . 'js/1/edit.js' |
| 109 | - $script_name = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/edit'; |
|
| 109 | + $script_name = plugin_dir_url(dirname(__FILE__)).'js/dist/edit'; |
|
| 110 | 110 | wp_enqueue_script( |
| 111 | 111 | 'wordlift-admin-edit-page', "$script_name.js", |
| 112 | 112 | array( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->plugin->get_version(), |
| 131 | 131 | false |
| 132 | 132 | ); |
| 133 | - wp_enqueue_style( 'wordlift-admin-edit-page', "$script_name.css", array(), $this->plugin->get_version() ); |
|
| 133 | + wp_enqueue_style('wordlift-admin-edit-page', "$script_name.css", array(), $this->plugin->get_version()); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public function enqueue_scripts_gutenberg() { |
| 143 | 143 | wp_enqueue_script( |
| 144 | 144 | 'wordlift-admin-edit-gutenberg', |
| 145 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg.js', |
|
| 145 | + plugin_dir_url(dirname(__FILE__)).'js/dist/gutenberg.js', |
|
| 146 | 146 | array( |
| 147 | 147 | $this->plugin->get_plugin_name(), |
| 148 | 148 | 'jquery', |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $this->plugin->get_version(), |
| 160 | 160 | false |
| 161 | 161 | ); |
| 162 | - wp_enqueue_style( 'style-gutenberg', plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg.css', false ); |
|
| 162 | + wp_enqueue_style('style-gutenberg', plugin_dir_url(dirname(__FILE__)).'js/dist/gutenberg.css', false); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | } |
@@ -22,363 +22,363 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Wordlift_Admin { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The ID of this plugin. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var string $plugin_name The ID of this plugin. |
|
| 31 | - */ |
|
| 32 | - private $plugin_name; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * The version of this plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access private |
|
| 39 | - * @var string $version The current version of this plugin. |
|
| 40 | - */ |
|
| 41 | - private $version; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * The {@link Wordlift_Configuration_Service} instance. |
|
| 45 | - * |
|
| 46 | - * @since 3.14.0 |
|
| 47 | - * @access private |
|
| 48 | - * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 49 | - */ |
|
| 50 | - private $configuration_service; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * The {@link Wordlift_User_Service} instance. |
|
| 54 | - * |
|
| 55 | - * @since 3.14.0 |
|
| 56 | - * @access private |
|
| 57 | - * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 58 | - */ |
|
| 59 | - private $user_service; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 63 | - * |
|
| 64 | - * @since 3.20.0 |
|
| 65 | - * @access private |
|
| 66 | - * @var \Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 67 | - */ |
|
| 68 | - private $sync_batch_operation_ajax_adapter; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The singleton instance. |
|
| 72 | - * |
|
| 73 | - * @since 3.19.4 |
|
| 74 | - * @access private |
|
| 75 | - * @var Wordlift_Admin $instance The singleton instance. |
|
| 76 | - */ |
|
| 77 | - private static $instance; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Initialize the class and set its properties. |
|
| 81 | - * |
|
| 82 | - * @since 1.0.0 |
|
| 83 | - * |
|
| 84 | - * @param string $plugin_name The name of this plugin. |
|
| 85 | - * @param string $version The version of this plugin. |
|
| 86 | - * @param \Wordlift_Configuration_Service $configuration_service The configuration service. |
|
| 87 | - * @param \Wordlift_Notice_Service $notice_service The notice service. |
|
| 88 | - * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 89 | - */ |
|
| 90 | - public function __construct( $plugin_name, $version, $configuration_service, $notice_service, $user_service ) { |
|
| 91 | - |
|
| 92 | - $this->plugin_name = $plugin_name; |
|
| 93 | - $this->version = $version; |
|
| 94 | - |
|
| 95 | - $this->configuration_service = $configuration_service; |
|
| 96 | - $this->user_service = $user_service; |
|
| 97 | - |
|
| 98 | - $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 99 | - $key = $configuration_service->get_key(); |
|
| 100 | - |
|
| 101 | - if ( empty( $dataset_uri ) ) { |
|
| 102 | - $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 103 | - if ( empty( $key ) ) { |
|
| 104 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 105 | - } else { |
|
| 106 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 107 | - } |
|
| 108 | - $notice_service->add_error( $error ); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // Load additional code if we're in the admin UI. |
|
| 112 | - if ( is_admin() ) { |
|
| 113 | - |
|
| 114 | - // Require the PHP files for the next code fragment. |
|
| 115 | - self::require_files(); |
|
| 116 | - |
|
| 117 | - // Add Wordlift custom block category. |
|
| 118 | - self::add_block_category(); |
|
| 119 | - |
|
| 120 | - new Wordlift_Dashboard_Latest_News(); |
|
| 121 | - |
|
| 122 | - // Search Rankings. |
|
| 123 | - $search_rankings_service = new Wordlift_Admin_Search_Rankings_Service( Wordlift_Api_Service::get_instance() ); |
|
| 124 | - new Wordlift_Admin_Search_Rankings_Ajax_Adapter( $search_rankings_service ); |
|
| 125 | - |
|
| 126 | - /* |
|
| 25 | + /** |
|
| 26 | + * The ID of this plugin. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var string $plugin_name The ID of this plugin. |
|
| 31 | + */ |
|
| 32 | + private $plugin_name; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * The version of this plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access private |
|
| 39 | + * @var string $version The current version of this plugin. |
|
| 40 | + */ |
|
| 41 | + private $version; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * The {@link Wordlift_Configuration_Service} instance. |
|
| 45 | + * |
|
| 46 | + * @since 3.14.0 |
|
| 47 | + * @access private |
|
| 48 | + * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 49 | + */ |
|
| 50 | + private $configuration_service; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * The {@link Wordlift_User_Service} instance. |
|
| 54 | + * |
|
| 55 | + * @since 3.14.0 |
|
| 56 | + * @access private |
|
| 57 | + * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 58 | + */ |
|
| 59 | + private $user_service; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 63 | + * |
|
| 64 | + * @since 3.20.0 |
|
| 65 | + * @access private |
|
| 66 | + * @var \Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 67 | + */ |
|
| 68 | + private $sync_batch_operation_ajax_adapter; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The singleton instance. |
|
| 72 | + * |
|
| 73 | + * @since 3.19.4 |
|
| 74 | + * @access private |
|
| 75 | + * @var Wordlift_Admin $instance The singleton instance. |
|
| 76 | + */ |
|
| 77 | + private static $instance; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Initialize the class and set its properties. |
|
| 81 | + * |
|
| 82 | + * @since 1.0.0 |
|
| 83 | + * |
|
| 84 | + * @param string $plugin_name The name of this plugin. |
|
| 85 | + * @param string $version The version of this plugin. |
|
| 86 | + * @param \Wordlift_Configuration_Service $configuration_service The configuration service. |
|
| 87 | + * @param \Wordlift_Notice_Service $notice_service The notice service. |
|
| 88 | + * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 89 | + */ |
|
| 90 | + public function __construct( $plugin_name, $version, $configuration_service, $notice_service, $user_service ) { |
|
| 91 | + |
|
| 92 | + $this->plugin_name = $plugin_name; |
|
| 93 | + $this->version = $version; |
|
| 94 | + |
|
| 95 | + $this->configuration_service = $configuration_service; |
|
| 96 | + $this->user_service = $user_service; |
|
| 97 | + |
|
| 98 | + $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 99 | + $key = $configuration_service->get_key(); |
|
| 100 | + |
|
| 101 | + if ( empty( $dataset_uri ) ) { |
|
| 102 | + $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 103 | + if ( empty( $key ) ) { |
|
| 104 | + $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 105 | + } else { |
|
| 106 | + $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 107 | + } |
|
| 108 | + $notice_service->add_error( $error ); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + // Load additional code if we're in the admin UI. |
|
| 112 | + if ( is_admin() ) { |
|
| 113 | + |
|
| 114 | + // Require the PHP files for the next code fragment. |
|
| 115 | + self::require_files(); |
|
| 116 | + |
|
| 117 | + // Add Wordlift custom block category. |
|
| 118 | + self::add_block_category(); |
|
| 119 | + |
|
| 120 | + new Wordlift_Dashboard_Latest_News(); |
|
| 121 | + |
|
| 122 | + // Search Rankings. |
|
| 123 | + $search_rankings_service = new Wordlift_Admin_Search_Rankings_Service( Wordlift_Api_Service::get_instance() ); |
|
| 124 | + new Wordlift_Admin_Search_Rankings_Ajax_Adapter( $search_rankings_service ); |
|
| 125 | + |
|
| 126 | + /* |
|
| 127 | 127 | * Add support for `All Entity Types`. |
| 128 | 128 | * |
| 129 | 129 | * @since 3.20.0 |
| 130 | 130 | * |
| 131 | 131 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 132 | 132 | */ |
| 133 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 133 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 134 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 135 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 136 | 136 | |
| 137 | - // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() ); |
|
| 138 | - /* |
|
| 137 | + // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() ); |
|
| 138 | + /* |
|
| 139 | 139 | * The `Mappings` admin page. |
| 140 | 140 | */ |
| 141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
| 142 | - new Wordlift_Admin_Mappings_Page(); |
|
| 141 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
| 142 | + new Wordlift_Admin_Mappings_Page(); |
|
| 143 | 143 | |
| 144 | - /* |
|
| 144 | + /* |
|
| 145 | 145 | * Allow sync'ing the schema.org taxonomy with the schema.org json file. |
| 146 | 146 | * |
| 147 | 147 | * @since 3.20.0 |
| 148 | 148 | */ |
| 149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 150 | 150 | |
| 151 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
| 151 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
| 152 | 152 | |
| 153 | - } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /* |
|
| 155 | + /* |
|
| 156 | 156 | * Add the {@link Wordlift_Admin_Term_Adapter}. |
| 157 | 157 | * |
| 158 | 158 | * @since 3.20.0 |
| 159 | 159 | */ |
| 160 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
| 161 | - new Wordlift_Admin_Term_Adapter(); |
|
| 160 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
| 161 | + new Wordlift_Admin_Term_Adapter(); |
|
| 162 | 162 | |
| 163 | - /* |
|
| 163 | + /* |
|
| 164 | 164 | * The new dashboard. |
| 165 | 165 | * |
| 166 | 166 | * @since 3.20.0 |
| 167 | 167 | * |
| 168 | 168 | * @see https://github.com/insideout10/wordlift-plugin/issues/879 |
| 169 | 169 | */ |
| 170 | - new Wordlift_Admin_Dashboard_V2( |
|
| 171 | - $search_rankings_service, |
|
| 172 | - Wordlift::get_instance()->get_dashboard_service(), |
|
| 173 | - Wordlift_Entity_Service::get_instance() |
|
| 174 | - ); |
|
| 175 | - new Wordlift_Admin_Not_Enriched_Filter(); |
|
| 176 | - |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - // Set the singleton instance. |
|
| 180 | - self::$instance = $this; |
|
| 181 | - |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * Get the singleton instance. |
|
| 186 | - * |
|
| 187 | - * @since 3.19.4 |
|
| 188 | - * |
|
| 189 | - * @return \Wordlift_Admin The singleton instance. |
|
| 190 | - */ |
|
| 191 | - public static function get_instance() { |
|
| 192 | - |
|
| 193 | - return self::$instance; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Register the stylesheets for the admin area. |
|
| 198 | - * |
|
| 199 | - * @since 1.0.0 |
|
| 200 | - */ |
|
| 201 | - public function enqueue_styles() { |
|
| 202 | - |
|
| 203 | - /** |
|
| 204 | - * This function is provided for demonstration purposes only. |
|
| 205 | - * |
|
| 206 | - * An instance of this class should be passed to the run() function |
|
| 207 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 208 | - * in that particular class. |
|
| 209 | - * |
|
| 210 | - * The Wordlift_Loader will then create the relationship |
|
| 211 | - * between the defined hooks and the functions defined in this |
|
| 212 | - * class. |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 216 | - |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * Register the JavaScript for the admin area. |
|
| 221 | - * |
|
| 222 | - * @since 1.0.0 |
|
| 223 | - */ |
|
| 224 | - public function enqueue_scripts() { |
|
| 225 | - |
|
| 226 | - /* |
|
| 170 | + new Wordlift_Admin_Dashboard_V2( |
|
| 171 | + $search_rankings_service, |
|
| 172 | + Wordlift::get_instance()->get_dashboard_service(), |
|
| 173 | + Wordlift_Entity_Service::get_instance() |
|
| 174 | + ); |
|
| 175 | + new Wordlift_Admin_Not_Enriched_Filter(); |
|
| 176 | + |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + // Set the singleton instance. |
|
| 180 | + self::$instance = $this; |
|
| 181 | + |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * Get the singleton instance. |
|
| 186 | + * |
|
| 187 | + * @since 3.19.4 |
|
| 188 | + * |
|
| 189 | + * @return \Wordlift_Admin The singleton instance. |
|
| 190 | + */ |
|
| 191 | + public static function get_instance() { |
|
| 192 | + |
|
| 193 | + return self::$instance; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Register the stylesheets for the admin area. |
|
| 198 | + * |
|
| 199 | + * @since 1.0.0 |
|
| 200 | + */ |
|
| 201 | + public function enqueue_styles() { |
|
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * This function is provided for demonstration purposes only. |
|
| 205 | + * |
|
| 206 | + * An instance of this class should be passed to the run() function |
|
| 207 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 208 | + * in that particular class. |
|
| 209 | + * |
|
| 210 | + * The Wordlift_Loader will then create the relationship |
|
| 211 | + * between the defined hooks and the functions defined in this |
|
| 212 | + * class. |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 216 | + |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * Register the JavaScript for the admin area. |
|
| 221 | + * |
|
| 222 | + * @since 1.0.0 |
|
| 223 | + */ |
|
| 224 | + public function enqueue_scripts() { |
|
| 225 | + |
|
| 226 | + /* |
|
| 227 | 227 | * Do not load our scripts on the Filter Urls plugin admin pages. |
| 228 | 228 | * |
| 229 | 229 | * @see https://github.com/insideout10/wordlift-plugin/issues/901 |
| 230 | 230 | * @since 3.20.0 |
| 231 | 231 | */ |
| 232 | - $screen = get_current_screen(); |
|
| 233 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
| 234 | - return; |
|
| 235 | - } |
|
| 232 | + $screen = get_current_screen(); |
|
| 233 | + if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
| 234 | + return; |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | - // Enqueue the admin scripts. |
|
| 238 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array( |
|
| 239 | - 'jquery', |
|
| 240 | - 'underscore', |
|
| 241 | - 'backbone', |
|
| 242 | - ), $this->version, false ); |
|
| 237 | + // Enqueue the admin scripts. |
|
| 238 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array( |
|
| 239 | + 'jquery', |
|
| 240 | + 'underscore', |
|
| 241 | + 'backbone', |
|
| 242 | + ), $this->version, false ); |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
| 245 | + $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
| 246 | 246 | |
| 247 | - /* |
|
| 247 | + /* |
|
| 248 | 248 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
| 249 | 249 | * that cannot edit create entities will always see the local entities. |
| 250 | 250 | * |
| 251 | 251 | * @see https://github.com/insideout10/wordlift-plugin/issues/839 |
| 252 | 252 | */ |
| 253 | - $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : "local"; |
|
| 254 | - |
|
| 255 | - // Set the basic params. |
|
| 256 | - $params = array( |
|
| 257 | - // @todo scripts in admin should use wp.post. |
|
| 258 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 259 | - // @todo remove specific actions from settings. |
|
| 260 | - 'action' => 'entity_by_title', |
|
| 261 | - 'datasetUri' => $this->configuration_service->get_dataset_uri(), |
|
| 262 | - 'language' => $this->configuration_service->get_language_code(), |
|
| 263 | - 'link_by_default' => $this->configuration_service->is_link_by_default(), |
|
| 264 | - // Whether the current user is allowed to create new entities. |
|
| 265 | - // |
|
| 266 | - // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
| 267 | - 'can_create_entities' => $can_edit_wordlift_entities ? 'yes' : 'no', |
|
| 268 | - 'l10n' => array( |
|
| 269 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 270 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 271 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 272 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
| 273 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
| 274 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
| 275 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
| 276 | - ), |
|
| 277 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wordlift_autocomplete' ), |
|
| 278 | - 'autocomplete_scope' => $autocomplete_scope, |
|
| 279 | - /** |
|
| 280 | - * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
| 281 | - * or change the TinyMCE id. |
|
| 282 | - * |
|
| 283 | - * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
| 284 | - * |
|
| 285 | - * @since 3.19.4 |
|
| 286 | - * |
|
| 287 | - * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
| 288 | - * |
|
| 289 | - * @param string $editor The default editor id, by default `content`. |
|
| 290 | - */ |
|
| 291 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
| 292 | - /** |
|
| 293 | - * Add the link to the Search Keywords admin page. |
|
| 294 | - * |
|
| 295 | - * @since 3.20.0 |
|
| 296 | - */ |
|
| 297 | - 'search_keywords_admin_page' => admin_url( 'admin.php?page=wl_configuration_admin_menu&tab=search-keywords' ), |
|
| 298 | - ); |
|
| 299 | - |
|
| 300 | - // Set post-related values if there's a current post. |
|
| 301 | - if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 302 | - |
|
| 303 | - $params['post_id'] = $entity_being_edited->ID; |
|
| 304 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 305 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
| 306 | - // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
| 307 | - // from the results, since we don't want the current entity to be discovered by the analysis. |
|
| 308 | - // |
|
| 309 | - // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
| 310 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
| 311 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
| 312 | - |
|
| 313 | - /* |
|
| 253 | + $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : "local"; |
|
| 254 | + |
|
| 255 | + // Set the basic params. |
|
| 256 | + $params = array( |
|
| 257 | + // @todo scripts in admin should use wp.post. |
|
| 258 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 259 | + // @todo remove specific actions from settings. |
|
| 260 | + 'action' => 'entity_by_title', |
|
| 261 | + 'datasetUri' => $this->configuration_service->get_dataset_uri(), |
|
| 262 | + 'language' => $this->configuration_service->get_language_code(), |
|
| 263 | + 'link_by_default' => $this->configuration_service->is_link_by_default(), |
|
| 264 | + // Whether the current user is allowed to create new entities. |
|
| 265 | + // |
|
| 266 | + // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
| 267 | + 'can_create_entities' => $can_edit_wordlift_entities ? 'yes' : 'no', |
|
| 268 | + 'l10n' => array( |
|
| 269 | + 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 270 | + 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 271 | + 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 272 | + 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
| 273 | + 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
| 274 | + 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
| 275 | + 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
| 276 | + ), |
|
| 277 | + 'wl_autocomplete_nonce' => wp_create_nonce( 'wordlift_autocomplete' ), |
|
| 278 | + 'autocomplete_scope' => $autocomplete_scope, |
|
| 279 | + /** |
|
| 280 | + * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
| 281 | + * or change the TinyMCE id. |
|
| 282 | + * |
|
| 283 | + * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
| 284 | + * |
|
| 285 | + * @since 3.19.4 |
|
| 286 | + * |
|
| 287 | + * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
| 288 | + * |
|
| 289 | + * @param string $editor The default editor id, by default `content`. |
|
| 290 | + */ |
|
| 291 | + 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
| 292 | + /** |
|
| 293 | + * Add the link to the Search Keywords admin page. |
|
| 294 | + * |
|
| 295 | + * @since 3.20.0 |
|
| 296 | + */ |
|
| 297 | + 'search_keywords_admin_page' => admin_url( 'admin.php?page=wl_configuration_admin_menu&tab=search-keywords' ), |
|
| 298 | + ); |
|
| 299 | + |
|
| 300 | + // Set post-related values if there's a current post. |
|
| 301 | + if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 302 | + |
|
| 303 | + $params['post_id'] = $entity_being_edited->ID; |
|
| 304 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 305 | + $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
| 306 | + // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
| 307 | + // from the results, since we don't want the current entity to be discovered by the analysis. |
|
| 308 | + // |
|
| 309 | + // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
| 310 | + $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
| 311 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
| 312 | + |
|
| 313 | + /* |
|
| 314 | 314 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
| 315 | 315 | * |
| 316 | 316 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 317 | 317 | */ |
| 318 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 319 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - // Finally output the params as `wlSettings` for JavaScript code. |
|
| 325 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
| 326 | - |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * Require files needed for the Admin UI. |
|
| 331 | - * |
|
| 332 | - * @since 3.20.0 |
|
| 333 | - */ |
|
| 334 | - private static function require_files() { |
|
| 335 | - |
|
| 336 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 337 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-service.php'; |
|
| 338 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-ajax-adapter.php'; |
|
| 339 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 340 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 341 | - |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * Add Wordlift custom block category. |
|
| 346 | - * |
|
| 347 | - * @since 3.21.0 |
|
| 348 | - */ |
|
| 349 | - private static function add_block_category() { |
|
| 350 | - add_filter( 'block_categories', function( $categories, $post ) { |
|
| 351 | - if ( $post->post_type !== 'post' ) { |
|
| 352 | - return $categories; |
|
| 353 | - } |
|
| 354 | - return array_merge( |
|
| 355 | - $categories, |
|
| 356 | - array( |
|
| 357 | - array( |
|
| 358 | - 'slug' => 'wordlift', |
|
| 359 | - 'title' => 'WordLift Blocks', |
|
| 360 | - ), |
|
| 361 | - ) |
|
| 362 | - ); |
|
| 363 | - }, 10, 2 ); |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - public static function is_gutenberg() { |
|
| 367 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
| 368 | - is_gutenberg_page() |
|
| 369 | - ) { |
|
| 370 | - // The Gutenberg plugin is on. |
|
| 371 | - return true; |
|
| 372 | - } |
|
| 373 | - $current_screen = get_current_screen(); |
|
| 374 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
| 375 | - $current_screen->is_block_editor() |
|
| 376 | - ) { |
|
| 377 | - // Gutenberg page on 5+. |
|
| 378 | - return true; |
|
| 379 | - } |
|
| 380 | - |
|
| 381 | - return false; |
|
| 382 | - } |
|
| 318 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 319 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + // Finally output the params as `wlSettings` for JavaScript code. |
|
| 325 | + wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
| 326 | + |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * Require files needed for the Admin UI. |
|
| 331 | + * |
|
| 332 | + * @since 3.20.0 |
|
| 333 | + */ |
|
| 334 | + private static function require_files() { |
|
| 335 | + |
|
| 336 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 337 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-service.php'; |
|
| 338 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-ajax-adapter.php'; |
|
| 339 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 340 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 341 | + |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * Add Wordlift custom block category. |
|
| 346 | + * |
|
| 347 | + * @since 3.21.0 |
|
| 348 | + */ |
|
| 349 | + private static function add_block_category() { |
|
| 350 | + add_filter( 'block_categories', function( $categories, $post ) { |
|
| 351 | + if ( $post->post_type !== 'post' ) { |
|
| 352 | + return $categories; |
|
| 353 | + } |
|
| 354 | + return array_merge( |
|
| 355 | + $categories, |
|
| 356 | + array( |
|
| 357 | + array( |
|
| 358 | + 'slug' => 'wordlift', |
|
| 359 | + 'title' => 'WordLift Blocks', |
|
| 360 | + ), |
|
| 361 | + ) |
|
| 362 | + ); |
|
| 363 | + }, 10, 2 ); |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + public static function is_gutenberg() { |
|
| 367 | + if ( function_exists( 'is_gutenberg_page' ) && |
|
| 368 | + is_gutenberg_page() |
|
| 369 | + ) { |
|
| 370 | + // The Gutenberg plugin is on. |
|
| 371 | + return true; |
|
| 372 | + } |
|
| 373 | + $current_screen = get_current_screen(); |
|
| 374 | + if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
| 375 | + $current_screen->is_block_editor() |
|
| 376 | + ) { |
|
| 377 | + // Gutenberg page on 5+. |
|
| 378 | + return true; |
|
| 379 | + } |
|
| 380 | + |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | 384 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param \Wordlift_Notice_Service $notice_service The notice service. |
| 88 | 88 | * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
| 89 | 89 | */ |
| 90 | - public function __construct( $plugin_name, $version, $configuration_service, $notice_service, $user_service ) { |
|
| 90 | + public function __construct($plugin_name, $version, $configuration_service, $notice_service, $user_service) { |
|
| 91 | 91 | |
| 92 | 92 | $this->plugin_name = $plugin_name; |
| 93 | 93 | $this->version = $version; |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | $dataset_uri = $configuration_service->get_dataset_uri(); |
| 99 | 99 | $key = $configuration_service->get_key(); |
| 100 | 100 | |
| 101 | - if ( empty( $dataset_uri ) ) { |
|
| 101 | + if (empty($dataset_uri)) { |
|
| 102 | 102 | $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
| 103 | - if ( empty( $key ) ) { |
|
| 104 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 103 | + if (empty($key)) { |
|
| 104 | + $error = sprintf(esc_html__("WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
| 105 | 105 | } else { |
| 106 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 106 | + $error = sprintf(esc_html__("WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
| 107 | 107 | } |
| 108 | - $notice_service->add_error( $error ); |
|
| 108 | + $notice_service->add_error($error); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Load additional code if we're in the admin UI. |
| 112 | - if ( is_admin() ) { |
|
| 112 | + if (is_admin()) { |
|
| 113 | 113 | |
| 114 | 114 | // Require the PHP files for the next code fragment. |
| 115 | 115 | self::require_files(); |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | new Wordlift_Dashboard_Latest_News(); |
| 121 | 121 | |
| 122 | 122 | // Search Rankings. |
| 123 | - $search_rankings_service = new Wordlift_Admin_Search_Rankings_Service( Wordlift_Api_Service::get_instance() ); |
|
| 124 | - new Wordlift_Admin_Search_Rankings_Ajax_Adapter( $search_rankings_service ); |
|
| 123 | + $search_rankings_service = new Wordlift_Admin_Search_Rankings_Service(Wordlift_Api_Service::get_instance()); |
|
| 124 | + new Wordlift_Admin_Search_Rankings_Ajax_Adapter($search_rankings_service); |
|
| 125 | 125 | |
| 126 | 126 | /* |
| 127 | 127 | * Add support for `All Entity Types`. |
@@ -130,15 +130,15 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 132 | 132 | */ |
| 133 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 133 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 134 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 135 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 136 | 136 | |
| 137 | 137 | // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() ); |
| 138 | 138 | /* |
| 139 | 139 | * The `Mappings` admin page. |
| 140 | 140 | */ |
| 141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
| 141 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-mappings-page.php'; |
|
| 142 | 142 | new Wordlift_Admin_Mappings_Page(); |
| 143 | 143 | |
| 144 | 144 | /* |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @since 3.20.0 |
| 148 | 148 | */ |
| 149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 149 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 150 | 150 | |
| 151 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
| 151 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter(new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync'); |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @since 3.20.0 |
| 159 | 159 | */ |
| 160 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
| 160 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-term-adapter.php'; |
|
| 161 | 161 | new Wordlift_Admin_Term_Adapter(); |
| 162 | 162 | |
| 163 | 163 | /* |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * class. |
| 213 | 213 | */ |
| 214 | 214 | |
| 215 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 215 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all'); |
|
| 216 | 216 | |
| 217 | 217 | } |
| 218 | 218 | |
@@ -230,19 +230,19 @@ discard block |
||
| 230 | 230 | * @since 3.20.0 |
| 231 | 231 | */ |
| 232 | 232 | $screen = get_current_screen(); |
| 233 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
| 233 | + if (is_a($screen, 'WP_Screen') && 'filter-urls_page_filter_urls_form' === $screen->id) { |
|
| 234 | 234 | return; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Enqueue the admin scripts. |
| 238 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array( |
|
| 238 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/1/admin.js', array( |
|
| 239 | 239 | 'jquery', |
| 240 | 240 | 'underscore', |
| 241 | 241 | 'backbone', |
| 242 | - ), $this->version, false ); |
|
| 242 | + ), $this->version, false); |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
| 245 | + $can_edit_wordlift_entities = current_user_can('edit_wordlift_entities'); |
|
| 246 | 246 | |
| 247 | 247 | /* |
| 248 | 248 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | // Set the basic params. |
| 256 | 256 | $params = array( |
| 257 | 257 | // @todo scripts in admin should use wp.post. |
| 258 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 258 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 259 | 259 | // @todo remove specific actions from settings. |
| 260 | 260 | 'action' => 'entity_by_title', |
| 261 | 261 | 'datasetUri' => $this->configuration_service->get_dataset_uri(), |
@@ -266,15 +266,15 @@ discard block |
||
| 266 | 266 | // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
| 267 | 267 | 'can_create_entities' => $can_edit_wordlift_entities ? 'yes' : 'no', |
| 268 | 268 | 'l10n' => array( |
| 269 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 270 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 271 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 272 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
| 273 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
| 274 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
| 275 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
| 269 | + 'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'), |
|
| 270 | + 'logo_selection_title' => __('WordLift Choose Logo', 'wordlift'), |
|
| 271 | + 'logo_selection_button' => array('text' => __('Choose Logo', 'wordlift')), |
|
| 272 | + 'Type at least 3 characters to search...' => _x('Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift'), |
|
| 273 | + 'No results found for your search.' => _x('No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift'), |
|
| 274 | + 'Please wait while we look for entities in the linked data cloud...' => _x('Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift'), |
|
| 275 | + 'Add keywords to track' => __('Add Keywords to track', 'wordlift'), |
|
| 276 | 276 | ), |
| 277 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wordlift_autocomplete' ), |
|
| 277 | + 'wl_autocomplete_nonce' => wp_create_nonce('wordlift_autocomplete'), |
|
| 278 | 278 | 'autocomplete_scope' => $autocomplete_scope, |
| 279 | 279 | /** |
| 280 | 280 | * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
@@ -288,41 +288,41 @@ discard block |
||
| 288 | 288 | * |
| 289 | 289 | * @param string $editor The default editor id, by default `content`. |
| 290 | 290 | */ |
| 291 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
| 291 | + 'default_editor_id' => apply_filters('wl_default_editor_id', 'content'), |
|
| 292 | 292 | /** |
| 293 | 293 | * Add the link to the Search Keywords admin page. |
| 294 | 294 | * |
| 295 | 295 | * @since 3.20.0 |
| 296 | 296 | */ |
| 297 | - 'search_keywords_admin_page' => admin_url( 'admin.php?page=wl_configuration_admin_menu&tab=search-keywords' ), |
|
| 297 | + 'search_keywords_admin_page' => admin_url('admin.php?page=wl_configuration_admin_menu&tab=search-keywords'), |
|
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | 300 | // Set post-related values if there's a current post. |
| 301 | - if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 301 | + if (null !== $post = $entity_being_edited = get_post()) { |
|
| 302 | 302 | |
| 303 | 303 | $params['post_id'] = $entity_being_edited->ID; |
| 304 | 304 | $entity_service = Wordlift_Entity_Service::get_instance(); |
| 305 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
| 305 | + $params['entityBeingEdited'] = isset($entity_being_edited->post_type) && $entity_service->is_entity($post->ID) && is_numeric(get_the_ID()); |
|
| 306 | 306 | // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
| 307 | 307 | // from the results, since we don't want the current entity to be discovered by the analysis. |
| 308 | 308 | // |
| 309 | 309 | // See https://github.com/insideout10/wordlift-plugin/issues/345 |
| 310 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
| 311 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
| 310 | + $params['itemId'] = $entity_service->get_uri($entity_being_edited->ID); |
|
| 311 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce('wl_schemaorg_property'); |
|
| 312 | 312 | |
| 313 | 313 | /* |
| 314 | 314 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
| 315 | 315 | * |
| 316 | 316 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 317 | 317 | */ |
| 318 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 319 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
| 318 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 319 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all($post->ID); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // Finally output the params as `wlSettings` for JavaScript code. |
| 325 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
| 325 | + wp_localize_script($this->plugin_name, 'wlSettings', apply_filters('wl_admin_settings', $params)); |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | private static function require_files() { |
| 335 | 335 | |
| 336 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 337 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-service.php'; |
|
| 338 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-ajax-adapter.php'; |
|
| 339 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 340 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 336 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 337 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-service.php'; |
|
| 338 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-ajax-adapter.php'; |
|
| 339 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 340 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 341 | 341 | |
| 342 | 342 | } |
| 343 | 343 | |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | * @since 3.21.0 |
| 348 | 348 | */ |
| 349 | 349 | private static function add_block_category() { |
| 350 | - add_filter( 'block_categories', function( $categories, $post ) { |
|
| 351 | - if ( $post->post_type !== 'post' ) { |
|
| 350 | + add_filter('block_categories', function($categories, $post) { |
|
| 351 | + if ($post->post_type !== 'post') { |
|
| 352 | 352 | return $categories; |
| 353 | 353 | } |
| 354 | 354 | return array_merge( |
@@ -360,18 +360,18 @@ discard block |
||
| 360 | 360 | ), |
| 361 | 361 | ) |
| 362 | 362 | ); |
| 363 | - }, 10, 2 ); |
|
| 363 | + }, 10, 2); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | public static function is_gutenberg() { |
| 367 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
| 367 | + if (function_exists('is_gutenberg_page') && |
|
| 368 | 368 | is_gutenberg_page() |
| 369 | 369 | ) { |
| 370 | 370 | // The Gutenberg plugin is on. |
| 371 | 371 | return true; |
| 372 | 372 | } |
| 373 | 373 | $current_screen = get_current_screen(); |
| 374 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
| 374 | + if (method_exists($current_screen, 'is_block_editor') && |
|
| 375 | 375 | $current_screen->is_block_editor() |
| 376 | 376 | ) { |
| 377 | 377 | // Gutenberg page on 5+. |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | * |
| 95 | 95 | * @param string $content_type File content type. |
| 96 | 96 | * |
| 97 | - * @return string|bool The file extension on success and |
|
| 97 | + * @return string|false The file extension on success and |
|
| 98 | 98 | * false on fail or if the content type is not supported. |
| 99 | 99 | * @since 3.18.0 |
| 100 | 100 | * |
@@ -8,140 +8,140 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Wordlift_Remote_Image_Service { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Save the image with the specified URL locally. |
|
| 13 | - * |
|
| 14 | - * @param string $url The image remote URL. |
|
| 15 | - * |
|
| 16 | - * @return array|false An array with information about the saved image (*path*: the local path to the image, *url*: the local |
|
| 17 | - * url, *content_type*: the image content type) or false on error. |
|
| 18 | - * @since 3.18.0 |
|
| 19 | - * |
|
| 20 | - */ |
|
| 21 | - public static function save_from_url( $url ) { |
|
| 22 | - |
|
| 23 | - // Required for REST API calls |
|
| 24 | - if ( ! function_exists( 'WP_Filesystem' ) ) { |
|
| 25 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 26 | - } |
|
| 27 | - // Load `WP_Filesystem`. |
|
| 28 | - WP_Filesystem(); |
|
| 29 | - global $wp_filesystem; |
|
| 30 | - |
|
| 31 | - // Parse the url. |
|
| 32 | - $parts = wp_parse_url( $url ); |
|
| 33 | - |
|
| 34 | - // Get the bare filename (filename w/o the extension). |
|
| 35 | - $basename = str_replace( DIRECTORY_SEPARATOR, '_', rawurldecode( |
|
| 36 | - pathinfo( $parts['path'], PATHINFO_FILENAME ) |
|
| 37 | - ) ); |
|
| 38 | - |
|
| 39 | - // Get the base dir. |
|
| 40 | - $wp_upload_dir = wp_upload_dir(); |
|
| 41 | - |
|
| 42 | - // Set the upload directory and URL. |
|
| 43 | - $upload_dir = $wp_upload_dir['basedir'] . '/wl' . $wp_upload_dir['subdir']; |
|
| 44 | - $upload_url = $wp_upload_dir['baseurl'] . '/wl' . $wp_upload_dir['subdir']; |
|
| 45 | - |
|
| 46 | - // Get the full path to the local filename. |
|
| 47 | - $image_full_path = $upload_dir . '/' . $basename; |
|
| 48 | - $image_full_url = $upload_url . '/' . $basename; |
|
| 49 | - |
|
| 50 | - // Create custom directory and bail on failure. |
|
| 51 | - if ( ! wp_mkdir_p( $upload_dir ) ) { |
|
| 52 | - wl_write_log( "save_image_from_url : failed creating upload dir $upload_dir \n" ); |
|
| 53 | - |
|
| 54 | - return false; |
|
| 55 | - }; |
|
| 56 | - |
|
| 57 | - $response = self::get_response( $url ); |
|
| 58 | - |
|
| 59 | - // Bail if the response is not set. |
|
| 60 | - if ( false === $response ) { |
|
| 61 | - wl_write_log( "save_image_from_url : failed to fetch the response from: $url \n" ); |
|
| 62 | - |
|
| 63 | - return false; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - // Get the content type of response. |
|
| 67 | - $content_type = wp_remote_retrieve_header( $response, 'content-type' ); |
|
| 68 | - |
|
| 69 | - // Get the file extension. |
|
| 70 | - $extension = self::get_extension_from_content_type( $content_type ); |
|
| 71 | - |
|
| 72 | - // Bail if the content type is not supported. |
|
| 73 | - if ( empty( $extension ) ) { |
|
| 74 | - return false; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - // Complete the local filename. |
|
| 78 | - $image_full_path .= $extension; |
|
| 79 | - $image_full_url .= $extension; |
|
| 80 | - |
|
| 81 | - // Store the data locally. |
|
| 82 | - $wp_filesystem->put_contents( $image_full_path, wp_remote_retrieve_body( $response ) ); |
|
| 83 | - |
|
| 84 | - // Return the path. |
|
| 85 | - return array( |
|
| 86 | - 'path' => $image_full_path, |
|
| 87 | - 'url' => $image_full_url, |
|
| 88 | - 'content_type' => $content_type, |
|
| 89 | - ); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Returns the file extension using the content type. |
|
| 94 | - * |
|
| 95 | - * @param string $content_type File content type. |
|
| 96 | - * |
|
| 97 | - * @return string|bool The file extension on success and |
|
| 98 | - * false on fail or if the content type is not supported. |
|
| 99 | - * @since 3.18.0 |
|
| 100 | - * |
|
| 101 | - */ |
|
| 102 | - private static function get_extension_from_content_type( $content_type ) { |
|
| 103 | - |
|
| 104 | - // Return the extension if match. |
|
| 105 | - switch ( $content_type ) { |
|
| 106 | - case 'image/jpeg': |
|
| 107 | - case 'image/jpg': |
|
| 108 | - return '.jpg'; |
|
| 109 | - case 'image/gif': |
|
| 110 | - return '.gif'; |
|
| 111 | - case 'image/png': |
|
| 112 | - return '.png'; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // Otherwise return false. |
|
| 116 | - return false; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * Retrieve the response from url and sets the response. |
|
| 121 | - * |
|
| 122 | - * @param string $url The url to retrieve. |
|
| 123 | - * |
|
| 124 | - * @return false|array True on success and false on failure. |
|
| 125 | - * @since 3.18.0 |
|
| 126 | - * |
|
| 127 | - */ |
|
| 128 | - private static function get_response( $url ) { |
|
| 129 | - // Request the remote file. |
|
| 130 | - $response = wp_remote_get( $url ); |
|
| 131 | - |
|
| 132 | - // Bail out if the response is not ok. |
|
| 133 | - if ( |
|
| 134 | - is_wp_error( $response ) |
|
| 135 | - || 200 !== (int) $response['response']['code'] |
|
| 136 | - || ! isset( $response['body'] ) |
|
| 137 | - ) { |
|
| 138 | - wl_write_log( "save_image_from_url : error fetching image $url \n" ); |
|
| 139 | - |
|
| 140 | - return false; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // Set the response. |
|
| 144 | - return $response; |
|
| 145 | - } |
|
| 11 | + /** |
|
| 12 | + * Save the image with the specified URL locally. |
|
| 13 | + * |
|
| 14 | + * @param string $url The image remote URL. |
|
| 15 | + * |
|
| 16 | + * @return array|false An array with information about the saved image (*path*: the local path to the image, *url*: the local |
|
| 17 | + * url, *content_type*: the image content type) or false on error. |
|
| 18 | + * @since 3.18.0 |
|
| 19 | + * |
|
| 20 | + */ |
|
| 21 | + public static function save_from_url( $url ) { |
|
| 22 | + |
|
| 23 | + // Required for REST API calls |
|
| 24 | + if ( ! function_exists( 'WP_Filesystem' ) ) { |
|
| 25 | + require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 26 | + } |
|
| 27 | + // Load `WP_Filesystem`. |
|
| 28 | + WP_Filesystem(); |
|
| 29 | + global $wp_filesystem; |
|
| 30 | + |
|
| 31 | + // Parse the url. |
|
| 32 | + $parts = wp_parse_url( $url ); |
|
| 33 | + |
|
| 34 | + // Get the bare filename (filename w/o the extension). |
|
| 35 | + $basename = str_replace( DIRECTORY_SEPARATOR, '_', rawurldecode( |
|
| 36 | + pathinfo( $parts['path'], PATHINFO_FILENAME ) |
|
| 37 | + ) ); |
|
| 38 | + |
|
| 39 | + // Get the base dir. |
|
| 40 | + $wp_upload_dir = wp_upload_dir(); |
|
| 41 | + |
|
| 42 | + // Set the upload directory and URL. |
|
| 43 | + $upload_dir = $wp_upload_dir['basedir'] . '/wl' . $wp_upload_dir['subdir']; |
|
| 44 | + $upload_url = $wp_upload_dir['baseurl'] . '/wl' . $wp_upload_dir['subdir']; |
|
| 45 | + |
|
| 46 | + // Get the full path to the local filename. |
|
| 47 | + $image_full_path = $upload_dir . '/' . $basename; |
|
| 48 | + $image_full_url = $upload_url . '/' . $basename; |
|
| 49 | + |
|
| 50 | + // Create custom directory and bail on failure. |
|
| 51 | + if ( ! wp_mkdir_p( $upload_dir ) ) { |
|
| 52 | + wl_write_log( "save_image_from_url : failed creating upload dir $upload_dir \n" ); |
|
| 53 | + |
|
| 54 | + return false; |
|
| 55 | + }; |
|
| 56 | + |
|
| 57 | + $response = self::get_response( $url ); |
|
| 58 | + |
|
| 59 | + // Bail if the response is not set. |
|
| 60 | + if ( false === $response ) { |
|
| 61 | + wl_write_log( "save_image_from_url : failed to fetch the response from: $url \n" ); |
|
| 62 | + |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + // Get the content type of response. |
|
| 67 | + $content_type = wp_remote_retrieve_header( $response, 'content-type' ); |
|
| 68 | + |
|
| 69 | + // Get the file extension. |
|
| 70 | + $extension = self::get_extension_from_content_type( $content_type ); |
|
| 71 | + |
|
| 72 | + // Bail if the content type is not supported. |
|
| 73 | + if ( empty( $extension ) ) { |
|
| 74 | + return false; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + // Complete the local filename. |
|
| 78 | + $image_full_path .= $extension; |
|
| 79 | + $image_full_url .= $extension; |
|
| 80 | + |
|
| 81 | + // Store the data locally. |
|
| 82 | + $wp_filesystem->put_contents( $image_full_path, wp_remote_retrieve_body( $response ) ); |
|
| 83 | + |
|
| 84 | + // Return the path. |
|
| 85 | + return array( |
|
| 86 | + 'path' => $image_full_path, |
|
| 87 | + 'url' => $image_full_url, |
|
| 88 | + 'content_type' => $content_type, |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Returns the file extension using the content type. |
|
| 94 | + * |
|
| 95 | + * @param string $content_type File content type. |
|
| 96 | + * |
|
| 97 | + * @return string|bool The file extension on success and |
|
| 98 | + * false on fail or if the content type is not supported. |
|
| 99 | + * @since 3.18.0 |
|
| 100 | + * |
|
| 101 | + */ |
|
| 102 | + private static function get_extension_from_content_type( $content_type ) { |
|
| 103 | + |
|
| 104 | + // Return the extension if match. |
|
| 105 | + switch ( $content_type ) { |
|
| 106 | + case 'image/jpeg': |
|
| 107 | + case 'image/jpg': |
|
| 108 | + return '.jpg'; |
|
| 109 | + case 'image/gif': |
|
| 110 | + return '.gif'; |
|
| 111 | + case 'image/png': |
|
| 112 | + return '.png'; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // Otherwise return false. |
|
| 116 | + return false; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * Retrieve the response from url and sets the response. |
|
| 121 | + * |
|
| 122 | + * @param string $url The url to retrieve. |
|
| 123 | + * |
|
| 124 | + * @return false|array True on success and false on failure. |
|
| 125 | + * @since 3.18.0 |
|
| 126 | + * |
|
| 127 | + */ |
|
| 128 | + private static function get_response( $url ) { |
|
| 129 | + // Request the remote file. |
|
| 130 | + $response = wp_remote_get( $url ); |
|
| 131 | + |
|
| 132 | + // Bail out if the response is not ok. |
|
| 133 | + if ( |
|
| 134 | + is_wp_error( $response ) |
|
| 135 | + || 200 !== (int) $response['response']['code'] |
|
| 136 | + || ! isset( $response['body'] ) |
|
| 137 | + ) { |
|
| 138 | + wl_write_log( "save_image_from_url : error fetching image $url \n" ); |
|
| 139 | + |
|
| 140 | + return false; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // Set the response. |
|
| 144 | + return $response; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | 147 | } |
@@ -18,59 +18,59 @@ discard block |
||
| 18 | 18 | * @since 3.18.0 |
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | - public static function save_from_url( $url ) { |
|
| 21 | + public static function save_from_url($url) { |
|
| 22 | 22 | |
| 23 | 23 | // Required for REST API calls |
| 24 | - if ( ! function_exists( 'WP_Filesystem' ) ) { |
|
| 25 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 24 | + if ( ! function_exists('WP_Filesystem')) { |
|
| 25 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 26 | 26 | } |
| 27 | 27 | // Load `WP_Filesystem`. |
| 28 | 28 | WP_Filesystem(); |
| 29 | 29 | global $wp_filesystem; |
| 30 | 30 | |
| 31 | 31 | // Parse the url. |
| 32 | - $parts = wp_parse_url( $url ); |
|
| 32 | + $parts = wp_parse_url($url); |
|
| 33 | 33 | |
| 34 | 34 | // Get the bare filename (filename w/o the extension). |
| 35 | - $basename = str_replace( DIRECTORY_SEPARATOR, '_', rawurldecode( |
|
| 36 | - pathinfo( $parts['path'], PATHINFO_FILENAME ) |
|
| 37 | - ) ); |
|
| 35 | + $basename = str_replace(DIRECTORY_SEPARATOR, '_', rawurldecode( |
|
| 36 | + pathinfo($parts['path'], PATHINFO_FILENAME) |
|
| 37 | + )); |
|
| 38 | 38 | |
| 39 | 39 | // Get the base dir. |
| 40 | 40 | $wp_upload_dir = wp_upload_dir(); |
| 41 | 41 | |
| 42 | 42 | // Set the upload directory and URL. |
| 43 | - $upload_dir = $wp_upload_dir['basedir'] . '/wl' . $wp_upload_dir['subdir']; |
|
| 44 | - $upload_url = $wp_upload_dir['baseurl'] . '/wl' . $wp_upload_dir['subdir']; |
|
| 43 | + $upload_dir = $wp_upload_dir['basedir'].'/wl'.$wp_upload_dir['subdir']; |
|
| 44 | + $upload_url = $wp_upload_dir['baseurl'].'/wl'.$wp_upload_dir['subdir']; |
|
| 45 | 45 | |
| 46 | 46 | // Get the full path to the local filename. |
| 47 | - $image_full_path = $upload_dir . '/' . $basename; |
|
| 48 | - $image_full_url = $upload_url . '/' . $basename; |
|
| 47 | + $image_full_path = $upload_dir.'/'.$basename; |
|
| 48 | + $image_full_url = $upload_url.'/'.$basename; |
|
| 49 | 49 | |
| 50 | 50 | // Create custom directory and bail on failure. |
| 51 | - if ( ! wp_mkdir_p( $upload_dir ) ) { |
|
| 52 | - wl_write_log( "save_image_from_url : failed creating upload dir $upload_dir \n" ); |
|
| 51 | + if ( ! wp_mkdir_p($upload_dir)) { |
|
| 52 | + wl_write_log("save_image_from_url : failed creating upload dir $upload_dir \n"); |
|
| 53 | 53 | |
| 54 | 54 | return false; |
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | - $response = self::get_response( $url ); |
|
| 57 | + $response = self::get_response($url); |
|
| 58 | 58 | |
| 59 | 59 | // Bail if the response is not set. |
| 60 | - if ( false === $response ) { |
|
| 61 | - wl_write_log( "save_image_from_url : failed to fetch the response from: $url \n" ); |
|
| 60 | + if (false === $response) { |
|
| 61 | + wl_write_log("save_image_from_url : failed to fetch the response from: $url \n"); |
|
| 62 | 62 | |
| 63 | 63 | return false; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Get the content type of response. |
| 67 | - $content_type = wp_remote_retrieve_header( $response, 'content-type' ); |
|
| 67 | + $content_type = wp_remote_retrieve_header($response, 'content-type'); |
|
| 68 | 68 | |
| 69 | 69 | // Get the file extension. |
| 70 | - $extension = self::get_extension_from_content_type( $content_type ); |
|
| 70 | + $extension = self::get_extension_from_content_type($content_type); |
|
| 71 | 71 | |
| 72 | 72 | // Bail if the content type is not supported. |
| 73 | - if ( empty( $extension ) ) { |
|
| 73 | + if (empty($extension)) { |
|
| 74 | 74 | return false; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $image_full_url .= $extension; |
| 80 | 80 | |
| 81 | 81 | // Store the data locally. |
| 82 | - $wp_filesystem->put_contents( $image_full_path, wp_remote_retrieve_body( $response ) ); |
|
| 82 | + $wp_filesystem->put_contents($image_full_path, wp_remote_retrieve_body($response)); |
|
| 83 | 83 | |
| 84 | 84 | // Return the path. |
| 85 | 85 | return array( |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | * @since 3.18.0 |
| 100 | 100 | * |
| 101 | 101 | */ |
| 102 | - private static function get_extension_from_content_type( $content_type ) { |
|
| 102 | + private static function get_extension_from_content_type($content_type) { |
|
| 103 | 103 | |
| 104 | 104 | // Return the extension if match. |
| 105 | - switch ( $content_type ) { |
|
| 105 | + switch ($content_type) { |
|
| 106 | 106 | case 'image/jpeg': |
| 107 | 107 | case 'image/jpg': |
| 108 | 108 | return '.jpg'; |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | * @since 3.18.0 |
| 126 | 126 | * |
| 127 | 127 | */ |
| 128 | - private static function get_response( $url ) { |
|
| 128 | + private static function get_response($url) { |
|
| 129 | 129 | // Request the remote file. |
| 130 | - $response = wp_remote_get( $url ); |
|
| 130 | + $response = wp_remote_get($url); |
|
| 131 | 131 | |
| 132 | 132 | // Bail out if the response is not ok. |
| 133 | 133 | if ( |
| 134 | - is_wp_error( $response ) |
|
| 134 | + is_wp_error($response) |
|
| 135 | 135 | || 200 !== (int) $response['response']['code'] |
| 136 | - || ! isset( $response['body'] ) |
|
| 136 | + || ! isset($response['body']) |
|
| 137 | 137 | ) { |
| 138 | - wl_write_log( "save_image_from_url : error fetching image $url \n" ); |
|
| 138 | + wl_write_log("save_image_from_url : error fetching image $url \n"); |
|
| 139 | 139 | |
| 140 | 140 | return false; |
| 141 | 141 | } |
@@ -18,157 +18,157 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Vocabulary_Shortcode extends Wordlift_Shortcode { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The shortcode. |
|
| 23 | - * |
|
| 24 | - * @since 3.17.0 |
|
| 25 | - */ |
|
| 26 | - const SHORTCODE = 'wl_vocabulary'; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * The {@link Wordlift_Configuration_Service} instance. |
|
| 30 | - * |
|
| 31 | - * @since 3.11.0 |
|
| 32 | - * @access private |
|
| 33 | - * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 34 | - */ |
|
| 35 | - private $configuration_service; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * A {@link Wordlift_Log_Service} instance. |
|
| 39 | - * |
|
| 40 | - * @since 3.17.0 |
|
| 41 | - * @access private |
|
| 42 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 43 | - */ |
|
| 44 | - private $log; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * The vocabulary id |
|
| 48 | - * |
|
| 49 | - * @since 3.18.3 |
|
| 50 | - * @access private |
|
| 51 | - * @var int $vocabulary_id The vocabulary unique id. |
|
| 52 | - */ |
|
| 53 | - private static $vocabulary_id = 0; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Create a {@link Wordlift_Glossary_Shortcode} instance. |
|
| 57 | - * |
|
| 58 | - * @since 3.16.0 |
|
| 59 | - * |
|
| 60 | - * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 61 | - */ |
|
| 62 | - public function __construct( $configuration_service ) { |
|
| 63 | - parent::__construct(); |
|
| 64 | - |
|
| 65 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 66 | - |
|
| 67 | - $this->configuration_service = $configuration_service; |
|
| 68 | - |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Check whether the requirements for this shortcode to work are available. |
|
| 73 | - * |
|
| 74 | - * @since 3.17.0 |
|
| 75 | - * @return bool True if the requirements are satisfied otherwise false. |
|
| 76 | - */ |
|
| 77 | - private static function are_requirements_satisfied() { |
|
| 78 | - |
|
| 79 | - return function_exists( 'mb_strlen' ) && |
|
| 80 | - function_exists( 'mb_substr' ) && |
|
| 81 | - function_exists( 'mb_strtolower' ) && |
|
| 82 | - function_exists( 'mb_strtoupper' ) && |
|
| 83 | - function_exists( 'mb_convert_case' ); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Render the shortcode. |
|
| 88 | - * |
|
| 89 | - * @since 3.16.0 |
|
| 90 | - * |
|
| 91 | - * @param array $atts An array of shortcode attributes as set by the editor. |
|
| 92 | - * |
|
| 93 | - * @return string The output html code. |
|
| 94 | - */ |
|
| 95 | - public function render( $atts ) { |
|
| 96 | - |
|
| 97 | - // Bail out if the requirements aren't satisfied: we need mbstring for |
|
| 98 | - // the vocabulary widget to work. |
|
| 99 | - if ( ! self::are_requirements_satisfied() ) { |
|
| 100 | - $this->log->warn( "The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements." ); |
|
| 101 | - |
|
| 102 | - return ''; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - wp_enqueue_style( 'wl-vocabulary-shortcode', dirname( plugin_dir_url( __FILE__ ) ) . '/public/css/wordlift-vocabulary-shortcode.css' ); |
|
| 106 | - |
|
| 107 | - // Extract attributes and set default values. |
|
| 108 | - $atts = shortcode_atts( |
|
| 109 | - array( |
|
| 110 | - // The entity type, such as `person`, `organization`, ... |
|
| 111 | - 'type' => 'all', |
|
| 112 | - // Limit the number of posts to 100 by default. Use -1 to remove the limit. |
|
| 113 | - 'limit' => 100, |
|
| 114 | - // Sort by title. |
|
| 115 | - 'orderby' => 'post_date', |
|
| 116 | - // Sort DESC. |
|
| 117 | - 'order' => 'DESC', |
|
| 118 | - // Allow to specify the category ID. |
|
| 119 | - 'cat' => '', |
|
| 120 | - ), $atts |
|
| 121 | - ); |
|
| 122 | - |
|
| 123 | - // Get the posts. Note that if a `type` is specified before, then the |
|
| 124 | - // `tax_query` from the `add_criterias` call isn't added. |
|
| 125 | - $posts = $this->get_posts( $atts ); |
|
| 126 | - |
|
| 127 | - // Get the alphabet. |
|
| 128 | - $language_code = $this->configuration_service->get_language_code(); |
|
| 129 | - $alphabet = Wordlift_Alphabet_Service::get( $language_code ); |
|
| 130 | - |
|
| 131 | - // Add posts to the alphabet. |
|
| 132 | - foreach ( $posts as $post ) { |
|
| 133 | - $this->add_to_alphabet( $alphabet, $post->ID ); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - $header = ''; |
|
| 137 | - $sections = ''; |
|
| 138 | - |
|
| 139 | - // Get unique id for each vocabulary shortcode. |
|
| 140 | - $vocabulary_id = self::get_and_increment_vocabulary_id(); |
|
| 141 | - |
|
| 142 | - // Generate the header. |
|
| 143 | - foreach ( $alphabet as $item => $translations ) { |
|
| 144 | - $template = ( empty( $translations ) |
|
| 145 | - ? '<span class="wl-vocabulary-widget-disabled">%s</span>' |
|
| 146 | - : '<a href="#wl-vocabulary-%3$d-%2$s">%1$s</a>' ); |
|
| 147 | - |
|
| 148 | - $header .= sprintf( $template, esc_html( $item ), esc_attr( $item ), $vocabulary_id ); |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - // Generate the sections. |
|
| 152 | - foreach ( $alphabet as $item => $translations ) { |
|
| 153 | - // @since 3.19.3 we use `mb_strtolower` and `mb_strtoupper` with a custom function to handle sorting, |
|
| 154 | - // since we had `AB` being placed before `Aa` with `asort`. |
|
| 155 | - // |
|
| 156 | - // Order the translations alphabetically. |
|
| 157 | - // asort( $translations ); |
|
| 158 | - uasort( $translations, function ( $a, $b ) { |
|
| 159 | - if ( mb_strtolower( $a ) === mb_strtolower( $b ) |
|
| 160 | - || mb_strtoupper( $a ) === mb_strtoupper( $b ) ) { |
|
| 161 | - return 0; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - return ( mb_strtolower( $a ) < mb_strtolower( $b ) ) ? - 1 : 1; |
|
| 165 | - } ); |
|
| 166 | - $sections .= $this->get_section( $item, $translations, $vocabulary_id ); |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - // Return HTML template. |
|
| 170 | - ob_start(); |
|
| 171 | - ?> |
|
| 21 | + /** |
|
| 22 | + * The shortcode. |
|
| 23 | + * |
|
| 24 | + * @since 3.17.0 |
|
| 25 | + */ |
|
| 26 | + const SHORTCODE = 'wl_vocabulary'; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * The {@link Wordlift_Configuration_Service} instance. |
|
| 30 | + * |
|
| 31 | + * @since 3.11.0 |
|
| 32 | + * @access private |
|
| 33 | + * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 34 | + */ |
|
| 35 | + private $configuration_service; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * A {@link Wordlift_Log_Service} instance. |
|
| 39 | + * |
|
| 40 | + * @since 3.17.0 |
|
| 41 | + * @access private |
|
| 42 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 43 | + */ |
|
| 44 | + private $log; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * The vocabulary id |
|
| 48 | + * |
|
| 49 | + * @since 3.18.3 |
|
| 50 | + * @access private |
|
| 51 | + * @var int $vocabulary_id The vocabulary unique id. |
|
| 52 | + */ |
|
| 53 | + private static $vocabulary_id = 0; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Create a {@link Wordlift_Glossary_Shortcode} instance. |
|
| 57 | + * |
|
| 58 | + * @since 3.16.0 |
|
| 59 | + * |
|
| 60 | + * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 61 | + */ |
|
| 62 | + public function __construct( $configuration_service ) { |
|
| 63 | + parent::__construct(); |
|
| 64 | + |
|
| 65 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 66 | + |
|
| 67 | + $this->configuration_service = $configuration_service; |
|
| 68 | + |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Check whether the requirements for this shortcode to work are available. |
|
| 73 | + * |
|
| 74 | + * @since 3.17.0 |
|
| 75 | + * @return bool True if the requirements are satisfied otherwise false. |
|
| 76 | + */ |
|
| 77 | + private static function are_requirements_satisfied() { |
|
| 78 | + |
|
| 79 | + return function_exists( 'mb_strlen' ) && |
|
| 80 | + function_exists( 'mb_substr' ) && |
|
| 81 | + function_exists( 'mb_strtolower' ) && |
|
| 82 | + function_exists( 'mb_strtoupper' ) && |
|
| 83 | + function_exists( 'mb_convert_case' ); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Render the shortcode. |
|
| 88 | + * |
|
| 89 | + * @since 3.16.0 |
|
| 90 | + * |
|
| 91 | + * @param array $atts An array of shortcode attributes as set by the editor. |
|
| 92 | + * |
|
| 93 | + * @return string The output html code. |
|
| 94 | + */ |
|
| 95 | + public function render( $atts ) { |
|
| 96 | + |
|
| 97 | + // Bail out if the requirements aren't satisfied: we need mbstring for |
|
| 98 | + // the vocabulary widget to work. |
|
| 99 | + if ( ! self::are_requirements_satisfied() ) { |
|
| 100 | + $this->log->warn( "The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements." ); |
|
| 101 | + |
|
| 102 | + return ''; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + wp_enqueue_style( 'wl-vocabulary-shortcode', dirname( plugin_dir_url( __FILE__ ) ) . '/public/css/wordlift-vocabulary-shortcode.css' ); |
|
| 106 | + |
|
| 107 | + // Extract attributes and set default values. |
|
| 108 | + $atts = shortcode_atts( |
|
| 109 | + array( |
|
| 110 | + // The entity type, such as `person`, `organization`, ... |
|
| 111 | + 'type' => 'all', |
|
| 112 | + // Limit the number of posts to 100 by default. Use -1 to remove the limit. |
|
| 113 | + 'limit' => 100, |
|
| 114 | + // Sort by title. |
|
| 115 | + 'orderby' => 'post_date', |
|
| 116 | + // Sort DESC. |
|
| 117 | + 'order' => 'DESC', |
|
| 118 | + // Allow to specify the category ID. |
|
| 119 | + 'cat' => '', |
|
| 120 | + ), $atts |
|
| 121 | + ); |
|
| 122 | + |
|
| 123 | + // Get the posts. Note that if a `type` is specified before, then the |
|
| 124 | + // `tax_query` from the `add_criterias` call isn't added. |
|
| 125 | + $posts = $this->get_posts( $atts ); |
|
| 126 | + |
|
| 127 | + // Get the alphabet. |
|
| 128 | + $language_code = $this->configuration_service->get_language_code(); |
|
| 129 | + $alphabet = Wordlift_Alphabet_Service::get( $language_code ); |
|
| 130 | + |
|
| 131 | + // Add posts to the alphabet. |
|
| 132 | + foreach ( $posts as $post ) { |
|
| 133 | + $this->add_to_alphabet( $alphabet, $post->ID ); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + $header = ''; |
|
| 137 | + $sections = ''; |
|
| 138 | + |
|
| 139 | + // Get unique id for each vocabulary shortcode. |
|
| 140 | + $vocabulary_id = self::get_and_increment_vocabulary_id(); |
|
| 141 | + |
|
| 142 | + // Generate the header. |
|
| 143 | + foreach ( $alphabet as $item => $translations ) { |
|
| 144 | + $template = ( empty( $translations ) |
|
| 145 | + ? '<span class="wl-vocabulary-widget-disabled">%s</span>' |
|
| 146 | + : '<a href="#wl-vocabulary-%3$d-%2$s">%1$s</a>' ); |
|
| 147 | + |
|
| 148 | + $header .= sprintf( $template, esc_html( $item ), esc_attr( $item ), $vocabulary_id ); |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + // Generate the sections. |
|
| 152 | + foreach ( $alphabet as $item => $translations ) { |
|
| 153 | + // @since 3.19.3 we use `mb_strtolower` and `mb_strtoupper` with a custom function to handle sorting, |
|
| 154 | + // since we had `AB` being placed before `Aa` with `asort`. |
|
| 155 | + // |
|
| 156 | + // Order the translations alphabetically. |
|
| 157 | + // asort( $translations ); |
|
| 158 | + uasort( $translations, function ( $a, $b ) { |
|
| 159 | + if ( mb_strtolower( $a ) === mb_strtolower( $b ) |
|
| 160 | + || mb_strtoupper( $a ) === mb_strtoupper( $b ) ) { |
|
| 161 | + return 0; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + return ( mb_strtolower( $a ) < mb_strtolower( $b ) ) ? - 1 : 1; |
|
| 165 | + } ); |
|
| 166 | + $sections .= $this->get_section( $item, $translations, $vocabulary_id ); |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + // Return HTML template. |
|
| 170 | + ob_start(); |
|
| 171 | + ?> |
|
| 172 | 172 | <div class='wl-vocabulary'> |
| 173 | 173 | <nav class='wl-vocabulary-alphabet-nav'> |
| 174 | 174 | <?php echo $header; ?> |
@@ -178,34 +178,34 @@ discard block |
||
| 178 | 178 | </div> |
| 179 | 179 | </div> |
| 180 | 180 | <?php |
| 181 | - $html = ob_get_clean(); |
|
| 182 | - |
|
| 183 | - return $html; |
|
| 184 | - |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Generate the html code for the section. |
|
| 189 | - * |
|
| 190 | - * @since 3.17.0 |
|
| 191 | - * |
|
| 192 | - * @param string $letter The section's letter. |
|
| 193 | - * @param array $posts An array of `$post_id => $post_title` associated with |
|
| 194 | - * the section. |
|
| 195 | - * @param int $vocabulary_id Unique vocabulary id. |
|
| 196 | - * |
|
| 197 | - * @return string The section html code (or an empty string if the section has |
|
| 198 | - * no posts). |
|
| 199 | - */ |
|
| 200 | - private function get_section( $letter, $posts, $vocabulary_id ) { |
|
| 201 | - |
|
| 202 | - // Return an empty string if there are no posts. |
|
| 203 | - if ( 0 === count( $posts ) ) { |
|
| 204 | - return ''; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - return sprintf( |
|
| 208 | - ' |
|
| 181 | + $html = ob_get_clean(); |
|
| 182 | + |
|
| 183 | + return $html; |
|
| 184 | + |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Generate the html code for the section. |
|
| 189 | + * |
|
| 190 | + * @since 3.17.0 |
|
| 191 | + * |
|
| 192 | + * @param string $letter The section's letter. |
|
| 193 | + * @param array $posts An array of `$post_id => $post_title` associated with |
|
| 194 | + * the section. |
|
| 195 | + * @param int $vocabulary_id Unique vocabulary id. |
|
| 196 | + * |
|
| 197 | + * @return string The section html code (or an empty string if the section has |
|
| 198 | + * no posts). |
|
| 199 | + */ |
|
| 200 | + private function get_section( $letter, $posts, $vocabulary_id ) { |
|
| 201 | + |
|
| 202 | + // Return an empty string if there are no posts. |
|
| 203 | + if ( 0 === count( $posts ) ) { |
|
| 204 | + return ''; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + return sprintf( |
|
| 208 | + ' |
|
| 209 | 209 | <div class="wl-vocabulary-letter-block" id="wl-vocabulary-%d-%s"> |
| 210 | 210 | <aside class="wl-vocabulary-left-column">%s</aside> |
| 211 | 211 | <div class="wl-vocabulary-right-column"> |
@@ -215,127 +215,127 @@ discard block |
||
| 215 | 215 | </div> |
| 216 | 216 | </div> |
| 217 | 217 | ', $vocabulary_id, esc_attr( $letter ), esc_html( $letter ), $this->format_posts_as_list( $posts ) |
| 218 | - ); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * Format an array post `$post_id => $post_title` as a list. |
|
| 223 | - * |
|
| 224 | - * @since 3.17.0 |
|
| 225 | - * |
|
| 226 | - * @param array $posts An array of `$post_id => $post_title` key, value pairs. |
|
| 227 | - * |
|
| 228 | - * @return string A list. |
|
| 229 | - */ |
|
| 230 | - private function format_posts_as_list( $posts ) { |
|
| 231 | - |
|
| 232 | - return array_reduce( |
|
| 233 | - array_keys( $posts ), function ( $carry, $item ) use ( $posts ) { |
|
| 234 | - return $carry . sprintf( '<li><a href="%s">%s</a></li>', esc_attr( get_permalink( $item ) ), esc_html( $posts[ $item ] ) ); |
|
| 235 | - }, '' |
|
| 236 | - ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * Get the posts from WordPress using the provided attributes. |
|
| 241 | - * |
|
| 242 | - * @since 3.17.0 |
|
| 243 | - * |
|
| 244 | - * @param array $atts The shortcode attributes. |
|
| 245 | - * |
|
| 246 | - * @return array An array of {@link WP_Post}s. |
|
| 247 | - */ |
|
| 248 | - private function get_posts( $atts ) { |
|
| 249 | - // The default arguments for the query. |
|
| 250 | - $args = array( |
|
| 251 | - 'posts_per_page' => intval( $atts['limit'] ), |
|
| 252 | - 'update_post_meta_cache' => false, |
|
| 253 | - 'update_post_term_cache' => false, |
|
| 254 | - 'orderby' => $atts['orderby'], |
|
| 255 | - 'order' => $atts['order'], |
|
| 256 | - // Exclude the publisher. |
|
| 257 | - 'post__not_in' => array( $this->configuration_service->get_publisher_id() ), |
|
| 258 | - ); |
|
| 259 | - |
|
| 260 | - // Limit the based entity type if needed. |
|
| 261 | - if ( 'all' !== $atts['type'] ) { |
|
| 262 | - $args['tax_query'] = array( |
|
| 263 | - array( |
|
| 264 | - 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 265 | - 'field' => 'slug', |
|
| 266 | - 'terms' => $atts['type'], |
|
| 267 | - ), |
|
| 268 | - ); |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - if ( ! empty( $atts['cat'] ) ) { |
|
| 272 | - $args['cat'] = $atts['cat']; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - // Get the posts. Note that if a `type` is specified before, then the |
|
| 276 | - // `tax_query` from the `add_criterias` call isn't added. |
|
| 277 | - return get_posts( Wordlift_Entity_Service::add_criterias( $args ) ); |
|
| 278 | - |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Populate the alphabet with posts. |
|
| 283 | - * |
|
| 284 | - * @since 3.17.0 |
|
| 285 | - * |
|
| 286 | - * @param array $alphabet An array of letters. |
|
| 287 | - * @param int $post_id The {@link WP_Post} id. |
|
| 288 | - */ |
|
| 289 | - private function add_to_alphabet( &$alphabet, $post_id ) { |
|
| 290 | - |
|
| 291 | - // Get the title without accents. |
|
| 292 | - $title = remove_accents( get_the_title( $post_id ) ); |
|
| 293 | - |
|
| 294 | - // Get the initial letter. |
|
| 295 | - $letter = $this->get_first_letter_in_alphabet_or_hash( $alphabet, $title ); |
|
| 296 | - |
|
| 297 | - // Add the post. |
|
| 298 | - $alphabet[ $letter ][ $post_id ] = $title; |
|
| 299 | - |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * Find the first letter in the alphabet. |
|
| 304 | - * |
|
| 305 | - * In some alphabets a letter is a compound of letters, therefore this function |
|
| 306 | - * will look for groups of 2 or 3 letters in the alphabet before looking for a |
|
| 307 | - * single letter. In case the letter is not found a # (hash) key is returned. |
|
| 308 | - * |
|
| 309 | - * @since 3.17.0 |
|
| 310 | - * |
|
| 311 | - * @param array $alphabet An array of alphabet letters. |
|
| 312 | - * @param string $title The title to match. |
|
| 313 | - * |
|
| 314 | - * @return string The initial letter or a `#` key. |
|
| 315 | - */ |
|
| 316 | - private function get_first_letter_in_alphabet_or_hash( $alphabet, $title ) { |
|
| 317 | - |
|
| 318 | - // Need to handle letters which consist of 3 and 2 characters. |
|
| 319 | - for ( $i = 3; $i > 0; $i -- ) { |
|
| 320 | - $letter = mb_convert_case( mb_substr( $title, 0, $i ), MB_CASE_UPPER ); |
|
| 321 | - if ( isset( $alphabet[ $letter ] ) ) { |
|
| 322 | - return $letter; |
|
| 323 | - } |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - return '#'; |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * Get and increment the `$vocabulary_id`. |
|
| 331 | - * |
|
| 332 | - * @since 3.18.3 |
|
| 333 | - * |
|
| 334 | - * @return int The incremented vocabulary id. |
|
| 335 | - */ |
|
| 336 | - private static function get_and_increment_vocabulary_id() { |
|
| 337 | - return self::$vocabulary_id ++; |
|
| 338 | - } |
|
| 218 | + ); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * Format an array post `$post_id => $post_title` as a list. |
|
| 223 | + * |
|
| 224 | + * @since 3.17.0 |
|
| 225 | + * |
|
| 226 | + * @param array $posts An array of `$post_id => $post_title` key, value pairs. |
|
| 227 | + * |
|
| 228 | + * @return string A list. |
|
| 229 | + */ |
|
| 230 | + private function format_posts_as_list( $posts ) { |
|
| 231 | + |
|
| 232 | + return array_reduce( |
|
| 233 | + array_keys( $posts ), function ( $carry, $item ) use ( $posts ) { |
|
| 234 | + return $carry . sprintf( '<li><a href="%s">%s</a></li>', esc_attr( get_permalink( $item ) ), esc_html( $posts[ $item ] ) ); |
|
| 235 | + }, '' |
|
| 236 | + ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * Get the posts from WordPress using the provided attributes. |
|
| 241 | + * |
|
| 242 | + * @since 3.17.0 |
|
| 243 | + * |
|
| 244 | + * @param array $atts The shortcode attributes. |
|
| 245 | + * |
|
| 246 | + * @return array An array of {@link WP_Post}s. |
|
| 247 | + */ |
|
| 248 | + private function get_posts( $atts ) { |
|
| 249 | + // The default arguments for the query. |
|
| 250 | + $args = array( |
|
| 251 | + 'posts_per_page' => intval( $atts['limit'] ), |
|
| 252 | + 'update_post_meta_cache' => false, |
|
| 253 | + 'update_post_term_cache' => false, |
|
| 254 | + 'orderby' => $atts['orderby'], |
|
| 255 | + 'order' => $atts['order'], |
|
| 256 | + // Exclude the publisher. |
|
| 257 | + 'post__not_in' => array( $this->configuration_service->get_publisher_id() ), |
|
| 258 | + ); |
|
| 259 | + |
|
| 260 | + // Limit the based entity type if needed. |
|
| 261 | + if ( 'all' !== $atts['type'] ) { |
|
| 262 | + $args['tax_query'] = array( |
|
| 263 | + array( |
|
| 264 | + 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 265 | + 'field' => 'slug', |
|
| 266 | + 'terms' => $atts['type'], |
|
| 267 | + ), |
|
| 268 | + ); |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + if ( ! empty( $atts['cat'] ) ) { |
|
| 272 | + $args['cat'] = $atts['cat']; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + // Get the posts. Note that if a `type` is specified before, then the |
|
| 276 | + // `tax_query` from the `add_criterias` call isn't added. |
|
| 277 | + return get_posts( Wordlift_Entity_Service::add_criterias( $args ) ); |
|
| 278 | + |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Populate the alphabet with posts. |
|
| 283 | + * |
|
| 284 | + * @since 3.17.0 |
|
| 285 | + * |
|
| 286 | + * @param array $alphabet An array of letters. |
|
| 287 | + * @param int $post_id The {@link WP_Post} id. |
|
| 288 | + */ |
|
| 289 | + private function add_to_alphabet( &$alphabet, $post_id ) { |
|
| 290 | + |
|
| 291 | + // Get the title without accents. |
|
| 292 | + $title = remove_accents( get_the_title( $post_id ) ); |
|
| 293 | + |
|
| 294 | + // Get the initial letter. |
|
| 295 | + $letter = $this->get_first_letter_in_alphabet_or_hash( $alphabet, $title ); |
|
| 296 | + |
|
| 297 | + // Add the post. |
|
| 298 | + $alphabet[ $letter ][ $post_id ] = $title; |
|
| 299 | + |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * Find the first letter in the alphabet. |
|
| 304 | + * |
|
| 305 | + * In some alphabets a letter is a compound of letters, therefore this function |
|
| 306 | + * will look for groups of 2 or 3 letters in the alphabet before looking for a |
|
| 307 | + * single letter. In case the letter is not found a # (hash) key is returned. |
|
| 308 | + * |
|
| 309 | + * @since 3.17.0 |
|
| 310 | + * |
|
| 311 | + * @param array $alphabet An array of alphabet letters. |
|
| 312 | + * @param string $title The title to match. |
|
| 313 | + * |
|
| 314 | + * @return string The initial letter or a `#` key. |
|
| 315 | + */ |
|
| 316 | + private function get_first_letter_in_alphabet_or_hash( $alphabet, $title ) { |
|
| 317 | + |
|
| 318 | + // Need to handle letters which consist of 3 and 2 characters. |
|
| 319 | + for ( $i = 3; $i > 0; $i -- ) { |
|
| 320 | + $letter = mb_convert_case( mb_substr( $title, 0, $i ), MB_CASE_UPPER ); |
|
| 321 | + if ( isset( $alphabet[ $letter ] ) ) { |
|
| 322 | + return $letter; |
|
| 323 | + } |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + return '#'; |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * Get and increment the `$vocabulary_id`. |
|
| 331 | + * |
|
| 332 | + * @since 3.18.3 |
|
| 333 | + * |
|
| 334 | + * @return int The incremented vocabulary id. |
|
| 335 | + */ |
|
| 336 | + private static function get_and_increment_vocabulary_id() { |
|
| 337 | + return self::$vocabulary_id ++; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | |
@@ -343,41 +343,41 @@ discard block |
||
| 343 | 343 | * register_block_type for Gutenberg blocks |
| 344 | 344 | */ |
| 345 | 345 | add_action( 'init', function() { |
| 346 | - // Bail out if the `register_block_type` function isn't available. |
|
| 347 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 348 | - return; |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - register_block_type('wordlift/vocabulary', array( |
|
| 352 | - 'editor_script' => 'wordlift-admin-edit-gutenberg', |
|
| 353 | - 'render_callback' => function($attributes){ |
|
| 354 | - $attr_code = ''; |
|
| 355 | - foreach ($attributes as $key => $value) { |
|
| 356 | - $attr_code .= $key.'="'.$value.'" '; |
|
| 357 | - } |
|
| 358 | - return '[wl_vocabulary '.$attr_code.']'; |
|
| 359 | - }, |
|
| 360 | - 'attributes' => array( |
|
| 361 | - 'type' => array( |
|
| 362 | - 'type' => 'string', |
|
| 363 | - 'default' => 'all' |
|
| 346 | + // Bail out if the `register_block_type` function isn't available. |
|
| 347 | + if ( ! function_exists( 'register_block_type' ) ) { |
|
| 348 | + return; |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + register_block_type('wordlift/vocabulary', array( |
|
| 352 | + 'editor_script' => 'wordlift-admin-edit-gutenberg', |
|
| 353 | + 'render_callback' => function($attributes){ |
|
| 354 | + $attr_code = ''; |
|
| 355 | + foreach ($attributes as $key => $value) { |
|
| 356 | + $attr_code .= $key.'="'.$value.'" '; |
|
| 357 | + } |
|
| 358 | + return '[wl_vocabulary '.$attr_code.']'; |
|
| 359 | + }, |
|
| 360 | + 'attributes' => array( |
|
| 361 | + 'type' => array( |
|
| 362 | + 'type' => 'string', |
|
| 363 | + 'default' => 'all' |
|
| 364 | 364 | ), |
| 365 | - 'limit' => array( |
|
| 366 | - 'type' => 'number', |
|
| 367 | - 'default' => 100 |
|
| 365 | + 'limit' => array( |
|
| 366 | + 'type' => 'number', |
|
| 367 | + 'default' => 100 |
|
| 368 | 368 | ), |
| 369 | - 'orderby' => array( |
|
| 370 | - 'type' => 'string', |
|
| 371 | - 'default' => 'post_date' |
|
| 369 | + 'orderby' => array( |
|
| 370 | + 'type' => 'string', |
|
| 371 | + 'default' => 'post_date' |
|
| 372 | 372 | ), |
| 373 | - 'order' => array( |
|
| 374 | - 'type' => 'string', |
|
| 375 | - 'default' => 'DESC' |
|
| 373 | + 'order' => array( |
|
| 374 | + 'type' => 'string', |
|
| 375 | + 'default' => 'DESC' |
|
| 376 | 376 | ), |
| 377 | - 'cat' => array( |
|
| 378 | - 'type' => 'string', |
|
| 379 | - 'default' => '' |
|
| 377 | + 'cat' => array( |
|
| 378 | + 'type' => 'string', |
|
| 379 | + 'default' => '' |
|
| 380 | 380 | ), |
| 381 | 381 | ) |
| 382 | - )); |
|
| 382 | + )); |
|
| 383 | 383 | } ); |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
| 61 | 61 | */ |
| 62 | - public function __construct( $configuration_service ) { |
|
| 62 | + public function __construct($configuration_service) { |
|
| 63 | 63 | parent::__construct(); |
| 64 | 64 | |
| 65 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 65 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 66 | 66 | |
| 67 | 67 | $this->configuration_service = $configuration_service; |
| 68 | 68 | |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private static function are_requirements_satisfied() { |
| 78 | 78 | |
| 79 | - return function_exists( 'mb_strlen' ) && |
|
| 80 | - function_exists( 'mb_substr' ) && |
|
| 81 | - function_exists( 'mb_strtolower' ) && |
|
| 82 | - function_exists( 'mb_strtoupper' ) && |
|
| 83 | - function_exists( 'mb_convert_case' ); |
|
| 79 | + return function_exists('mb_strlen') && |
|
| 80 | + function_exists('mb_substr') && |
|
| 81 | + function_exists('mb_strtolower') && |
|
| 82 | + function_exists('mb_strtoupper') && |
|
| 83 | + function_exists('mb_convert_case'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return string The output html code. |
| 94 | 94 | */ |
| 95 | - public function render( $atts ) { |
|
| 95 | + public function render($atts) { |
|
| 96 | 96 | |
| 97 | 97 | // Bail out if the requirements aren't satisfied: we need mbstring for |
| 98 | 98 | // the vocabulary widget to work. |
| 99 | - if ( ! self::are_requirements_satisfied() ) { |
|
| 100 | - $this->log->warn( "The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements." ); |
|
| 99 | + if ( ! self::are_requirements_satisfied()) { |
|
| 100 | + $this->log->warn("The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements."); |
|
| 101 | 101 | |
| 102 | 102 | return ''; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - wp_enqueue_style( 'wl-vocabulary-shortcode', dirname( plugin_dir_url( __FILE__ ) ) . '/public/css/wordlift-vocabulary-shortcode.css' ); |
|
| 105 | + wp_enqueue_style('wl-vocabulary-shortcode', dirname(plugin_dir_url(__FILE__)).'/public/css/wordlift-vocabulary-shortcode.css'); |
|
| 106 | 106 | |
| 107 | 107 | // Extract attributes and set default values. |
| 108 | 108 | $atts = shortcode_atts( |
@@ -122,15 +122,15 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // Get the posts. Note that if a `type` is specified before, then the |
| 124 | 124 | // `tax_query` from the `add_criterias` call isn't added. |
| 125 | - $posts = $this->get_posts( $atts ); |
|
| 125 | + $posts = $this->get_posts($atts); |
|
| 126 | 126 | |
| 127 | 127 | // Get the alphabet. |
| 128 | 128 | $language_code = $this->configuration_service->get_language_code(); |
| 129 | - $alphabet = Wordlift_Alphabet_Service::get( $language_code ); |
|
| 129 | + $alphabet = Wordlift_Alphabet_Service::get($language_code); |
|
| 130 | 130 | |
| 131 | 131 | // Add posts to the alphabet. |
| 132 | - foreach ( $posts as $post ) { |
|
| 133 | - $this->add_to_alphabet( $alphabet, $post->ID ); |
|
| 132 | + foreach ($posts as $post) { |
|
| 133 | + $this->add_to_alphabet($alphabet, $post->ID); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $header = ''; |
@@ -140,30 +140,30 @@ discard block |
||
| 140 | 140 | $vocabulary_id = self::get_and_increment_vocabulary_id(); |
| 141 | 141 | |
| 142 | 142 | // Generate the header. |
| 143 | - foreach ( $alphabet as $item => $translations ) { |
|
| 144 | - $template = ( empty( $translations ) |
|
| 143 | + foreach ($alphabet as $item => $translations) { |
|
| 144 | + $template = (empty($translations) |
|
| 145 | 145 | ? '<span class="wl-vocabulary-widget-disabled">%s</span>' |
| 146 | - : '<a href="#wl-vocabulary-%3$d-%2$s">%1$s</a>' ); |
|
| 146 | + : '<a href="#wl-vocabulary-%3$d-%2$s">%1$s</a>'); |
|
| 147 | 147 | |
| 148 | - $header .= sprintf( $template, esc_html( $item ), esc_attr( $item ), $vocabulary_id ); |
|
| 148 | + $header .= sprintf($template, esc_html($item), esc_attr($item), $vocabulary_id); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Generate the sections. |
| 152 | - foreach ( $alphabet as $item => $translations ) { |
|
| 152 | + foreach ($alphabet as $item => $translations) { |
|
| 153 | 153 | // @since 3.19.3 we use `mb_strtolower` and `mb_strtoupper` with a custom function to handle sorting, |
| 154 | 154 | // since we had `AB` being placed before `Aa` with `asort`. |
| 155 | 155 | // |
| 156 | 156 | // Order the translations alphabetically. |
| 157 | 157 | // asort( $translations ); |
| 158 | - uasort( $translations, function ( $a, $b ) { |
|
| 159 | - if ( mb_strtolower( $a ) === mb_strtolower( $b ) |
|
| 160 | - || mb_strtoupper( $a ) === mb_strtoupper( $b ) ) { |
|
| 158 | + uasort($translations, function($a, $b) { |
|
| 159 | + if (mb_strtolower($a) === mb_strtolower($b) |
|
| 160 | + || mb_strtoupper($a) === mb_strtoupper($b)) { |
|
| 161 | 161 | return 0; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - return ( mb_strtolower( $a ) < mb_strtolower( $b ) ) ? - 1 : 1; |
|
| 164 | + return (mb_strtolower($a) < mb_strtolower($b)) ? -1 : 1; |
|
| 165 | 165 | } ); |
| 166 | - $sections .= $this->get_section( $item, $translations, $vocabulary_id ); |
|
| 166 | + $sections .= $this->get_section($item, $translations, $vocabulary_id); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // Return HTML template. |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | * @return string The section html code (or an empty string if the section has |
| 198 | 198 | * no posts). |
| 199 | 199 | */ |
| 200 | - private function get_section( $letter, $posts, $vocabulary_id ) { |
|
| 200 | + private function get_section($letter, $posts, $vocabulary_id) { |
|
| 201 | 201 | |
| 202 | 202 | // Return an empty string if there are no posts. |
| 203 | - if ( 0 === count( $posts ) ) { |
|
| 203 | + if (0 === count($posts)) { |
|
| 204 | 204 | return ''; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | </ul> |
| 215 | 215 | </div> |
| 216 | 216 | </div> |
| 217 | - ', $vocabulary_id, esc_attr( $letter ), esc_html( $letter ), $this->format_posts_as_list( $posts ) |
|
| 217 | + ', $vocabulary_id, esc_attr($letter), esc_html($letter), $this->format_posts_as_list($posts) |
|
| 218 | 218 | ); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return string A list. |
| 229 | 229 | */ |
| 230 | - private function format_posts_as_list( $posts ) { |
|
| 230 | + private function format_posts_as_list($posts) { |
|
| 231 | 231 | |
| 232 | 232 | return array_reduce( |
| 233 | - array_keys( $posts ), function ( $carry, $item ) use ( $posts ) { |
|
| 234 | - return $carry . sprintf( '<li><a href="%s">%s</a></li>', esc_attr( get_permalink( $item ) ), esc_html( $posts[ $item ] ) ); |
|
| 233 | + array_keys($posts), function($carry, $item) use ($posts) { |
|
| 234 | + return $carry.sprintf('<li><a href="%s">%s</a></li>', esc_attr(get_permalink($item)), esc_html($posts[$item])); |
|
| 235 | 235 | }, '' |
| 236 | 236 | ); |
| 237 | 237 | } |
@@ -245,20 +245,20 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @return array An array of {@link WP_Post}s. |
| 247 | 247 | */ |
| 248 | - private function get_posts( $atts ) { |
|
| 248 | + private function get_posts($atts) { |
|
| 249 | 249 | // The default arguments for the query. |
| 250 | 250 | $args = array( |
| 251 | - 'posts_per_page' => intval( $atts['limit'] ), |
|
| 251 | + 'posts_per_page' => intval($atts['limit']), |
|
| 252 | 252 | 'update_post_meta_cache' => false, |
| 253 | 253 | 'update_post_term_cache' => false, |
| 254 | 254 | 'orderby' => $atts['orderby'], |
| 255 | 255 | 'order' => $atts['order'], |
| 256 | 256 | // Exclude the publisher. |
| 257 | - 'post__not_in' => array( $this->configuration_service->get_publisher_id() ), |
|
| 257 | + 'post__not_in' => array($this->configuration_service->get_publisher_id()), |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | // Limit the based entity type if needed. |
| 261 | - if ( 'all' !== $atts['type'] ) { |
|
| 261 | + if ('all' !== $atts['type']) { |
|
| 262 | 262 | $args['tax_query'] = array( |
| 263 | 263 | array( |
| 264 | 264 | 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | ); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if ( ! empty( $atts['cat'] ) ) { |
|
| 271 | + if ( ! empty($atts['cat'])) { |
|
| 272 | 272 | $args['cat'] = $atts['cat']; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | // Get the posts. Note that if a `type` is specified before, then the |
| 276 | 276 | // `tax_query` from the `add_criterias` call isn't added. |
| 277 | - return get_posts( Wordlift_Entity_Service::add_criterias( $args ) ); |
|
| 277 | + return get_posts(Wordlift_Entity_Service::add_criterias($args)); |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
@@ -286,16 +286,16 @@ discard block |
||
| 286 | 286 | * @param array $alphabet An array of letters. |
| 287 | 287 | * @param int $post_id The {@link WP_Post} id. |
| 288 | 288 | */ |
| 289 | - private function add_to_alphabet( &$alphabet, $post_id ) { |
|
| 289 | + private function add_to_alphabet(&$alphabet, $post_id) { |
|
| 290 | 290 | |
| 291 | 291 | // Get the title without accents. |
| 292 | - $title = remove_accents( get_the_title( $post_id ) ); |
|
| 292 | + $title = remove_accents(get_the_title($post_id)); |
|
| 293 | 293 | |
| 294 | 294 | // Get the initial letter. |
| 295 | - $letter = $this->get_first_letter_in_alphabet_or_hash( $alphabet, $title ); |
|
| 295 | + $letter = $this->get_first_letter_in_alphabet_or_hash($alphabet, $title); |
|
| 296 | 296 | |
| 297 | 297 | // Add the post. |
| 298 | - $alphabet[ $letter ][ $post_id ] = $title; |
|
| 298 | + $alphabet[$letter][$post_id] = $title; |
|
| 299 | 299 | |
| 300 | 300 | } |
| 301 | 301 | |
@@ -313,12 +313,12 @@ discard block |
||
| 313 | 313 | * |
| 314 | 314 | * @return string The initial letter or a `#` key. |
| 315 | 315 | */ |
| 316 | - private function get_first_letter_in_alphabet_or_hash( $alphabet, $title ) { |
|
| 316 | + private function get_first_letter_in_alphabet_or_hash($alphabet, $title) { |
|
| 317 | 317 | |
| 318 | 318 | // Need to handle letters which consist of 3 and 2 characters. |
| 319 | - for ( $i = 3; $i > 0; $i -- ) { |
|
| 320 | - $letter = mb_convert_case( mb_substr( $title, 0, $i ), MB_CASE_UPPER ); |
|
| 321 | - if ( isset( $alphabet[ $letter ] ) ) { |
|
| 319 | + for ($i = 3; $i > 0; $i--) { |
|
| 320 | + $letter = mb_convert_case(mb_substr($title, 0, $i), MB_CASE_UPPER); |
|
| 321 | + if (isset($alphabet[$letter])) { |
|
| 322 | 322 | return $letter; |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @return int The incremented vocabulary id. |
| 335 | 335 | */ |
| 336 | 336 | private static function get_and_increment_vocabulary_id() { |
| 337 | - return self::$vocabulary_id ++; |
|
| 337 | + return self::$vocabulary_id++; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | } |
@@ -342,15 +342,15 @@ discard block |
||
| 342 | 342 | /** |
| 343 | 343 | * register_block_type for Gutenberg blocks |
| 344 | 344 | */ |
| 345 | -add_action( 'init', function() { |
|
| 345 | +add_action('init', function() { |
|
| 346 | 346 | // Bail out if the `register_block_type` function isn't available. |
| 347 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 347 | + if ( ! function_exists('register_block_type')) { |
|
| 348 | 348 | return; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | register_block_type('wordlift/vocabulary', array( |
| 352 | 352 | 'editor_script' => 'wordlift-admin-edit-gutenberg', |
| 353 | - 'render_callback' => function($attributes){ |
|
| 353 | + 'render_callback' => function($attributes) { |
|
| 354 | 354 | $attr_code = ''; |
| 355 | 355 | foreach ($attributes as $key => $value) { |
| 356 | 356 | $attr_code .= $key.'="'.$value.'" '; |
@@ -16,126 +16,126 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Related_Entities_Cloud_Shortcode extends Wordlift_Shortcode { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * {@inheritdoc} |
|
| 21 | - */ |
|
| 22 | - const SHORTCODE = 'wl_cloud'; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 26 | - * |
|
| 27 | - * @since 3.15.0 |
|
| 28 | - * @access private |
|
| 29 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 30 | - */ |
|
| 31 | - private $relation_service; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Create a {@link Wordlift_Related_Entities_Cloud_Shortcode} instance. |
|
| 35 | - * |
|
| 36 | - * @since 3.15.0 |
|
| 37 | - * |
|
| 38 | - * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 39 | - */ |
|
| 40 | - public function __construct( $relation_service ) { |
|
| 41 | - parent::__construct(); |
|
| 42 | - |
|
| 43 | - $this->relation_service = $relation_service; |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * {@inheritdoc} |
|
| 49 | - */ |
|
| 50 | - public function render( $atts ) { |
|
| 51 | - |
|
| 52 | - $tags = $this->get_related_entities_tags(); |
|
| 53 | - |
|
| 54 | - // Bail out if there are no associated entities. |
|
| 55 | - if ( empty( $tags ) ) { |
|
| 56 | - return ''; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /* |
|
| 19 | + /** |
|
| 20 | + * {@inheritdoc} |
|
| 21 | + */ |
|
| 22 | + const SHORTCODE = 'wl_cloud'; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 26 | + * |
|
| 27 | + * @since 3.15.0 |
|
| 28 | + * @access private |
|
| 29 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 30 | + */ |
|
| 31 | + private $relation_service; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Create a {@link Wordlift_Related_Entities_Cloud_Shortcode} instance. |
|
| 35 | + * |
|
| 36 | + * @since 3.15.0 |
|
| 37 | + * |
|
| 38 | + * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 39 | + */ |
|
| 40 | + public function __construct( $relation_service ) { |
|
| 41 | + parent::__construct(); |
|
| 42 | + |
|
| 43 | + $this->relation_service = $relation_service; |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * {@inheritdoc} |
|
| 49 | + */ |
|
| 50 | + public function render( $atts ) { |
|
| 51 | + |
|
| 52 | + $tags = $this->get_related_entities_tags(); |
|
| 53 | + |
|
| 54 | + // Bail out if there are no associated entities. |
|
| 55 | + if ( empty( $tags ) ) { |
|
| 56 | + return ''; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /* |
|
| 60 | 60 | * Since the output is use in the widget as well, we need to have the |
| 61 | 61 | * same class as the core tagcloud widget, to easily inherit its styling. |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | - return '<div class="tagcloud wl-related-entities-cloud">' . |
|
| 65 | - wp_generate_tag_cloud( $tags ) . |
|
| 66 | - '</div>'; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Find the related entities to the currently displayed post and |
|
| 71 | - * calculate the "tags" for them as wp_generate_tag_cloud expects to get. |
|
| 72 | - * |
|
| 73 | - * @since 3.11.0 |
|
| 74 | - * |
|
| 75 | - * @return array Array of tags. Empty array in case we re not in a context |
|
| 76 | - * of a post, or it has no related entities. |
|
| 77 | - */ |
|
| 78 | - public function get_related_entities_tags() { |
|
| 79 | - |
|
| 80 | - // Define the supported types list. |
|
| 81 | - $supported_types = Wordlift_Entity_Service::valid_entity_post_types(); |
|
| 82 | - |
|
| 83 | - // Show nothing if not on a post or entity page. |
|
| 84 | - if ( ! is_singular( $supported_types ) ) { |
|
| 85 | - return array(); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - // Get the IDs of entities related to current post. |
|
| 89 | - $related_entities = wl_core_get_related_entity_ids( get_the_ID(), array( 'status' => 'publish' ) ); |
|
| 90 | - |
|
| 91 | - // Bail out if there are no associated entities. |
|
| 92 | - if ( empty( $related_entities ) ) { |
|
| 93 | - return array(); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /* |
|
| 64 | + return '<div class="tagcloud wl-related-entities-cloud">' . |
|
| 65 | + wp_generate_tag_cloud( $tags ) . |
|
| 66 | + '</div>'; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Find the related entities to the currently displayed post and |
|
| 71 | + * calculate the "tags" for them as wp_generate_tag_cloud expects to get. |
|
| 72 | + * |
|
| 73 | + * @since 3.11.0 |
|
| 74 | + * |
|
| 75 | + * @return array Array of tags. Empty array in case we re not in a context |
|
| 76 | + * of a post, or it has no related entities. |
|
| 77 | + */ |
|
| 78 | + public function get_related_entities_tags() { |
|
| 79 | + |
|
| 80 | + // Define the supported types list. |
|
| 81 | + $supported_types = Wordlift_Entity_Service::valid_entity_post_types(); |
|
| 82 | + |
|
| 83 | + // Show nothing if not on a post or entity page. |
|
| 84 | + if ( ! is_singular( $supported_types ) ) { |
|
| 85 | + return array(); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + // Get the IDs of entities related to current post. |
|
| 89 | + $related_entities = wl_core_get_related_entity_ids( get_the_ID(), array( 'status' => 'publish' ) ); |
|
| 90 | + |
|
| 91 | + // Bail out if there are no associated entities. |
|
| 92 | + if ( empty( $related_entities ) ) { |
|
| 93 | + return array(); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /* |
|
| 97 | 97 | * Create an array of "tags" to feed to wp_generate_tag_cloud. |
| 98 | 98 | * Use the number of posts and entities connected to the entity as a weight. |
| 99 | 99 | */ |
| 100 | - $tags = array(); |
|
| 100 | + $tags = array(); |
|
| 101 | 101 | |
| 102 | - foreach ( array_unique( $related_entities ) as $entity_id ) { |
|
| 102 | + foreach ( array_unique( $related_entities ) as $entity_id ) { |
|
| 103 | 103 | |
| 104 | - $connected_entities = count( wl_core_get_related_entity_ids( $entity_id, array( 'status' => 'publish' ) ) ); |
|
| 105 | - $connected_posts = count( $this->relation_service->get_article_subjects( $entity_id, '*', null, 'publish' ) ); |
|
| 104 | + $connected_entities = count( wl_core_get_related_entity_ids( $entity_id, array( 'status' => 'publish' ) ) ); |
|
| 105 | + $connected_posts = count( $this->relation_service->get_article_subjects( $entity_id, '*', null, 'publish' ) ); |
|
| 106 | 106 | |
| 107 | - $tags[] = (object) array( |
|
| 108 | - 'id' => $entity_id, |
|
| 109 | - // Used to give a unique class on the tag. |
|
| 110 | - 'name' => get_the_title( $entity_id ), |
|
| 111 | - // The text of the tag. |
|
| 112 | - 'slug' => get_the_title( $entity_id ), |
|
| 113 | - // Required but not seem to be relevant |
|
| 114 | - 'link' => get_permalink( $entity_id ), |
|
| 115 | - // the url the tag links to. |
|
| 116 | - 'count' => $connected_entities + $connected_posts, |
|
| 117 | - // The weight. |
|
| 118 | - ); |
|
| 107 | + $tags[] = (object) array( |
|
| 108 | + 'id' => $entity_id, |
|
| 109 | + // Used to give a unique class on the tag. |
|
| 110 | + 'name' => get_the_title( $entity_id ), |
|
| 111 | + // The text of the tag. |
|
| 112 | + 'slug' => get_the_title( $entity_id ), |
|
| 113 | + // Required but not seem to be relevant |
|
| 114 | + 'link' => get_permalink( $entity_id ), |
|
| 115 | + // the url the tag links to. |
|
| 116 | + 'count' => $connected_entities + $connected_posts, |
|
| 117 | + // The weight. |
|
| 118 | + ); |
|
| 119 | 119 | |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - return $tags; |
|
| 123 | - } |
|
| 122 | + return $tags; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | } |
| 126 | 126 | /** |
| 127 | 127 | * register_block_type for Gutenberg blocks |
| 128 | 128 | */ |
| 129 | 129 | add_action( 'init', function() { |
| 130 | - // Bail out if the `register_block_type` function isn't available. |
|
| 131 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 132 | - return; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - register_block_type('wordlift/cloud', array( |
|
| 136 | - 'editor_script' => 'wordlift-admin-edit-gutenberg', |
|
| 137 | - 'render_callback' => function($attributes){ |
|
| 138 | - return '[wl_cloud]'; |
|
| 139 | - } |
|
| 140 | - )); |
|
| 130 | + // Bail out if the `register_block_type` function isn't available. |
|
| 131 | + if ( ! function_exists( 'register_block_type' ) ) { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + register_block_type('wordlift/cloud', array( |
|
| 136 | + 'editor_script' => 'wordlift-admin-edit-gutenberg', |
|
| 137 | + 'render_callback' => function($attributes){ |
|
| 138 | + return '[wl_cloud]'; |
|
| 139 | + } |
|
| 140 | + )); |
|
| 141 | 141 | } ); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
| 39 | 39 | */ |
| 40 | - public function __construct( $relation_service ) { |
|
| 40 | + public function __construct($relation_service) { |
|
| 41 | 41 | parent::__construct(); |
| 42 | 42 | |
| 43 | 43 | $this->relation_service = $relation_service; |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * {@inheritdoc} |
| 49 | 49 | */ |
| 50 | - public function render( $atts ) { |
|
| 50 | + public function render($atts) { |
|
| 51 | 51 | |
| 52 | 52 | $tags = $this->get_related_entities_tags(); |
| 53 | 53 | |
| 54 | 54 | // Bail out if there are no associated entities. |
| 55 | - if ( empty( $tags ) ) { |
|
| 55 | + if (empty($tags)) { |
|
| 56 | 56 | return ''; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * same class as the core tagcloud widget, to easily inherit its styling. |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | - return '<div class="tagcloud wl-related-entities-cloud">' . |
|
| 65 | - wp_generate_tag_cloud( $tags ) . |
|
| 64 | + return '<div class="tagcloud wl-related-entities-cloud">'. |
|
| 65 | + wp_generate_tag_cloud($tags). |
|
| 66 | 66 | '</div>'; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | $supported_types = Wordlift_Entity_Service::valid_entity_post_types(); |
| 82 | 82 | |
| 83 | 83 | // Show nothing if not on a post or entity page. |
| 84 | - if ( ! is_singular( $supported_types ) ) { |
|
| 84 | + if ( ! is_singular($supported_types)) { |
|
| 85 | 85 | return array(); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Get the IDs of entities related to current post. |
| 89 | - $related_entities = wl_core_get_related_entity_ids( get_the_ID(), array( 'status' => 'publish' ) ); |
|
| 89 | + $related_entities = wl_core_get_related_entity_ids(get_the_ID(), array('status' => 'publish')); |
|
| 90 | 90 | |
| 91 | 91 | // Bail out if there are no associated entities. |
| 92 | - if ( empty( $related_entities ) ) { |
|
| 92 | + if (empty($related_entities)) { |
|
| 93 | 93 | return array(); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | $tags = array(); |
| 101 | 101 | |
| 102 | - foreach ( array_unique( $related_entities ) as $entity_id ) { |
|
| 102 | + foreach (array_unique($related_entities) as $entity_id) { |
|
| 103 | 103 | |
| 104 | - $connected_entities = count( wl_core_get_related_entity_ids( $entity_id, array( 'status' => 'publish' ) ) ); |
|
| 105 | - $connected_posts = count( $this->relation_service->get_article_subjects( $entity_id, '*', null, 'publish' ) ); |
|
| 104 | + $connected_entities = count(wl_core_get_related_entity_ids($entity_id, array('status' => 'publish'))); |
|
| 105 | + $connected_posts = count($this->relation_service->get_article_subjects($entity_id, '*', null, 'publish')); |
|
| 106 | 106 | |
| 107 | 107 | $tags[] = (object) array( |
| 108 | 108 | 'id' => $entity_id, |
| 109 | 109 | // Used to give a unique class on the tag. |
| 110 | - 'name' => get_the_title( $entity_id ), |
|
| 110 | + 'name' => get_the_title($entity_id), |
|
| 111 | 111 | // The text of the tag. |
| 112 | - 'slug' => get_the_title( $entity_id ), |
|
| 112 | + 'slug' => get_the_title($entity_id), |
|
| 113 | 113 | // Required but not seem to be relevant |
| 114 | - 'link' => get_permalink( $entity_id ), |
|
| 114 | + 'link' => get_permalink($entity_id), |
|
| 115 | 115 | // the url the tag links to. |
| 116 | 116 | 'count' => $connected_entities + $connected_posts, |
| 117 | 117 | // The weight. |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | /** |
| 127 | 127 | * register_block_type for Gutenberg blocks |
| 128 | 128 | */ |
| 129 | -add_action( 'init', function() { |
|
| 129 | +add_action('init', function() { |
|
| 130 | 130 | // Bail out if the `register_block_type` function isn't available. |
| 131 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 131 | + if ( ! function_exists('register_block_type')) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | register_block_type('wordlift/cloud', array( |
| 136 | 136 | 'editor_script' => 'wordlift-admin-edit-gutenberg', |
| 137 | - 'render_callback' => function($attributes){ |
|
| 137 | + 'render_callback' => function($attributes) { |
|
| 138 | 138 | return '[wl_cloud]'; |
| 139 | 139 | } |
| 140 | 140 | )); |
@@ -17,116 +17,116 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Wordlift_ShareThis_Service { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * The ShareThis function which prints the buttons. |
|
| 22 | - * |
|
| 23 | - * @since 3.2.0 |
|
| 24 | - */ |
|
| 25 | - const ADD_WIDGET_FUNCTION_NAME = 'st_add_widget'; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * The Log service. |
|
| 29 | - * |
|
| 30 | - * @since 3.2.0 |
|
| 31 | - * @access private |
|
| 32 | - * @var \Wordlift_Log_Service $log_service The Log service. |
|
| 33 | - */ |
|
| 34 | - private $log_service; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Create an instance of the ShareThis service. |
|
| 38 | - * |
|
| 39 | - * @since 3.2.0 |
|
| 40 | - */ |
|
| 41 | - public function __construct() { |
|
| 42 | - |
|
| 43 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_ShareThis_Service' ); |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Receive <em>the_content</em> filter calls from WordPress. |
|
| 49 | - * |
|
| 50 | - * @since 3.2.0 |
|
| 51 | - * |
|
| 52 | - * @param string $content The post content. |
|
| 53 | - * |
|
| 54 | - * @return string The updated post content. |
|
| 55 | - */ |
|
| 56 | - public function the_content( $content ) { |
|
| 57 | - |
|
| 58 | - return $this->call_sharethis( 'the_content', $content ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Receive <em>the_excerpt</em> filter calls from WordPress. |
|
| 63 | - * |
|
| 64 | - * @since 3.2.0 |
|
| 65 | - * |
|
| 66 | - * @param string $content The post excerpt. |
|
| 67 | - * |
|
| 68 | - * @return string The updated post excerpt. |
|
| 69 | - */ |
|
| 70 | - public function the_excerpt( $content ) { |
|
| 71 | - |
|
| 72 | - return $this->call_sharethis( 'the_excerpt', $content ); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Call the ShareThis function. |
|
| 77 | - * |
|
| 78 | - * @since 3.2.0 |
|
| 79 | - * |
|
| 80 | - * @param string $tag The filter tag. |
|
| 81 | - * @param string $content The post content. |
|
| 82 | - * |
|
| 83 | - * @return string The updated post content. |
|
| 84 | - */ |
|
| 85 | - private function call_sharethis( $tag, $content ) { |
|
| 86 | - |
|
| 87 | - // Get the current post. |
|
| 88 | - global $post; |
|
| 89 | - |
|
| 90 | - // Bail out if the global $post instance isn't set. |
|
| 91 | - if ( !isset( $post ) ) { |
|
| 92 | - return $content; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - // Bail out if the current entity is a post/page since this is already handled by ShareThis. |
|
| 96 | - // |
|
| 97 | - // See https://github.com/insideout10/wordlift-plugin/issues/819 |
|
| 98 | - if ( 'post' === $post->post_type || 'page' === $post->post_type ) { |
|
| 99 | - return $content; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - // If it's not the entity type, return. |
|
| 103 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 104 | - if ( null === $post || ! $entity_service->is_entity( get_the_ID() ) ) { |
|
| 105 | - return $content; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - // If the ShareThis function doesn't exist, return. |
|
| 109 | - if ( ! function_exists( self::ADD_WIDGET_FUNCTION_NAME ) ) { |
|
| 110 | - return $content; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - // If ShareThis hasn't been added as a filter, return. |
|
| 114 | - if ( ! has_filter( $tag, self::ADD_WIDGET_FUNCTION_NAME ) ) { |
|
| 115 | - return $content; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - // Temporary pop the post type and replace it with post. |
|
| 119 | - $post_type = $post->post_type; |
|
| 120 | - $post->post_type = 'post'; |
|
| 121 | - |
|
| 122 | - // Call ShareThis (disguised as a post). |
|
| 123 | - $content = call_user_func_array( self::ADD_WIDGET_FUNCTION_NAME, array( $content ) ); |
|
| 124 | - |
|
| 125 | - // Restore our post type. |
|
| 126 | - $post->post_type = $post_type; |
|
| 127 | - |
|
| 128 | - // Finally return the content. |
|
| 129 | - return $content; |
|
| 130 | - } |
|
| 20 | + /** |
|
| 21 | + * The ShareThis function which prints the buttons. |
|
| 22 | + * |
|
| 23 | + * @since 3.2.0 |
|
| 24 | + */ |
|
| 25 | + const ADD_WIDGET_FUNCTION_NAME = 'st_add_widget'; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * The Log service. |
|
| 29 | + * |
|
| 30 | + * @since 3.2.0 |
|
| 31 | + * @access private |
|
| 32 | + * @var \Wordlift_Log_Service $log_service The Log service. |
|
| 33 | + */ |
|
| 34 | + private $log_service; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Create an instance of the ShareThis service. |
|
| 38 | + * |
|
| 39 | + * @since 3.2.0 |
|
| 40 | + */ |
|
| 41 | + public function __construct() { |
|
| 42 | + |
|
| 43 | + $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_ShareThis_Service' ); |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Receive <em>the_content</em> filter calls from WordPress. |
|
| 49 | + * |
|
| 50 | + * @since 3.2.0 |
|
| 51 | + * |
|
| 52 | + * @param string $content The post content. |
|
| 53 | + * |
|
| 54 | + * @return string The updated post content. |
|
| 55 | + */ |
|
| 56 | + public function the_content( $content ) { |
|
| 57 | + |
|
| 58 | + return $this->call_sharethis( 'the_content', $content ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Receive <em>the_excerpt</em> filter calls from WordPress. |
|
| 63 | + * |
|
| 64 | + * @since 3.2.0 |
|
| 65 | + * |
|
| 66 | + * @param string $content The post excerpt. |
|
| 67 | + * |
|
| 68 | + * @return string The updated post excerpt. |
|
| 69 | + */ |
|
| 70 | + public function the_excerpt( $content ) { |
|
| 71 | + |
|
| 72 | + return $this->call_sharethis( 'the_excerpt', $content ); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Call the ShareThis function. |
|
| 77 | + * |
|
| 78 | + * @since 3.2.0 |
|
| 79 | + * |
|
| 80 | + * @param string $tag The filter tag. |
|
| 81 | + * @param string $content The post content. |
|
| 82 | + * |
|
| 83 | + * @return string The updated post content. |
|
| 84 | + */ |
|
| 85 | + private function call_sharethis( $tag, $content ) { |
|
| 86 | + |
|
| 87 | + // Get the current post. |
|
| 88 | + global $post; |
|
| 89 | + |
|
| 90 | + // Bail out if the global $post instance isn't set. |
|
| 91 | + if ( !isset( $post ) ) { |
|
| 92 | + return $content; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + // Bail out if the current entity is a post/page since this is already handled by ShareThis. |
|
| 96 | + // |
|
| 97 | + // See https://github.com/insideout10/wordlift-plugin/issues/819 |
|
| 98 | + if ( 'post' === $post->post_type || 'page' === $post->post_type ) { |
|
| 99 | + return $content; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + // If it's not the entity type, return. |
|
| 103 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 104 | + if ( null === $post || ! $entity_service->is_entity( get_the_ID() ) ) { |
|
| 105 | + return $content; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + // If the ShareThis function doesn't exist, return. |
|
| 109 | + if ( ! function_exists( self::ADD_WIDGET_FUNCTION_NAME ) ) { |
|
| 110 | + return $content; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + // If ShareThis hasn't been added as a filter, return. |
|
| 114 | + if ( ! has_filter( $tag, self::ADD_WIDGET_FUNCTION_NAME ) ) { |
|
| 115 | + return $content; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + // Temporary pop the post type and replace it with post. |
|
| 119 | + $post_type = $post->post_type; |
|
| 120 | + $post->post_type = 'post'; |
|
| 121 | + |
|
| 122 | + // Call ShareThis (disguised as a post). |
|
| 123 | + $content = call_user_func_array( self::ADD_WIDGET_FUNCTION_NAME, array( $content ) ); |
|
| 124 | + |
|
| 125 | + // Restore our post type. |
|
| 126 | + $post->post_type = $post_type; |
|
| 127 | + |
|
| 128 | + // Finally return the content. |
|
| 129 | + return $content; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function __construct() { |
| 42 | 42 | |
| 43 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_ShareThis_Service' ); |
|
| 43 | + $this->log_service = Wordlift_Log_Service::get_logger('Wordlift_ShareThis_Service'); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return string The updated post content. |
| 55 | 55 | */ |
| 56 | - public function the_content( $content ) { |
|
| 56 | + public function the_content($content) { |
|
| 57 | 57 | |
| 58 | - return $this->call_sharethis( 'the_content', $content ); |
|
| 58 | + return $this->call_sharethis('the_content', $content); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return string The updated post excerpt. |
| 69 | 69 | */ |
| 70 | - public function the_excerpt( $content ) { |
|
| 70 | + public function the_excerpt($content) { |
|
| 71 | 71 | |
| 72 | - return $this->call_sharethis( 'the_excerpt', $content ); |
|
| 72 | + return $this->call_sharethis('the_excerpt', $content); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -82,36 +82,36 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return string The updated post content. |
| 84 | 84 | */ |
| 85 | - private function call_sharethis( $tag, $content ) { |
|
| 85 | + private function call_sharethis($tag, $content) { |
|
| 86 | 86 | |
| 87 | 87 | // Get the current post. |
| 88 | 88 | global $post; |
| 89 | 89 | |
| 90 | 90 | // Bail out if the global $post instance isn't set. |
| 91 | - if ( !isset( $post ) ) { |
|
| 91 | + if ( ! isset($post)) { |
|
| 92 | 92 | return $content; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Bail out if the current entity is a post/page since this is already handled by ShareThis. |
| 96 | 96 | // |
| 97 | 97 | // See https://github.com/insideout10/wordlift-plugin/issues/819 |
| 98 | - if ( 'post' === $post->post_type || 'page' === $post->post_type ) { |
|
| 98 | + if ('post' === $post->post_type || 'page' === $post->post_type) { |
|
| 99 | 99 | return $content; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // If it's not the entity type, return. |
| 103 | 103 | $entity_service = Wordlift_Entity_Service::get_instance(); |
| 104 | - if ( null === $post || ! $entity_service->is_entity( get_the_ID() ) ) { |
|
| 104 | + if (null === $post || ! $entity_service->is_entity(get_the_ID())) { |
|
| 105 | 105 | return $content; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // If the ShareThis function doesn't exist, return. |
| 109 | - if ( ! function_exists( self::ADD_WIDGET_FUNCTION_NAME ) ) { |
|
| 109 | + if ( ! function_exists(self::ADD_WIDGET_FUNCTION_NAME)) { |
|
| 110 | 110 | return $content; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // If ShareThis hasn't been added as a filter, return. |
| 114 | - if ( ! has_filter( $tag, self::ADD_WIDGET_FUNCTION_NAME ) ) { |
|
| 114 | + if ( ! has_filter($tag, self::ADD_WIDGET_FUNCTION_NAME)) { |
|
| 115 | 115 | return $content; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $post->post_type = 'post'; |
| 121 | 121 | |
| 122 | 122 | // Call ShareThis (disguised as a post). |
| 123 | - $content = call_user_func_array( self::ADD_WIDGET_FUNCTION_NAME, array( $content ) ); |
|
| 123 | + $content = call_user_func_array(self::ADD_WIDGET_FUNCTION_NAME, array($content)); |
|
| 124 | 124 | |
| 125 | 125 | // Restore our post type. |
| 126 | 126 | $post->post_type = $post_type; |