@@ -228,7 +228,7 @@ |
||
| 228 | 228 | /** |
| 229 | 229 | * Load FAQ settings to the add/edit post page |
| 230 | 230 | * |
| 231 | - * @param $editor string specifying which text editor needed to be used. |
|
| 231 | + * @param string $editor string specifying which text editor needed to be used. |
|
| 232 | 232 | */ |
| 233 | 233 | private function load_faq_settings( $editor ) { |
| 234 | 234 | // Register the api endpoints. |
@@ -20,121 +20,121 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Wordlift_Admin_Post_Edit_Page { |
| 22 | 22 | |
| 23 | - const GUTENBERG = 'gutenberg'; |
|
| 24 | - const TINY_MCE = 'tiny_mce'; |
|
| 25 | - const FAQ_LIST_BOX_ID = 'wl-faq-meta-list-box'; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * The {@link Wordlift} plugin instance. |
|
| 29 | - * |
|
| 30 | - * @since 3.11.0 |
|
| 31 | - * |
|
| 32 | - * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 33 | - */ |
|
| 34 | - private $plugin; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * A {@link Wordlift_Log_Service} instance. |
|
| 38 | - * |
|
| 39 | - * @since 3.15.4 |
|
| 40 | - * |
|
| 41 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 42 | - */ |
|
| 43 | - private $log; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Create the {@link Wordlift_Admin_Post_Edit_Page} instance. |
|
| 47 | - * |
|
| 48 | - * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 49 | - * |
|
| 50 | - * @since 3.11.0 |
|
| 51 | - * |
|
| 52 | - */ |
|
| 53 | - function __construct( $plugin ) { |
|
| 54 | - |
|
| 55 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 56 | - |
|
| 57 | - add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_scripts_gutenberg', ) ); |
|
| 58 | - |
|
| 59 | - // Bail out if we're in the UX Builder editor. |
|
| 60 | - if ( $this->is_ux_builder_editor() ) { |
|
| 61 | - $this->log->info( 'WordLift will not show, since we are in UX Builder editor.' ); |
|
| 62 | - |
|
| 63 | - return; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - // Define the callbacks. |
|
| 67 | - $callback = array( $this, 'enqueue_scripts', ); |
|
| 68 | - |
|
| 69 | - // Set a hook to enqueue scripts only when the edit page is displayed. |
|
| 70 | - add_action( 'admin_print_scripts-post.php', $callback ); |
|
| 71 | - add_action( 'admin_print_scripts-post-new.php', $callback ); |
|
| 72 | - |
|
| 73 | - $this->plugin = $plugin; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Check whether the current post opens with G'berg or not. |
|
| 78 | - * |
|
| 79 | - * @return bool True if G'berg is used otherwise false. |
|
| 80 | - * @since 3.22.3 |
|
| 81 | - */ |
|
| 82 | - function is_gutenberg_page() { |
|
| 83 | - if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) { |
|
| 84 | - // The Gutenberg plugin is on. |
|
| 85 | - return true; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $current_screen = get_current_screen(); |
|
| 89 | - if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) { |
|
| 90 | - // Gutenberg page on 5+. |
|
| 91 | - return true; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - return false; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Check if we're in UX builder. |
|
| 99 | - * |
|
| 100 | - * @see https://github.com/insideout10/wordlift-plugin/issues/691 |
|
| 101 | - * |
|
| 102 | - * @since 3.15.4 |
|
| 103 | - * |
|
| 104 | - * @return bool True if we're in UX builder, otherwise false. |
|
| 105 | - */ |
|
| 106 | - private function is_ux_builder_editor() { |
|
| 107 | - |
|
| 108 | - return function_exists( 'ux_builder_is_editor' ) |
|
| 109 | - && ux_builder_is_editor(); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Enqueue scripts and styles for the edit page. |
|
| 114 | - * |
|
| 115 | - * @since 3.11.0 |
|
| 116 | - */ |
|
| 117 | - public function enqueue_scripts() { |
|
| 118 | - |
|
| 119 | - // Bail out if this is G'berg. |
|
| 120 | - if ( $this->is_gutenberg_page() ) { |
|
| 121 | - return; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - // Dequeue potentially conflicting ontrapages angular scripts which any *are not* used on the edit screen. |
|
| 125 | - // |
|
| 126 | - // @see https://github.com/insideout10/wordlift-plugin/issues/832 |
|
| 127 | - wp_dequeue_script( 'ontrapagesAngular' ); |
|
| 128 | - wp_dequeue_script( 'ontrapagesApp' ); |
|
| 129 | - wp_dequeue_script( 'ontrapagesController' ); |
|
| 130 | - |
|
| 131 | - // If Gutenberg is enabled for the post, do not load the legacy edit.js. |
|
| 132 | - if ( function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( get_post() ) ) { |
|
| 133 | - return; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /* |
|
| 23 | + const GUTENBERG = 'gutenberg'; |
|
| 24 | + const TINY_MCE = 'tiny_mce'; |
|
| 25 | + const FAQ_LIST_BOX_ID = 'wl-faq-meta-list-box'; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * The {@link Wordlift} plugin instance. |
|
| 29 | + * |
|
| 30 | + * @since 3.11.0 |
|
| 31 | + * |
|
| 32 | + * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 33 | + */ |
|
| 34 | + private $plugin; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * A {@link Wordlift_Log_Service} instance. |
|
| 38 | + * |
|
| 39 | + * @since 3.15.4 |
|
| 40 | + * |
|
| 41 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 42 | + */ |
|
| 43 | + private $log; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Create the {@link Wordlift_Admin_Post_Edit_Page} instance. |
|
| 47 | + * |
|
| 48 | + * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
| 49 | + * |
|
| 50 | + * @since 3.11.0 |
|
| 51 | + * |
|
| 52 | + */ |
|
| 53 | + function __construct( $plugin ) { |
|
| 54 | + |
|
| 55 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 56 | + |
|
| 57 | + add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_scripts_gutenberg', ) ); |
|
| 58 | + |
|
| 59 | + // Bail out if we're in the UX Builder editor. |
|
| 60 | + if ( $this->is_ux_builder_editor() ) { |
|
| 61 | + $this->log->info( 'WordLift will not show, since we are in UX Builder editor.' ); |
|
| 62 | + |
|
| 63 | + return; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + // Define the callbacks. |
|
| 67 | + $callback = array( $this, 'enqueue_scripts', ); |
|
| 68 | + |
|
| 69 | + // Set a hook to enqueue scripts only when the edit page is displayed. |
|
| 70 | + add_action( 'admin_print_scripts-post.php', $callback ); |
|
| 71 | + add_action( 'admin_print_scripts-post-new.php', $callback ); |
|
| 72 | + |
|
| 73 | + $this->plugin = $plugin; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Check whether the current post opens with G'berg or not. |
|
| 78 | + * |
|
| 79 | + * @return bool True if G'berg is used otherwise false. |
|
| 80 | + * @since 3.22.3 |
|
| 81 | + */ |
|
| 82 | + function is_gutenberg_page() { |
|
| 83 | + if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) { |
|
| 84 | + // The Gutenberg plugin is on. |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $current_screen = get_current_screen(); |
|
| 89 | + if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) { |
|
| 90 | + // Gutenberg page on 5+. |
|
| 91 | + return true; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Check if we're in UX builder. |
|
| 99 | + * |
|
| 100 | + * @see https://github.com/insideout10/wordlift-plugin/issues/691 |
|
| 101 | + * |
|
| 102 | + * @since 3.15.4 |
|
| 103 | + * |
|
| 104 | + * @return bool True if we're in UX builder, otherwise false. |
|
| 105 | + */ |
|
| 106 | + private function is_ux_builder_editor() { |
|
| 107 | + |
|
| 108 | + return function_exists( 'ux_builder_is_editor' ) |
|
| 109 | + && ux_builder_is_editor(); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Enqueue scripts and styles for the edit page. |
|
| 114 | + * |
|
| 115 | + * @since 3.11.0 |
|
| 116 | + */ |
|
| 117 | + public function enqueue_scripts() { |
|
| 118 | + |
|
| 119 | + // Bail out if this is G'berg. |
|
| 120 | + if ( $this->is_gutenberg_page() ) { |
|
| 121 | + return; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + // Dequeue potentially conflicting ontrapages angular scripts which any *are not* used on the edit screen. |
|
| 125 | + // |
|
| 126 | + // @see https://github.com/insideout10/wordlift-plugin/issues/832 |
|
| 127 | + wp_dequeue_script( 'ontrapagesAngular' ); |
|
| 128 | + wp_dequeue_script( 'ontrapagesApp' ); |
|
| 129 | + wp_dequeue_script( 'ontrapagesController' ); |
|
| 130 | + |
|
| 131 | + // If Gutenberg is enabled for the post, do not load the legacy edit.js. |
|
| 132 | + if ( function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( get_post() ) ) { |
|
| 133 | + return; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /* |
|
| 138 | 138 | * Enqueue the edit screen JavaScript. The `wordlift-admin.bundle.js` file |
| 139 | 139 | * is scheduled to replace the older `wordlift-admin.min.js` once client-side |
| 140 | 140 | * code is properly refactored. |
@@ -143,163 +143,163 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @since 3.20.0 edit.js has been migrated to the new webpack configuration. |
| 145 | 145 | */ |
| 146 | - $script_name = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/edit'; |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * Scripts_Helper introduced. |
|
| 150 | - * |
|
| 151 | - * @since 3.25.0 Scripts are loaded using script helper to ensure WP 4.4 compatibiility. |
|
| 152 | - * @since 3.25.1 The handle is used to hook the wp_localize_script for the _wlEntityTypes global object. |
|
| 153 | - */ |
|
| 154 | - Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 155 | - 'wl-classic-editor', |
|
| 156 | - $script_name, |
|
| 157 | - array( |
|
| 158 | - $this->plugin->get_plugin_name(), |
|
| 159 | - 'jquery', |
|
| 160 | - // Require wp.ajax. |
|
| 161 | - 'wp-util', |
|
| 162 | - // @@todo: provide the following dependencies when we're in WP < 5.0 (i.e. when these dependencies aren't already defined). |
|
| 163 | - 'react', |
|
| 164 | - 'react-dom', |
|
| 165 | - 'wp-element', |
|
| 166 | - 'wp-polyfill', |
|
| 167 | - /* |
|
| 146 | + $script_name = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/edit'; |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * Scripts_Helper introduced. |
|
| 150 | + * |
|
| 151 | + * @since 3.25.0 Scripts are loaded using script helper to ensure WP 4.4 compatibiility. |
|
| 152 | + * @since 3.25.1 The handle is used to hook the wp_localize_script for the _wlEntityTypes global object. |
|
| 153 | + */ |
|
| 154 | + Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 155 | + 'wl-classic-editor', |
|
| 156 | + $script_name, |
|
| 157 | + array( |
|
| 158 | + $this->plugin->get_plugin_name(), |
|
| 159 | + 'jquery', |
|
| 160 | + // Require wp.ajax. |
|
| 161 | + 'wp-util', |
|
| 162 | + // @@todo: provide the following dependencies when we're in WP < 5.0 (i.e. when these dependencies aren't already defined). |
|
| 163 | + 'react', |
|
| 164 | + 'react-dom', |
|
| 165 | + 'wp-element', |
|
| 166 | + 'wp-polyfill', |
|
| 167 | + /* |
|
| 168 | 168 | * Angular isn't loaded anymore remotely, but it is loaded within wordlift-reloaded.js. |
| 169 | 169 | * |
| 170 | 170 | * See https://github.com/insideout10/wordlift-plugin/issues/865. |
| 171 | 171 | * |
| 172 | 172 | * @since 3.19.6 |
| 173 | 173 | */ |
| 174 | - // // Require Angular. |
|
| 175 | - // 'wl-angular', |
|
| 176 | - // 'wl-angular-geolocation', |
|
| 177 | - // 'wl-angular-touch', |
|
| 178 | - // 'wl-angular-animate', |
|
| 179 | - /** |
|
| 180 | - * We need the `wp.hooks` global to allow the edit.js script to send actions. |
|
| 181 | - * |
|
| 182 | - * @since 3.23.0 |
|
| 183 | - */ |
|
| 184 | - 'wp-hooks', |
|
| 185 | - ) |
|
| 186 | - ); |
|
| 187 | - |
|
| 188 | - wp_enqueue_style( 'wl-classic-editor', "$script_name.css", array(), $this->plugin->get_version() ); |
|
| 189 | - $this->load_faq_scripts_and_styles(); |
|
| 190 | - $this->load_faq_settings( self::TINY_MCE ); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Enqueue the scripts and styles needed for FAQ |
|
| 195 | - */ |
|
| 196 | - private function load_faq_scripts_and_styles() { |
|
| 197 | - wp_enqueue_style( |
|
| 198 | - 'faq-metabox-style', |
|
| 199 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/faq.css', |
|
| 200 | - array() |
|
| 201 | - ); |
|
| 202 | - Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 203 | - 'faq-metabox-script', |
|
| 204 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/faq', |
|
| 205 | - array( 'wp-polyfill' ), |
|
| 206 | - true |
|
| 207 | - ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * Get FAQ settings array |
|
| 212 | - * |
|
| 213 | - * @return array |
|
| 214 | - */ |
|
| 215 | - public function get_faq_settings() { |
|
| 216 | - return array( |
|
| 217 | - 'restUrl' => get_rest_url( null, WL_REST_ROUTE_DEFAULT_NAMESPACE . '/faq' ), |
|
| 218 | - 'listBoxId' => self::FAQ_LIST_BOX_ID, |
|
| 219 | - 'addQuestionText' => __( 'Add', 'wordlift' ), |
|
| 220 | - 'nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 221 | - 'postId' => get_the_ID(), |
|
| 222 | - // Translation for warning, error message. |
|
| 223 | - 'invalidTagMessage' => sprintf( __( 'Invalid tags %s is present in answer' ), "{INVALID_TAGS}" ), |
|
| 224 | - 'invalidWordCountMessage' => sprintf( __( 'Answer word count must not exceed %s words' ), "{ANSWER_WORD_COUNT_WARNING_LIMIT}" ) |
|
| 225 | - ); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * Load FAQ settings to the add/edit post page |
|
| 230 | - * |
|
| 231 | - * @param $editor string specifying which text editor needed to be used. |
|
| 232 | - */ |
|
| 233 | - private function load_faq_settings( $editor ) { |
|
| 234 | - // Register the api endpoints. |
|
| 235 | - // Enqueue the FAQ style |
|
| 236 | - if ( $editor === self::GUTENBERG ) { |
|
| 237 | - Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 238 | - 'faq-gutenberg-plugin', |
|
| 239 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg-faq-plugin', |
|
| 240 | - array( 'wp-polyfill' ), |
|
| 241 | - true |
|
| 242 | - ); |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - wp_localize_script( 'faq-metabox-script', '_wlFaqSettings', $this->get_faq_settings() ); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * Enqueue scripts and styles for the gutenberg edit page. |
|
| 250 | - * |
|
| 251 | - * @since 3.21.0 |
|
| 252 | - */ |
|
| 253 | - public function enqueue_scripts_gutenberg() { |
|
| 254 | - // Load FAQ settings. |
|
| 255 | - $this->load_faq_scripts_and_styles(); |
|
| 256 | - $this->load_faq_settings( self::GUTENBERG ); |
|
| 257 | - |
|
| 258 | - wp_register_script( |
|
| 259 | - 'wl-block-editor', |
|
| 260 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/block-editor.js', |
|
| 261 | - array( |
|
| 262 | - 'react', |
|
| 263 | - 'wordlift', |
|
| 264 | - 'wp-hooks', |
|
| 265 | - 'wp-data', |
|
| 266 | - 'wp-rich-text', |
|
| 267 | - 'wp-blocks', |
|
| 268 | - 'wp-plugins', |
|
| 269 | - 'wp-edit-post', |
|
| 270 | - ), |
|
| 271 | - $this->plugin->get_version() |
|
| 272 | - ); |
|
| 273 | - wp_localize_script( 'wl-block-editor', '_wlBlockEditorSettings', array( |
|
| 274 | - 'root' => esc_url_raw( rest_url() ), |
|
| 275 | - 'nonce' => wp_create_nonce( 'wp_rest' ) |
|
| 276 | - ) ); |
|
| 277 | - |
|
| 278 | - /* |
|
| 174 | + // // Require Angular. |
|
| 175 | + // 'wl-angular', |
|
| 176 | + // 'wl-angular-geolocation', |
|
| 177 | + // 'wl-angular-touch', |
|
| 178 | + // 'wl-angular-animate', |
|
| 179 | + /** |
|
| 180 | + * We need the `wp.hooks` global to allow the edit.js script to send actions. |
|
| 181 | + * |
|
| 182 | + * @since 3.23.0 |
|
| 183 | + */ |
|
| 184 | + 'wp-hooks', |
|
| 185 | + ) |
|
| 186 | + ); |
|
| 187 | + |
|
| 188 | + wp_enqueue_style( 'wl-classic-editor', "$script_name.css", array(), $this->plugin->get_version() ); |
|
| 189 | + $this->load_faq_scripts_and_styles(); |
|
| 190 | + $this->load_faq_settings( self::TINY_MCE ); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Enqueue the scripts and styles needed for FAQ |
|
| 195 | + */ |
|
| 196 | + private function load_faq_scripts_and_styles() { |
|
| 197 | + wp_enqueue_style( |
|
| 198 | + 'faq-metabox-style', |
|
| 199 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/faq.css', |
|
| 200 | + array() |
|
| 201 | + ); |
|
| 202 | + Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 203 | + 'faq-metabox-script', |
|
| 204 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/faq', |
|
| 205 | + array( 'wp-polyfill' ), |
|
| 206 | + true |
|
| 207 | + ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * Get FAQ settings array |
|
| 212 | + * |
|
| 213 | + * @return array |
|
| 214 | + */ |
|
| 215 | + public function get_faq_settings() { |
|
| 216 | + return array( |
|
| 217 | + 'restUrl' => get_rest_url( null, WL_REST_ROUTE_DEFAULT_NAMESPACE . '/faq' ), |
|
| 218 | + 'listBoxId' => self::FAQ_LIST_BOX_ID, |
|
| 219 | + 'addQuestionText' => __( 'Add', 'wordlift' ), |
|
| 220 | + 'nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 221 | + 'postId' => get_the_ID(), |
|
| 222 | + // Translation for warning, error message. |
|
| 223 | + 'invalidTagMessage' => sprintf( __( 'Invalid tags %s is present in answer' ), "{INVALID_TAGS}" ), |
|
| 224 | + 'invalidWordCountMessage' => sprintf( __( 'Answer word count must not exceed %s words' ), "{ANSWER_WORD_COUNT_WARNING_LIMIT}" ) |
|
| 225 | + ); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * Load FAQ settings to the add/edit post page |
|
| 230 | + * |
|
| 231 | + * @param $editor string specifying which text editor needed to be used. |
|
| 232 | + */ |
|
| 233 | + private function load_faq_settings( $editor ) { |
|
| 234 | + // Register the api endpoints. |
|
| 235 | + // Enqueue the FAQ style |
|
| 236 | + if ( $editor === self::GUTENBERG ) { |
|
| 237 | + Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 238 | + 'faq-gutenberg-plugin', |
|
| 239 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg-faq-plugin', |
|
| 240 | + array( 'wp-polyfill' ), |
|
| 241 | + true |
|
| 242 | + ); |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + wp_localize_script( 'faq-metabox-script', '_wlFaqSettings', $this->get_faq_settings() ); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * Enqueue scripts and styles for the gutenberg edit page. |
|
| 250 | + * |
|
| 251 | + * @since 3.21.0 |
|
| 252 | + */ |
|
| 253 | + public function enqueue_scripts_gutenberg() { |
|
| 254 | + // Load FAQ settings. |
|
| 255 | + $this->load_faq_scripts_and_styles(); |
|
| 256 | + $this->load_faq_settings( self::GUTENBERG ); |
|
| 257 | + |
|
| 258 | + wp_register_script( |
|
| 259 | + 'wl-block-editor', |
|
| 260 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/block-editor.js', |
|
| 261 | + array( |
|
| 262 | + 'react', |
|
| 263 | + 'wordlift', |
|
| 264 | + 'wp-hooks', |
|
| 265 | + 'wp-data', |
|
| 266 | + 'wp-rich-text', |
|
| 267 | + 'wp-blocks', |
|
| 268 | + 'wp-plugins', |
|
| 269 | + 'wp-edit-post', |
|
| 270 | + ), |
|
| 271 | + $this->plugin->get_version() |
|
| 272 | + ); |
|
| 273 | + wp_localize_script( 'wl-block-editor', '_wlBlockEditorSettings', array( |
|
| 274 | + 'root' => esc_url_raw( rest_url() ), |
|
| 275 | + 'nonce' => wp_create_nonce( 'wp_rest' ) |
|
| 276 | + ) ); |
|
| 277 | + |
|
| 278 | + /* |
|
| 279 | 279 | * @since 3.25.1 The hook is used by the wp_localize_script to register the _wlEntityTypes global object. |
| 280 | 280 | */ |
| 281 | - wp_enqueue_style( |
|
| 282 | - 'wl-block-editor', |
|
| 283 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/block-editor.css', |
|
| 284 | - array(), |
|
| 285 | - $this->plugin->get_version() |
|
| 286 | - ); |
|
| 287 | - |
|
| 288 | - wp_enqueue_script( |
|
| 289 | - 'wl-autocomplete-select', |
|
| 290 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/autocomplete-select.js', |
|
| 291 | - array(), |
|
| 292 | - $this->plugin->get_version(), |
|
| 293 | - true |
|
| 294 | - ); |
|
| 295 | - |
|
| 296 | - wp_enqueue_style( |
|
| 297 | - 'wl-autocomplete-select', |
|
| 298 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/autocomplete-select.css', |
|
| 299 | - array(), |
|
| 300 | - $this->plugin->get_version() |
|
| 301 | - ); |
|
| 302 | - |
|
| 303 | - } |
|
| 281 | + wp_enqueue_style( |
|
| 282 | + 'wl-block-editor', |
|
| 283 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/block-editor.css', |
|
| 284 | + array(), |
|
| 285 | + $this->plugin->get_version() |
|
| 286 | + ); |
|
| 287 | + |
|
| 288 | + wp_enqueue_script( |
|
| 289 | + 'wl-autocomplete-select', |
|
| 290 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/autocomplete-select.js', |
|
| 291 | + array(), |
|
| 292 | + $this->plugin->get_version(), |
|
| 293 | + true |
|
| 294 | + ); |
|
| 295 | + |
|
| 296 | + wp_enqueue_style( |
|
| 297 | + 'wl-autocomplete-select', |
|
| 298 | + plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/autocomplete-select.css', |
|
| 299 | + array(), |
|
| 300 | + $this->plugin->get_version() |
|
| 301 | + ); |
|
| 302 | + |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | 305 | } |
@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | * @since 3.11.0 |
| 51 | 51 | * |
| 52 | 52 | */ |
| 53 | - function __construct( $plugin ) { |
|
| 53 | + function __construct($plugin) { |
|
| 54 | 54 | |
| 55 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 55 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 56 | 56 | |
| 57 | - add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_scripts_gutenberg', ) ); |
|
| 57 | + add_action('enqueue_block_editor_assets', array($this, 'enqueue_scripts_gutenberg',)); |
|
| 58 | 58 | |
| 59 | 59 | // Bail out if we're in the UX Builder editor. |
| 60 | - if ( $this->is_ux_builder_editor() ) { |
|
| 61 | - $this->log->info( 'WordLift will not show, since we are in UX Builder editor.' ); |
|
| 60 | + if ($this->is_ux_builder_editor()) { |
|
| 61 | + $this->log->info('WordLift will not show, since we are in UX Builder editor.'); |
|
| 62 | 62 | |
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Define the callbacks. |
| 67 | - $callback = array( $this, 'enqueue_scripts', ); |
|
| 67 | + $callback = array($this, 'enqueue_scripts',); |
|
| 68 | 68 | |
| 69 | 69 | // Set a hook to enqueue scripts only when the edit page is displayed. |
| 70 | - add_action( 'admin_print_scripts-post.php', $callback ); |
|
| 71 | - add_action( 'admin_print_scripts-post-new.php', $callback ); |
|
| 70 | + add_action('admin_print_scripts-post.php', $callback); |
|
| 71 | + add_action('admin_print_scripts-post-new.php', $callback); |
|
| 72 | 72 | |
| 73 | 73 | $this->plugin = $plugin; |
| 74 | 74 | } |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | * @since 3.22.3 |
| 81 | 81 | */ |
| 82 | 82 | function is_gutenberg_page() { |
| 83 | - if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) { |
|
| 83 | + if (function_exists('is_gutenberg_page') && is_gutenberg_page()) { |
|
| 84 | 84 | // The Gutenberg plugin is on. |
| 85 | 85 | return true; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $current_screen = get_current_screen(); |
| 89 | - if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) { |
|
| 89 | + if (method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor()) { |
|
| 90 | 90 | // Gutenberg page on 5+. |
| 91 | 91 | return true; |
| 92 | 92 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | private function is_ux_builder_editor() { |
| 107 | 107 | |
| 108 | - return function_exists( 'ux_builder_is_editor' ) |
|
| 108 | + return function_exists('ux_builder_is_editor') |
|
| 109 | 109 | && ux_builder_is_editor(); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -117,19 +117,19 @@ discard block |
||
| 117 | 117 | public function enqueue_scripts() { |
| 118 | 118 | |
| 119 | 119 | // Bail out if this is G'berg. |
| 120 | - if ( $this->is_gutenberg_page() ) { |
|
| 120 | + if ($this->is_gutenberg_page()) { |
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Dequeue potentially conflicting ontrapages angular scripts which any *are not* used on the edit screen. |
| 125 | 125 | // |
| 126 | 126 | // @see https://github.com/insideout10/wordlift-plugin/issues/832 |
| 127 | - wp_dequeue_script( 'ontrapagesAngular' ); |
|
| 128 | - wp_dequeue_script( 'ontrapagesApp' ); |
|
| 129 | - wp_dequeue_script( 'ontrapagesController' ); |
|
| 127 | + wp_dequeue_script('ontrapagesAngular'); |
|
| 128 | + wp_dequeue_script('ontrapagesApp'); |
|
| 129 | + wp_dequeue_script('ontrapagesController'); |
|
| 130 | 130 | |
| 131 | 131 | // If Gutenberg is enabled for the post, do not load the legacy edit.js. |
| 132 | - if ( function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( get_post() ) ) { |
|
| 132 | + if (function_exists('use_block_editor_for_post') && use_block_editor_for_post(get_post())) { |
|
| 133 | 133 | return; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @since 3.20.0 edit.js has been migrated to the new webpack configuration. |
| 145 | 145 | */ |
| 146 | - $script_name = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/edit'; |
|
| 146 | + $script_name = plugin_dir_url(dirname(__FILE__)).'js/dist/edit'; |
|
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * Scripts_Helper introduced. |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | ) |
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | - wp_enqueue_style( 'wl-classic-editor', "$script_name.css", array(), $this->plugin->get_version() ); |
|
| 188 | + wp_enqueue_style('wl-classic-editor', "$script_name.css", array(), $this->plugin->get_version()); |
|
| 189 | 189 | $this->load_faq_scripts_and_styles(); |
| 190 | - $this->load_faq_settings( self::TINY_MCE ); |
|
| 190 | + $this->load_faq_settings(self::TINY_MCE); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | private function load_faq_scripts_and_styles() { |
| 197 | 197 | wp_enqueue_style( |
| 198 | 198 | 'faq-metabox-style', |
| 199 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/faq.css', |
|
| 199 | + plugin_dir_url(dirname(__FILE__)).'js/dist/faq.css', |
|
| 200 | 200 | array() |
| 201 | 201 | ); |
| 202 | 202 | Scripts_Helper::enqueue_based_on_wordpress_version( |
| 203 | 203 | 'faq-metabox-script', |
| 204 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/faq', |
|
| 205 | - array( 'wp-polyfill' ), |
|
| 204 | + plugin_dir_url(dirname(__FILE__)).'js/dist/faq', |
|
| 205 | + array('wp-polyfill'), |
|
| 206 | 206 | true |
| 207 | 207 | ); |
| 208 | 208 | } |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function get_faq_settings() { |
| 216 | 216 | return array( |
| 217 | - 'restUrl' => get_rest_url( null, WL_REST_ROUTE_DEFAULT_NAMESPACE . '/faq' ), |
|
| 217 | + 'restUrl' => get_rest_url(null, WL_REST_ROUTE_DEFAULT_NAMESPACE.'/faq'), |
|
| 218 | 218 | 'listBoxId' => self::FAQ_LIST_BOX_ID, |
| 219 | - 'addQuestionText' => __( 'Add', 'wordlift' ), |
|
| 220 | - 'nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 219 | + 'addQuestionText' => __('Add', 'wordlift'), |
|
| 220 | + 'nonce' => wp_create_nonce('wp_rest'), |
|
| 221 | 221 | 'postId' => get_the_ID(), |
| 222 | 222 | // Translation for warning, error message. |
| 223 | - 'invalidTagMessage' => sprintf( __( 'Invalid tags %s is present in answer' ), "{INVALID_TAGS}" ), |
|
| 224 | - 'invalidWordCountMessage' => sprintf( __( 'Answer word count must not exceed %s words' ), "{ANSWER_WORD_COUNT_WARNING_LIMIT}" ) |
|
| 223 | + 'invalidTagMessage' => sprintf(__('Invalid tags %s is present in answer'), "{INVALID_TAGS}"), |
|
| 224 | + 'invalidWordCountMessage' => sprintf(__('Answer word count must not exceed %s words'), "{ANSWER_WORD_COUNT_WARNING_LIMIT}") |
|
| 225 | 225 | ); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -230,19 +230,19 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @param $editor string specifying which text editor needed to be used. |
| 232 | 232 | */ |
| 233 | - private function load_faq_settings( $editor ) { |
|
| 233 | + private function load_faq_settings($editor) { |
|
| 234 | 234 | // Register the api endpoints. |
| 235 | 235 | // Enqueue the FAQ style |
| 236 | - if ( $editor === self::GUTENBERG ) { |
|
| 236 | + if ($editor === self::GUTENBERG) { |
|
| 237 | 237 | Scripts_Helper::enqueue_based_on_wordpress_version( |
| 238 | 238 | 'faq-gutenberg-plugin', |
| 239 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/gutenberg-faq-plugin', |
|
| 240 | - array( 'wp-polyfill' ), |
|
| 239 | + plugin_dir_url(dirname(__FILE__)).'js/dist/gutenberg-faq-plugin', |
|
| 240 | + array('wp-polyfill'), |
|
| 241 | 241 | true |
| 242 | 242 | ); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - wp_localize_script( 'faq-metabox-script', '_wlFaqSettings', $this->get_faq_settings() ); |
|
| 245 | + wp_localize_script('faq-metabox-script', '_wlFaqSettings', $this->get_faq_settings()); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | public function enqueue_scripts_gutenberg() { |
| 254 | 254 | // Load FAQ settings. |
| 255 | 255 | $this->load_faq_scripts_and_styles(); |
| 256 | - $this->load_faq_settings( self::GUTENBERG ); |
|
| 256 | + $this->load_faq_settings(self::GUTENBERG); |
|
| 257 | 257 | |
| 258 | 258 | wp_register_script( |
| 259 | 259 | 'wl-block-editor', |
| 260 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/block-editor.js', |
|
| 260 | + plugin_dir_url(dirname(__FILE__)).'js/dist/block-editor.js', |
|
| 261 | 261 | array( |
| 262 | 262 | 'react', |
| 263 | 263 | 'wordlift', |
@@ -270,24 +270,24 @@ discard block |
||
| 270 | 270 | ), |
| 271 | 271 | $this->plugin->get_version() |
| 272 | 272 | ); |
| 273 | - wp_localize_script( 'wl-block-editor', '_wlBlockEditorSettings', array( |
|
| 274 | - 'root' => esc_url_raw( rest_url() ), |
|
| 275 | - 'nonce' => wp_create_nonce( 'wp_rest' ) |
|
| 276 | - ) ); |
|
| 273 | + wp_localize_script('wl-block-editor', '_wlBlockEditorSettings', array( |
|
| 274 | + 'root' => esc_url_raw(rest_url()), |
|
| 275 | + 'nonce' => wp_create_nonce('wp_rest') |
|
| 276 | + )); |
|
| 277 | 277 | |
| 278 | 278 | /* |
| 279 | 279 | * @since 3.25.1 The hook is used by the wp_localize_script to register the _wlEntityTypes global object. |
| 280 | 280 | */ |
| 281 | 281 | wp_enqueue_style( |
| 282 | 282 | 'wl-block-editor', |
| 283 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/block-editor.css', |
|
| 283 | + plugin_dir_url(dirname(__FILE__)).'js/dist/block-editor.css', |
|
| 284 | 284 | array(), |
| 285 | 285 | $this->plugin->get_version() |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | 288 | wp_enqueue_script( |
| 289 | 289 | 'wl-autocomplete-select', |
| 290 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/autocomplete-select.js', |
|
| 290 | + plugin_dir_url(dirname(__FILE__)).'js/dist/autocomplete-select.js', |
|
| 291 | 291 | array(), |
| 292 | 292 | $this->plugin->get_version(), |
| 293 | 293 | true |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | wp_enqueue_style( |
| 297 | 297 | 'wl-autocomplete-select', |
| 298 | - plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/autocomplete-select.css', |
|
| 298 | + plugin_dir_url(dirname(__FILE__)).'js/dist/autocomplete-select.css', |
|
| 299 | 299 | array(), |
| 300 | 300 | $this->plugin->get_version() |
| 301 | 301 | ); |
@@ -18,321 +18,321 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Content_Filter_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The pattern to find entities in text. |
|
| 23 | - * |
|
| 24 | - * @since 3.8.0 |
|
| 25 | - */ |
|
| 26 | - const PATTERN = '/<(\\w+)[^<]*class="([^"]*)"\\sitemid=\"([^"]+)\"[^>]*>([^<]*)<\\/\\1>/i'; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * This pattern is used to find all the questions tag. |
|
| 30 | - * |
|
| 31 | - * @since 3.26.0 |
|
| 32 | - */ |
|
| 33 | - const FAQ_QUESTION_PATTERN = '/<span.*class="wl-faq--question"\s?>(.*)<\/span>/'; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * This pattern is used to find all the answers tag. |
|
| 37 | - * |
|
| 38 | - * @since 3.26.0 |
|
| 39 | - */ |
|
| 40 | - const FAQ_ANSWER_PATTERN = '/<span.*class="wl-faq--answer"\s?>(.*)<\/span>/'; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * A {@link Wordlift_Entity_Service} instance. |
|
| 44 | - * |
|
| 45 | - * @since 3.8.0 |
|
| 46 | - * @access private |
|
| 47 | - * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 48 | - */ |
|
| 49 | - private $entity_service; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * The {@link Wordlift_Configuration_Service} instance. |
|
| 53 | - * |
|
| 54 | - * @since 3.13.0 |
|
| 55 | - * @access private |
|
| 56 | - * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 57 | - */ |
|
| 58 | - private $configuration_service; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * The `link by default` setting. |
|
| 62 | - * |
|
| 63 | - * @since 3.13.0 |
|
| 64 | - * @access private |
|
| 65 | - * @var bool True if link by default is enabled otherwise false. |
|
| 66 | - */ |
|
| 67 | - private $is_link_by_default; |
|
| 68 | - |
|
| 69 | - private $entity_post_ids_linked_from_post_content = array(); |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 73 | - * |
|
| 74 | - * @since 3.16.3 |
|
| 75 | - * @access private |
|
| 76 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 77 | - */ |
|
| 78 | - private $entity_uri_service; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * A {@link Wordlift_Log_Service} instance. |
|
| 82 | - * |
|
| 83 | - * @since 3.16.0 |
|
| 84 | - * |
|
| 85 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 86 | - */ |
|
| 87 | - private $log; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * The {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 91 | - * |
|
| 92 | - * @since 3.14.2 |
|
| 93 | - * @access private |
|
| 94 | - * @var \Wordlift_Content_Filter_Service $instance The {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 95 | - */ |
|
| 96 | - private static $instance; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * Create a {@link Wordlift_Content_Filter_Service} instance. |
|
| 100 | - * |
|
| 101 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 102 | - * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 103 | - * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 104 | - * |
|
| 105 | - * @since 3.8.0 |
|
| 106 | - * |
|
| 107 | - */ |
|
| 108 | - public function __construct( $entity_service, $configuration_service, $entity_uri_service ) { |
|
| 109 | - |
|
| 110 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 111 | - |
|
| 112 | - $this->entity_service = $entity_service; |
|
| 113 | - $this->configuration_service = $configuration_service; |
|
| 114 | - $this->entity_uri_service = $entity_uri_service; |
|
| 115 | - |
|
| 116 | - self::$instance = $this; |
|
| 117 | - |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Get the {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 122 | - * |
|
| 123 | - * @return \Wordlift_Content_Filter_Service The {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 124 | - * @since 3.14.2 |
|
| 125 | - */ |
|
| 126 | - public static function get_instance() { |
|
| 127 | - |
|
| 128 | - return self::$instance; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Mangle the content by adding links to the entity pages. This function is |
|
| 133 | - * hooked to the 'the_content' WP's filter. |
|
| 134 | - * |
|
| 135 | - * @param string $content The content being filtered. |
|
| 136 | - * |
|
| 137 | - * @return string The filtered content. |
|
| 138 | - * @since 3.8.0 |
|
| 139 | - * |
|
| 140 | - */ |
|
| 141 | - public function the_content( $content ) { |
|
| 142 | - |
|
| 143 | - $this->log->trace( "Filtering content [ " . ( is_singular() ? 'yes' : 'no' ) . " ]..." ); |
|
| 144 | - |
|
| 145 | - // Links should be added only on the front end and not for RSS. |
|
| 146 | - if ( is_feed() ) { |
|
| 147 | - return $content; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Before removing annotation tags, remove the highlight tags. |
|
| 152 | - */ |
|
| 153 | - $content = preg_replace(self::FAQ_QUESTION_PATTERN,'$1', $content); |
|
| 154 | - $content = preg_replace(self::FAQ_ANSWER_PATTERN,'$1', $content); |
|
| 155 | - // Preload the `link by default` setting. |
|
| 156 | - $this->is_link_by_default = $this->configuration_service->is_link_by_default(); |
|
| 157 | - |
|
| 158 | - // Reset the array of of entity post ids linked from the post content. |
|
| 159 | - // This is used to avoid linking more the once the same post. |
|
| 160 | - $this->entity_post_ids_linked_from_post_content = array(); |
|
| 161 | - |
|
| 162 | - // Preload URIs. |
|
| 163 | - $matches = array(); |
|
| 164 | - preg_match_all( self::PATTERN, $content, $matches ); |
|
| 165 | - |
|
| 166 | - // Bail out if there are no URIs. |
|
| 167 | - if ( empty( $matches[3] ) ) { |
|
| 168 | - return $content; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - // Preload the URIs. |
|
| 172 | - $this->entity_uri_service->preload_uris( $matches[3] ); |
|
| 173 | - |
|
| 174 | - // Replace each match of the entity tag with the entity link. If an error |
|
| 175 | - // occurs fail silently returning the original content. |
|
| 176 | - $result = preg_replace_callback( self::PATTERN, array( |
|
| 177 | - $this, |
|
| 178 | - 'link', |
|
| 179 | - ), $content ) ?: $content; |
|
| 180 | - |
|
| 181 | - $this->entity_uri_service->reset_uris(); |
|
| 182 | - |
|
| 183 | - return $result; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Get the entity match and replace it with a page link. |
|
| 188 | - * |
|
| 189 | - * @param array $matches An array of matches. |
|
| 190 | - * |
|
| 191 | - * @return string The replaced text with the link to the entity page. |
|
| 192 | - * @since 3.8.0 |
|
| 193 | - * |
|
| 194 | - */ |
|
| 195 | - private function link( $matches ) { |
|
| 196 | - |
|
| 197 | - // Get the entity itemid URI and label. |
|
| 198 | - $css_class = $matches[2]; |
|
| 199 | - $uri = $matches[3]; |
|
| 200 | - $label = $matches[4]; |
|
| 201 | - |
|
| 202 | - // Get the entity post by URI. |
|
| 203 | - $post = $this->entity_service->get_entity_post_by_uri( $uri ); |
|
| 204 | - |
|
| 205 | - // @todo: revise the `test-content-filter-service.php` before switching |
|
| 206 | - // to the `entity_uri_service`. This is required, because the test injects |
|
| 207 | - // itself as `entity_service` to mock the requests to get a post by |
|
| 208 | - // entity uri. |
|
| 209 | - // |
|
| 210 | - // $post = $this->entity_uri_service->get_entity( $uri ); |
|
| 211 | - |
|
| 212 | - if ( null === $post ) { |
|
| 213 | - |
|
| 214 | - // If the entity post is not found return the label w/o the markup |
|
| 215 | - // around it. |
|
| 216 | - // |
|
| 217 | - // See https://github.com/insideout10/wordlift-plugin/issues/461. |
|
| 218 | - return $label; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - $no_link = - 1 < strpos( $css_class, 'wl-no-link' ) |
|
| 222 | - // Do not link if already linked. |
|
| 223 | - || in_array( $post->ID, $this->entity_post_ids_linked_from_post_content ); |
|
| 224 | - $link = - 1 < strpos( $css_class, 'wl-link' ); |
|
| 225 | - |
|
| 226 | - // Don't link if links are disabled and the entity is not link or the |
|
| 227 | - // entity is do not link. |
|
| 228 | - $dont_link = ( ! $this->is_link_by_default && ! $link ) || $no_link; |
|
| 229 | - |
|
| 230 | - // Return the label if it's don't link. |
|
| 231 | - if ( $dont_link ) { |
|
| 232 | - return $label; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // Add the entity post id to the array of already linked entities, so that |
|
| 236 | - // only the first entity occurrence is linked. |
|
| 237 | - $this->entity_post_ids_linked_from_post_content[] = $post->ID; |
|
| 238 | - |
|
| 239 | - // Get the link. |
|
| 240 | - $href = Wordlift_Post_Adapter::get_production_permalink( $post->ID ); |
|
| 241 | - |
|
| 242 | - // Bail out if the `$href` has been reset. |
|
| 243 | - if ( empty( $href ) ) { |
|
| 244 | - return $label; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - // Get an alternative title attribute. |
|
| 248 | - $title_attribute = $this->get_title_attribute( $post->ID, $label ); |
|
| 249 | - |
|
| 250 | - // Return the link. |
|
| 251 | - return "<a class='wl-entity-page-link' $title_attribute href='$href'>$label</a>"; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Get a `title` attribute with an alternative label for the link. |
|
| 256 | - * |
|
| 257 | - * If an alternative title isn't available an empty string is returned. |
|
| 258 | - * |
|
| 259 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 260 | - * @param string $label The main link label. |
|
| 261 | - * |
|
| 262 | - * @return string A `title` attribute with an alternative label or an empty |
|
| 263 | - * string if none available. |
|
| 264 | - * @since 3.15.0 |
|
| 265 | - * |
|
| 266 | - */ |
|
| 267 | - private function get_title_attribute( $post_id, $label ) { |
|
| 268 | - |
|
| 269 | - // Get an alternative title. |
|
| 270 | - $title = $this->get_link_title( $post_id, $label ); |
|
| 271 | - if ( ! empty( $title ) ) { |
|
| 272 | - return 'title="' . esc_attr( $title ) . '"'; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - return ''; |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Get a string to be used as a title attribute in links to a post |
|
| 280 | - * |
|
| 281 | - * @param int $post_id The post id of the post being linked. |
|
| 282 | - * @param string $ignore_label A label to ignore. |
|
| 283 | - * |
|
| 284 | - * @return string The title to be used in the link. An empty string when |
|
| 285 | - * there is no alternative that is not the $ignore_label. |
|
| 286 | - * @since 3.15.0 |
|
| 287 | - * |
|
| 288 | - */ |
|
| 289 | - function get_link_title( $post_id, $ignore_label ) { |
|
| 290 | - |
|
| 291 | - // Get possible alternative labels we can select from. |
|
| 292 | - $labels = $this->entity_service->get_alternative_labels( $post_id ); |
|
| 293 | - |
|
| 294 | - /* |
|
| 21 | + /** |
|
| 22 | + * The pattern to find entities in text. |
|
| 23 | + * |
|
| 24 | + * @since 3.8.0 |
|
| 25 | + */ |
|
| 26 | + const PATTERN = '/<(\\w+)[^<]*class="([^"]*)"\\sitemid=\"([^"]+)\"[^>]*>([^<]*)<\\/\\1>/i'; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * This pattern is used to find all the questions tag. |
|
| 30 | + * |
|
| 31 | + * @since 3.26.0 |
|
| 32 | + */ |
|
| 33 | + const FAQ_QUESTION_PATTERN = '/<span.*class="wl-faq--question"\s?>(.*)<\/span>/'; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * This pattern is used to find all the answers tag. |
|
| 37 | + * |
|
| 38 | + * @since 3.26.0 |
|
| 39 | + */ |
|
| 40 | + const FAQ_ANSWER_PATTERN = '/<span.*class="wl-faq--answer"\s?>(.*)<\/span>/'; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * A {@link Wordlift_Entity_Service} instance. |
|
| 44 | + * |
|
| 45 | + * @since 3.8.0 |
|
| 46 | + * @access private |
|
| 47 | + * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 48 | + */ |
|
| 49 | + private $entity_service; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * The {@link Wordlift_Configuration_Service} instance. |
|
| 53 | + * |
|
| 54 | + * @since 3.13.0 |
|
| 55 | + * @access private |
|
| 56 | + * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 57 | + */ |
|
| 58 | + private $configuration_service; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * The `link by default` setting. |
|
| 62 | + * |
|
| 63 | + * @since 3.13.0 |
|
| 64 | + * @access private |
|
| 65 | + * @var bool True if link by default is enabled otherwise false. |
|
| 66 | + */ |
|
| 67 | + private $is_link_by_default; |
|
| 68 | + |
|
| 69 | + private $entity_post_ids_linked_from_post_content = array(); |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 73 | + * |
|
| 74 | + * @since 3.16.3 |
|
| 75 | + * @access private |
|
| 76 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 77 | + */ |
|
| 78 | + private $entity_uri_service; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * A {@link Wordlift_Log_Service} instance. |
|
| 82 | + * |
|
| 83 | + * @since 3.16.0 |
|
| 84 | + * |
|
| 85 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 86 | + */ |
|
| 87 | + private $log; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * The {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 91 | + * |
|
| 92 | + * @since 3.14.2 |
|
| 93 | + * @access private |
|
| 94 | + * @var \Wordlift_Content_Filter_Service $instance The {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 95 | + */ |
|
| 96 | + private static $instance; |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * Create a {@link Wordlift_Content_Filter_Service} instance. |
|
| 100 | + * |
|
| 101 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 102 | + * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 103 | + * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 104 | + * |
|
| 105 | + * @since 3.8.0 |
|
| 106 | + * |
|
| 107 | + */ |
|
| 108 | + public function __construct( $entity_service, $configuration_service, $entity_uri_service ) { |
|
| 109 | + |
|
| 110 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 111 | + |
|
| 112 | + $this->entity_service = $entity_service; |
|
| 113 | + $this->configuration_service = $configuration_service; |
|
| 114 | + $this->entity_uri_service = $entity_uri_service; |
|
| 115 | + |
|
| 116 | + self::$instance = $this; |
|
| 117 | + |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Get the {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 122 | + * |
|
| 123 | + * @return \Wordlift_Content_Filter_Service The {@link Wordlift_Content_Filter_Service} singleton instance. |
|
| 124 | + * @since 3.14.2 |
|
| 125 | + */ |
|
| 126 | + public static function get_instance() { |
|
| 127 | + |
|
| 128 | + return self::$instance; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Mangle the content by adding links to the entity pages. This function is |
|
| 133 | + * hooked to the 'the_content' WP's filter. |
|
| 134 | + * |
|
| 135 | + * @param string $content The content being filtered. |
|
| 136 | + * |
|
| 137 | + * @return string The filtered content. |
|
| 138 | + * @since 3.8.0 |
|
| 139 | + * |
|
| 140 | + */ |
|
| 141 | + public function the_content( $content ) { |
|
| 142 | + |
|
| 143 | + $this->log->trace( "Filtering content [ " . ( is_singular() ? 'yes' : 'no' ) . " ]..." ); |
|
| 144 | + |
|
| 145 | + // Links should be added only on the front end and not for RSS. |
|
| 146 | + if ( is_feed() ) { |
|
| 147 | + return $content; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Before removing annotation tags, remove the highlight tags. |
|
| 152 | + */ |
|
| 153 | + $content = preg_replace(self::FAQ_QUESTION_PATTERN,'$1', $content); |
|
| 154 | + $content = preg_replace(self::FAQ_ANSWER_PATTERN,'$1', $content); |
|
| 155 | + // Preload the `link by default` setting. |
|
| 156 | + $this->is_link_by_default = $this->configuration_service->is_link_by_default(); |
|
| 157 | + |
|
| 158 | + // Reset the array of of entity post ids linked from the post content. |
|
| 159 | + // This is used to avoid linking more the once the same post. |
|
| 160 | + $this->entity_post_ids_linked_from_post_content = array(); |
|
| 161 | + |
|
| 162 | + // Preload URIs. |
|
| 163 | + $matches = array(); |
|
| 164 | + preg_match_all( self::PATTERN, $content, $matches ); |
|
| 165 | + |
|
| 166 | + // Bail out if there are no URIs. |
|
| 167 | + if ( empty( $matches[3] ) ) { |
|
| 168 | + return $content; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + // Preload the URIs. |
|
| 172 | + $this->entity_uri_service->preload_uris( $matches[3] ); |
|
| 173 | + |
|
| 174 | + // Replace each match of the entity tag with the entity link. If an error |
|
| 175 | + // occurs fail silently returning the original content. |
|
| 176 | + $result = preg_replace_callback( self::PATTERN, array( |
|
| 177 | + $this, |
|
| 178 | + 'link', |
|
| 179 | + ), $content ) ?: $content; |
|
| 180 | + |
|
| 181 | + $this->entity_uri_service->reset_uris(); |
|
| 182 | + |
|
| 183 | + return $result; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Get the entity match and replace it with a page link. |
|
| 188 | + * |
|
| 189 | + * @param array $matches An array of matches. |
|
| 190 | + * |
|
| 191 | + * @return string The replaced text with the link to the entity page. |
|
| 192 | + * @since 3.8.0 |
|
| 193 | + * |
|
| 194 | + */ |
|
| 195 | + private function link( $matches ) { |
|
| 196 | + |
|
| 197 | + // Get the entity itemid URI and label. |
|
| 198 | + $css_class = $matches[2]; |
|
| 199 | + $uri = $matches[3]; |
|
| 200 | + $label = $matches[4]; |
|
| 201 | + |
|
| 202 | + // Get the entity post by URI. |
|
| 203 | + $post = $this->entity_service->get_entity_post_by_uri( $uri ); |
|
| 204 | + |
|
| 205 | + // @todo: revise the `test-content-filter-service.php` before switching |
|
| 206 | + // to the `entity_uri_service`. This is required, because the test injects |
|
| 207 | + // itself as `entity_service` to mock the requests to get a post by |
|
| 208 | + // entity uri. |
|
| 209 | + // |
|
| 210 | + // $post = $this->entity_uri_service->get_entity( $uri ); |
|
| 211 | + |
|
| 212 | + if ( null === $post ) { |
|
| 213 | + |
|
| 214 | + // If the entity post is not found return the label w/o the markup |
|
| 215 | + // around it. |
|
| 216 | + // |
|
| 217 | + // See https://github.com/insideout10/wordlift-plugin/issues/461. |
|
| 218 | + return $label; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + $no_link = - 1 < strpos( $css_class, 'wl-no-link' ) |
|
| 222 | + // Do not link if already linked. |
|
| 223 | + || in_array( $post->ID, $this->entity_post_ids_linked_from_post_content ); |
|
| 224 | + $link = - 1 < strpos( $css_class, 'wl-link' ); |
|
| 225 | + |
|
| 226 | + // Don't link if links are disabled and the entity is not link or the |
|
| 227 | + // entity is do not link. |
|
| 228 | + $dont_link = ( ! $this->is_link_by_default && ! $link ) || $no_link; |
|
| 229 | + |
|
| 230 | + // Return the label if it's don't link. |
|
| 231 | + if ( $dont_link ) { |
|
| 232 | + return $label; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // Add the entity post id to the array of already linked entities, so that |
|
| 236 | + // only the first entity occurrence is linked. |
|
| 237 | + $this->entity_post_ids_linked_from_post_content[] = $post->ID; |
|
| 238 | + |
|
| 239 | + // Get the link. |
|
| 240 | + $href = Wordlift_Post_Adapter::get_production_permalink( $post->ID ); |
|
| 241 | + |
|
| 242 | + // Bail out if the `$href` has been reset. |
|
| 243 | + if ( empty( $href ) ) { |
|
| 244 | + return $label; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + // Get an alternative title attribute. |
|
| 248 | + $title_attribute = $this->get_title_attribute( $post->ID, $label ); |
|
| 249 | + |
|
| 250 | + // Return the link. |
|
| 251 | + return "<a class='wl-entity-page-link' $title_attribute href='$href'>$label</a>"; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Get a `title` attribute with an alternative label for the link. |
|
| 256 | + * |
|
| 257 | + * If an alternative title isn't available an empty string is returned. |
|
| 258 | + * |
|
| 259 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 260 | + * @param string $label The main link label. |
|
| 261 | + * |
|
| 262 | + * @return string A `title` attribute with an alternative label or an empty |
|
| 263 | + * string if none available. |
|
| 264 | + * @since 3.15.0 |
|
| 265 | + * |
|
| 266 | + */ |
|
| 267 | + private function get_title_attribute( $post_id, $label ) { |
|
| 268 | + |
|
| 269 | + // Get an alternative title. |
|
| 270 | + $title = $this->get_link_title( $post_id, $label ); |
|
| 271 | + if ( ! empty( $title ) ) { |
|
| 272 | + return 'title="' . esc_attr( $title ) . '"'; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + return ''; |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Get a string to be used as a title attribute in links to a post |
|
| 280 | + * |
|
| 281 | + * @param int $post_id The post id of the post being linked. |
|
| 282 | + * @param string $ignore_label A label to ignore. |
|
| 283 | + * |
|
| 284 | + * @return string The title to be used in the link. An empty string when |
|
| 285 | + * there is no alternative that is not the $ignore_label. |
|
| 286 | + * @since 3.15.0 |
|
| 287 | + * |
|
| 288 | + */ |
|
| 289 | + function get_link_title( $post_id, $ignore_label ) { |
|
| 290 | + |
|
| 291 | + // Get possible alternative labels we can select from. |
|
| 292 | + $labels = $this->entity_service->get_alternative_labels( $post_id ); |
|
| 293 | + |
|
| 294 | + /* |
|
| 295 | 295 | * Since the original text might use an alternative label than the |
| 296 | 296 | * Entity title, add the title itself which is not returned by the api. |
| 297 | 297 | */ |
| 298 | - $labels[] = get_the_title( $post_id ); |
|
| 299 | - |
|
| 300 | - // Add some randomness to the label selection. |
|
| 301 | - shuffle( $labels ); |
|
| 302 | - |
|
| 303 | - // Select the first label which is not to be ignored. |
|
| 304 | - $title = ''; |
|
| 305 | - foreach ( $labels as $label ) { |
|
| 306 | - if ( 0 !== strcasecmp( $label, $ignore_label ) ) { |
|
| 307 | - $title = $label; |
|
| 308 | - break; |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - return $title; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - /** |
|
| 316 | - * Get the entity URIs (configured in the `itemid` attribute) contained in |
|
| 317 | - * the provided content. |
|
| 318 | - * |
|
| 319 | - * @param string $content The content. |
|
| 320 | - * |
|
| 321 | - * @return array An array of URIs. |
|
| 322 | - * @since 3.14.2 |
|
| 323 | - * |
|
| 324 | - */ |
|
| 325 | - public function get_entity_uris( $content ) { |
|
| 326 | - |
|
| 327 | - $matches = array(); |
|
| 328 | - preg_match_all( Wordlift_Content_Filter_Service::PATTERN, $content, $matches ); |
|
| 329 | - |
|
| 330 | - // We need to use `array_values` here in order to avoid further `json_encode` |
|
| 331 | - // to turn it into an object (since if the 3rd match isn't found the index |
|
| 332 | - // is not sequential. |
|
| 333 | - // |
|
| 334 | - // See https://github.com/insideout10/wordlift-plugin/issues/646. |
|
| 335 | - return array_values( array_unique( $matches[3] ) ); |
|
| 336 | - } |
|
| 298 | + $labels[] = get_the_title( $post_id ); |
|
| 299 | + |
|
| 300 | + // Add some randomness to the label selection. |
|
| 301 | + shuffle( $labels ); |
|
| 302 | + |
|
| 303 | + // Select the first label which is not to be ignored. |
|
| 304 | + $title = ''; |
|
| 305 | + foreach ( $labels as $label ) { |
|
| 306 | + if ( 0 !== strcasecmp( $label, $ignore_label ) ) { |
|
| 307 | + $title = $label; |
|
| 308 | + break; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + return $title; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + /** |
|
| 316 | + * Get the entity URIs (configured in the `itemid` attribute) contained in |
|
| 317 | + * the provided content. |
|
| 318 | + * |
|
| 319 | + * @param string $content The content. |
|
| 320 | + * |
|
| 321 | + * @return array An array of URIs. |
|
| 322 | + * @since 3.14.2 |
|
| 323 | + * |
|
| 324 | + */ |
|
| 325 | + public function get_entity_uris( $content ) { |
|
| 326 | + |
|
| 327 | + $matches = array(); |
|
| 328 | + preg_match_all( Wordlift_Content_Filter_Service::PATTERN, $content, $matches ); |
|
| 329 | + |
|
| 330 | + // We need to use `array_values` here in order to avoid further `json_encode` |
|
| 331 | + // to turn it into an object (since if the 3rd match isn't found the index |
|
| 332 | + // is not sequential. |
|
| 333 | + // |
|
| 334 | + // See https://github.com/insideout10/wordlift-plugin/issues/646. |
|
| 335 | + return array_values( array_unique( $matches[3] ) ); |
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | 338 | } |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | * @since 3.8.0 |
| 106 | 106 | * |
| 107 | 107 | */ |
| 108 | - public function __construct( $entity_service, $configuration_service, $entity_uri_service ) { |
|
| 108 | + public function __construct($entity_service, $configuration_service, $entity_uri_service) { |
|
| 109 | 109 | |
| 110 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 110 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 111 | 111 | |
| 112 | 112 | $this->entity_service = $entity_service; |
| 113 | 113 | $this->configuration_service = $configuration_service; |
@@ -138,20 +138,20 @@ discard block |
||
| 138 | 138 | * @since 3.8.0 |
| 139 | 139 | * |
| 140 | 140 | */ |
| 141 | - public function the_content( $content ) { |
|
| 141 | + public function the_content($content) { |
|
| 142 | 142 | |
| 143 | - $this->log->trace( "Filtering content [ " . ( is_singular() ? 'yes' : 'no' ) . " ]..." ); |
|
| 143 | + $this->log->trace("Filtering content [ ".(is_singular() ? 'yes' : 'no')." ]..."); |
|
| 144 | 144 | |
| 145 | 145 | // Links should be added only on the front end and not for RSS. |
| 146 | - if ( is_feed() ) { |
|
| 146 | + if (is_feed()) { |
|
| 147 | 147 | return $content; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * Before removing annotation tags, remove the highlight tags. |
| 152 | 152 | */ |
| 153 | - $content = preg_replace(self::FAQ_QUESTION_PATTERN,'$1', $content); |
|
| 154 | - $content = preg_replace(self::FAQ_ANSWER_PATTERN,'$1', $content); |
|
| 153 | + $content = preg_replace(self::FAQ_QUESTION_PATTERN, '$1', $content); |
|
| 154 | + $content = preg_replace(self::FAQ_ANSWER_PATTERN, '$1', $content); |
|
| 155 | 155 | // Preload the `link by default` setting. |
| 156 | 156 | $this->is_link_by_default = $this->configuration_service->is_link_by_default(); |
| 157 | 157 | |
@@ -161,22 +161,22 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | // Preload URIs. |
| 163 | 163 | $matches = array(); |
| 164 | - preg_match_all( self::PATTERN, $content, $matches ); |
|
| 164 | + preg_match_all(self::PATTERN, $content, $matches); |
|
| 165 | 165 | |
| 166 | 166 | // Bail out if there are no URIs. |
| 167 | - if ( empty( $matches[3] ) ) { |
|
| 167 | + if (empty($matches[3])) { |
|
| 168 | 168 | return $content; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // Preload the URIs. |
| 172 | - $this->entity_uri_service->preload_uris( $matches[3] ); |
|
| 172 | + $this->entity_uri_service->preload_uris($matches[3]); |
|
| 173 | 173 | |
| 174 | 174 | // Replace each match of the entity tag with the entity link. If an error |
| 175 | 175 | // occurs fail silently returning the original content. |
| 176 | - $result = preg_replace_callback( self::PATTERN, array( |
|
| 176 | + $result = preg_replace_callback(self::PATTERN, array( |
|
| 177 | 177 | $this, |
| 178 | 178 | 'link', |
| 179 | - ), $content ) ?: $content; |
|
| 179 | + ), $content) ?: $content; |
|
| 180 | 180 | |
| 181 | 181 | $this->entity_uri_service->reset_uris(); |
| 182 | 182 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @since 3.8.0 |
| 193 | 193 | * |
| 194 | 194 | */ |
| 195 | - private function link( $matches ) { |
|
| 195 | + private function link($matches) { |
|
| 196 | 196 | |
| 197 | 197 | // Get the entity itemid URI and label. |
| 198 | 198 | $css_class = $matches[2]; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $label = $matches[4]; |
| 201 | 201 | |
| 202 | 202 | // Get the entity post by URI. |
| 203 | - $post = $this->entity_service->get_entity_post_by_uri( $uri ); |
|
| 203 | + $post = $this->entity_service->get_entity_post_by_uri($uri); |
|
| 204 | 204 | |
| 205 | 205 | // @todo: revise the `test-content-filter-service.php` before switching |
| 206 | 206 | // to the `entity_uri_service`. This is required, because the test injects |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | // |
| 210 | 210 | // $post = $this->entity_uri_service->get_entity( $uri ); |
| 211 | 211 | |
| 212 | - if ( null === $post ) { |
|
| 212 | + if (null === $post) { |
|
| 213 | 213 | |
| 214 | 214 | // If the entity post is not found return the label w/o the markup |
| 215 | 215 | // around it. |
@@ -218,17 +218,17 @@ discard block |
||
| 218 | 218 | return $label; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $no_link = - 1 < strpos( $css_class, 'wl-no-link' ) |
|
| 221 | + $no_link = - 1 < strpos($css_class, 'wl-no-link') |
|
| 222 | 222 | // Do not link if already linked. |
| 223 | - || in_array( $post->ID, $this->entity_post_ids_linked_from_post_content ); |
|
| 224 | - $link = - 1 < strpos( $css_class, 'wl-link' ); |
|
| 223 | + || in_array($post->ID, $this->entity_post_ids_linked_from_post_content); |
|
| 224 | + $link = - 1 < strpos($css_class, 'wl-link'); |
|
| 225 | 225 | |
| 226 | 226 | // Don't link if links are disabled and the entity is not link or the |
| 227 | 227 | // entity is do not link. |
| 228 | - $dont_link = ( ! $this->is_link_by_default && ! $link ) || $no_link; |
|
| 228 | + $dont_link = ( ! $this->is_link_by_default && ! $link) || $no_link; |
|
| 229 | 229 | |
| 230 | 230 | // Return the label if it's don't link. |
| 231 | - if ( $dont_link ) { |
|
| 231 | + if ($dont_link) { |
|
| 232 | 232 | return $label; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | $this->entity_post_ids_linked_from_post_content[] = $post->ID; |
| 238 | 238 | |
| 239 | 239 | // Get the link. |
| 240 | - $href = Wordlift_Post_Adapter::get_production_permalink( $post->ID ); |
|
| 240 | + $href = Wordlift_Post_Adapter::get_production_permalink($post->ID); |
|
| 241 | 241 | |
| 242 | 242 | // Bail out if the `$href` has been reset. |
| 243 | - if ( empty( $href ) ) { |
|
| 243 | + if (empty($href)) { |
|
| 244 | 244 | return $label; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Get an alternative title attribute. |
| 248 | - $title_attribute = $this->get_title_attribute( $post->ID, $label ); |
|
| 248 | + $title_attribute = $this->get_title_attribute($post->ID, $label); |
|
| 249 | 249 | |
| 250 | 250 | // Return the link. |
| 251 | 251 | return "<a class='wl-entity-page-link' $title_attribute href='$href'>$label</a>"; |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | * @since 3.15.0 |
| 265 | 265 | * |
| 266 | 266 | */ |
| 267 | - private function get_title_attribute( $post_id, $label ) { |
|
| 267 | + private function get_title_attribute($post_id, $label) { |
|
| 268 | 268 | |
| 269 | 269 | // Get an alternative title. |
| 270 | - $title = $this->get_link_title( $post_id, $label ); |
|
| 271 | - if ( ! empty( $title ) ) { |
|
| 272 | - return 'title="' . esc_attr( $title ) . '"'; |
|
| 270 | + $title = $this->get_link_title($post_id, $label); |
|
| 271 | + if ( ! empty($title)) { |
|
| 272 | + return 'title="'.esc_attr($title).'"'; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return ''; |
@@ -286,24 +286,24 @@ discard block |
||
| 286 | 286 | * @since 3.15.0 |
| 287 | 287 | * |
| 288 | 288 | */ |
| 289 | - function get_link_title( $post_id, $ignore_label ) { |
|
| 289 | + function get_link_title($post_id, $ignore_label) { |
|
| 290 | 290 | |
| 291 | 291 | // Get possible alternative labels we can select from. |
| 292 | - $labels = $this->entity_service->get_alternative_labels( $post_id ); |
|
| 292 | + $labels = $this->entity_service->get_alternative_labels($post_id); |
|
| 293 | 293 | |
| 294 | 294 | /* |
| 295 | 295 | * Since the original text might use an alternative label than the |
| 296 | 296 | * Entity title, add the title itself which is not returned by the api. |
| 297 | 297 | */ |
| 298 | - $labels[] = get_the_title( $post_id ); |
|
| 298 | + $labels[] = get_the_title($post_id); |
|
| 299 | 299 | |
| 300 | 300 | // Add some randomness to the label selection. |
| 301 | - shuffle( $labels ); |
|
| 301 | + shuffle($labels); |
|
| 302 | 302 | |
| 303 | 303 | // Select the first label which is not to be ignored. |
| 304 | 304 | $title = ''; |
| 305 | - foreach ( $labels as $label ) { |
|
| 306 | - if ( 0 !== strcasecmp( $label, $ignore_label ) ) { |
|
| 305 | + foreach ($labels as $label) { |
|
| 306 | + if (0 !== strcasecmp($label, $ignore_label)) { |
|
| 307 | 307 | $title = $label; |
| 308 | 308 | break; |
| 309 | 309 | } |
@@ -322,17 +322,17 @@ discard block |
||
| 322 | 322 | * @since 3.14.2 |
| 323 | 323 | * |
| 324 | 324 | */ |
| 325 | - public function get_entity_uris( $content ) { |
|
| 325 | + public function get_entity_uris($content) { |
|
| 326 | 326 | |
| 327 | 327 | $matches = array(); |
| 328 | - preg_match_all( Wordlift_Content_Filter_Service::PATTERN, $content, $matches ); |
|
| 328 | + preg_match_all(Wordlift_Content_Filter_Service::PATTERN, $content, $matches); |
|
| 329 | 329 | |
| 330 | 330 | // We need to use `array_values` here in order to avoid further `json_encode` |
| 331 | 331 | // to turn it into an object (since if the 3rd match isn't found the index |
| 332 | 332 | // is not sequential. |
| 333 | 333 | // |
| 334 | 334 | // See https://github.com/insideout10/wordlift-plugin/issues/646. |
| 335 | - return array_values( array_unique( $matches[3] ) ); |
|
| 335 | + return array_values(array_unique($matches[3])); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | } |
@@ -51,1511 +51,1511 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | class Wordlift { |
| 53 | 53 | |
| 54 | - //<editor-fold desc="## FIELDS"> |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 58 | - * the plugin. |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @access protected |
|
| 62 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 63 | - */ |
|
| 64 | - protected $loader; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * The unique identifier of this plugin. |
|
| 68 | - * |
|
| 69 | - * @since 1.0.0 |
|
| 70 | - * @access protected |
|
| 71 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 72 | - */ |
|
| 73 | - protected $plugin_name; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * The current version of the plugin. |
|
| 77 | - * |
|
| 78 | - * @since 1.0.0 |
|
| 79 | - * @access protected |
|
| 80 | - * @var string $version The current version of the plugin. |
|
| 81 | - */ |
|
| 82 | - protected $version; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 86 | - * |
|
| 87 | - * @since 3.12.0 |
|
| 88 | - * @access protected |
|
| 89 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 90 | - */ |
|
| 91 | - protected $tinymce_adapter; |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 95 | - * @since 3.26.0 |
|
| 96 | - * @access protected |
|
| 97 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter. |
|
| 98 | - */ |
|
| 99 | - protected $faq_tinymce_adapter; |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * The Thumbnail service. |
|
| 103 | - * |
|
| 104 | - * @since 3.1.5 |
|
| 105 | - * @access private |
|
| 106 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 107 | - */ |
|
| 108 | - private $thumbnail_service; |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * The UI service. |
|
| 112 | - * |
|
| 113 | - * @since 3.2.0 |
|
| 114 | - * @access private |
|
| 115 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 116 | - */ |
|
| 117 | - private $ui_service; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The Schema service. |
|
| 121 | - * |
|
| 122 | - * @since 3.3.0 |
|
| 123 | - * @access protected |
|
| 124 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 125 | - */ |
|
| 126 | - protected $schema_service; |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * The Entity service. |
|
| 130 | - * |
|
| 131 | - * @since 3.1.0 |
|
| 132 | - * @access protected |
|
| 133 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 134 | - */ |
|
| 135 | - protected $entity_service; |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * The Topic Taxonomy service. |
|
| 139 | - * |
|
| 140 | - * @since 3.5.0 |
|
| 141 | - * @access private |
|
| 142 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 143 | - */ |
|
| 144 | - private $topic_taxonomy_service; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * The Entity Types Taxonomy service. |
|
| 148 | - * |
|
| 149 | - * @since 3.18.0 |
|
| 150 | - * @access private |
|
| 151 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 152 | - */ |
|
| 153 | - private $entity_types_taxonomy_service; |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * The User service. |
|
| 157 | - * |
|
| 158 | - * @since 3.1.7 |
|
| 159 | - * @access protected |
|
| 160 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 161 | - */ |
|
| 162 | - protected $user_service; |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * The Timeline service. |
|
| 166 | - * |
|
| 167 | - * @since 3.1.0 |
|
| 168 | - * @access private |
|
| 169 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 170 | - */ |
|
| 171 | - private $timeline_service; |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * The Redirect service. |
|
| 175 | - * |
|
| 176 | - * @since 3.2.0 |
|
| 177 | - * @access private |
|
| 178 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 179 | - */ |
|
| 180 | - private $redirect_service; |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * The Notice service. |
|
| 184 | - * |
|
| 185 | - * @since 3.3.0 |
|
| 186 | - * @access private |
|
| 187 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 188 | - */ |
|
| 189 | - private $notice_service; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * The Entity list customization. |
|
| 193 | - * |
|
| 194 | - * @since 3.3.0 |
|
| 195 | - * @access protected |
|
| 196 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 197 | - */ |
|
| 198 | - protected $entity_list_service; |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * The Entity Types Taxonomy Walker. |
|
| 202 | - * |
|
| 203 | - * @since 3.1.0 |
|
| 204 | - * @access private |
|
| 205 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 206 | - */ |
|
| 207 | - private $entity_types_taxonomy_walker; |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * The ShareThis service. |
|
| 211 | - * |
|
| 212 | - * @since 3.2.0 |
|
| 213 | - * @access private |
|
| 214 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 215 | - */ |
|
| 216 | - private $sharethis_service; |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * The PrimaShop adapter. |
|
| 220 | - * |
|
| 221 | - * @since 3.2.3 |
|
| 222 | - * @access private |
|
| 223 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 224 | - */ |
|
| 225 | - private $primashop_adapter; |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * The WordLift Dashboard adapter. |
|
| 229 | - * |
|
| 230 | - * @since 3.4.0 |
|
| 231 | - * @access private |
|
| 232 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 233 | - */ |
|
| 234 | - private $dashboard_service; |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * The entity type service. |
|
| 238 | - * |
|
| 239 | - * @since 3.6.0 |
|
| 240 | - * @access private |
|
| 241 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 242 | - */ |
|
| 243 | - private $entity_post_type_service; |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 247 | - * |
|
| 248 | - * @since 3.6.0 |
|
| 249 | - * @access private |
|
| 250 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 251 | - */ |
|
| 252 | - private $entity_link_service; |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 256 | - * |
|
| 257 | - * @since 3.6.0 |
|
| 258 | - * @access protected |
|
| 259 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 260 | - */ |
|
| 261 | - protected $sparql_service; |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * A {@link Wordlift_Import_Service} instance. |
|
| 265 | - * |
|
| 266 | - * @since 3.6.0 |
|
| 267 | - * @access private |
|
| 268 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 269 | - */ |
|
| 270 | - private $import_service; |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 274 | - * |
|
| 275 | - * @since 3.6.0 |
|
| 276 | - * @access private |
|
| 277 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 278 | - */ |
|
| 279 | - private $rebuild_service; |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 283 | - * |
|
| 284 | - * @since 3.7.0 |
|
| 285 | - * @access protected |
|
| 286 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 287 | - */ |
|
| 288 | - protected $jsonld_service; |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 292 | - * |
|
| 293 | - * @since 3.14.0 |
|
| 294 | - * @access protected |
|
| 295 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 296 | - */ |
|
| 297 | - protected $jsonld_website_converter; |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 301 | - * |
|
| 302 | - * @since 3.7.0 |
|
| 303 | - * @access private |
|
| 304 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 305 | - */ |
|
| 306 | - private $property_factory; |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * The 'Download Your Data' page. |
|
| 310 | - * |
|
| 311 | - * @since 3.6.0 |
|
| 312 | - * @access private |
|
| 313 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 314 | - */ |
|
| 315 | - private $download_your_data_page; |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * The 'WordLift Settings' page. |
|
| 319 | - * |
|
| 320 | - * @since 3.11.0 |
|
| 321 | - * @access protected |
|
| 322 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 323 | - */ |
|
| 324 | - protected $settings_page; |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * The install wizard page. |
|
| 328 | - * |
|
| 329 | - * @since 3.9.0 |
|
| 330 | - * @access private |
|
| 331 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 332 | - */ |
|
| 333 | - private $admin_setup; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 337 | - * linking of entities to their pages. |
|
| 338 | - * |
|
| 339 | - * @since 3.8.0 |
|
| 340 | - * @access private |
|
| 341 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 342 | - */ |
|
| 343 | - private $content_filter_service; |
|
| 344 | - |
|
| 345 | - /** |
|
| 346 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 347 | - * |
|
| 348 | - * @since 3.9.0 |
|
| 349 | - * @access private |
|
| 350 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 351 | - */ |
|
| 352 | - private $key_validation_service; |
|
| 353 | - |
|
| 354 | - /** |
|
| 355 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 356 | - * |
|
| 357 | - * @since 3.10.0 |
|
| 358 | - * @access private |
|
| 359 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 360 | - */ |
|
| 361 | - private $rating_service; |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 365 | - * |
|
| 366 | - * @since 3.10.0 |
|
| 367 | - * @access protected |
|
| 368 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 369 | - */ |
|
| 370 | - protected $post_to_jsonld_converter; |
|
| 371 | - |
|
| 372 | - /** |
|
| 373 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 374 | - * |
|
| 375 | - * @since 3.10.0 |
|
| 376 | - * @access protected |
|
| 377 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 378 | - */ |
|
| 379 | - protected $configuration_service; |
|
| 380 | - |
|
| 381 | - /** |
|
| 382 | - * A {@link Wordlift_Install_Service} instance. |
|
| 383 | - * |
|
| 384 | - * @since 3.18.0 |
|
| 385 | - * @access protected |
|
| 386 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 387 | - */ |
|
| 388 | - protected $install_service; |
|
| 389 | - |
|
| 390 | - /** |
|
| 391 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 392 | - * |
|
| 393 | - * @since 3.10.0 |
|
| 394 | - * @access protected |
|
| 395 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 396 | - */ |
|
| 397 | - protected $entity_type_service; |
|
| 398 | - |
|
| 399 | - /** |
|
| 400 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 401 | - * |
|
| 402 | - * @since 3.10.0 |
|
| 403 | - * @access protected |
|
| 404 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 405 | - */ |
|
| 406 | - protected $entity_post_to_jsonld_converter; |
|
| 407 | - |
|
| 408 | - /** |
|
| 409 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 410 | - * |
|
| 411 | - * @since 3.10.0 |
|
| 412 | - * @access protected |
|
| 413 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 414 | - */ |
|
| 415 | - protected $postid_to_jsonld_converter; |
|
| 416 | - |
|
| 417 | - /** |
|
| 418 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 419 | - * |
|
| 420 | - * @since 3.9.8 |
|
| 421 | - * @access private |
|
| 422 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 423 | - */ |
|
| 424 | - private $status_page; |
|
| 425 | - |
|
| 426 | - /** |
|
| 427 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 428 | - * |
|
| 429 | - * @since 3.11.0 |
|
| 430 | - * @access protected |
|
| 431 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 432 | - */ |
|
| 433 | - protected $category_taxonomy_service; |
|
| 434 | - |
|
| 435 | - /** |
|
| 436 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 437 | - * |
|
| 438 | - * @since 3.11.0 |
|
| 439 | - * @access protected |
|
| 440 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 441 | - */ |
|
| 442 | - protected $entity_page_service; |
|
| 443 | - |
|
| 444 | - /** |
|
| 445 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 446 | - * |
|
| 447 | - * @since 3.11.0 |
|
| 448 | - * @access protected |
|
| 449 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 450 | - */ |
|
| 451 | - protected $settings_page_action_link; |
|
| 452 | - |
|
| 453 | - /** |
|
| 454 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 455 | - * |
|
| 456 | - * @since 3.11.0 |
|
| 457 | - * @access protected |
|
| 458 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 459 | - */ |
|
| 460 | - protected $analytics_settings_page_action_link; |
|
| 461 | - |
|
| 462 | - /** |
|
| 463 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 464 | - * |
|
| 465 | - * @since 3.11.0 |
|
| 466 | - * @access protected |
|
| 467 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 468 | - */ |
|
| 469 | - protected $analytics_connect; |
|
| 470 | - |
|
| 471 | - /** |
|
| 472 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 473 | - * |
|
| 474 | - * @since 3.11.0 |
|
| 475 | - * @access protected |
|
| 476 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 477 | - */ |
|
| 478 | - protected $publisher_ajax_adapter; |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 482 | - * |
|
| 483 | - * @since 3.11.0 |
|
| 484 | - * @access protected |
|
| 485 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 486 | - */ |
|
| 487 | - protected $input_element; |
|
| 488 | - |
|
| 489 | - /** |
|
| 490 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 491 | - * |
|
| 492 | - * @since 3.13.0 |
|
| 493 | - * @access protected |
|
| 494 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 495 | - */ |
|
| 496 | - protected $radio_input_element; |
|
| 497 | - |
|
| 498 | - /** |
|
| 499 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 500 | - * |
|
| 501 | - * @since 3.11.0 |
|
| 502 | - * @access protected |
|
| 503 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 504 | - */ |
|
| 505 | - protected $language_select_element; |
|
| 506 | - |
|
| 507 | - /** |
|
| 508 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 509 | - * |
|
| 510 | - * @since 3.18.0 |
|
| 511 | - * @access protected |
|
| 512 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 513 | - */ |
|
| 514 | - protected $country_select_element; |
|
| 515 | - |
|
| 516 | - /** |
|
| 517 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 518 | - * |
|
| 519 | - * @since 3.11.0 |
|
| 520 | - * @access protected |
|
| 521 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 522 | - */ |
|
| 523 | - protected $publisher_element; |
|
| 524 | - |
|
| 525 | - /** |
|
| 526 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 527 | - * |
|
| 528 | - * @since 3.11.0 |
|
| 529 | - * @access protected |
|
| 530 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 531 | - */ |
|
| 532 | - protected $select2_element; |
|
| 533 | - |
|
| 534 | - /** |
|
| 535 | - * The controller for the entity type list admin page |
|
| 536 | - * |
|
| 537 | - * @since 3.11.0 |
|
| 538 | - * @access private |
|
| 539 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 540 | - */ |
|
| 541 | - private $entity_type_admin_page; |
|
| 542 | - |
|
| 543 | - /** |
|
| 544 | - * The controller for the entity type settings admin page |
|
| 545 | - * |
|
| 546 | - * @since 3.11.0 |
|
| 547 | - * @access private |
|
| 548 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 549 | - */ |
|
| 550 | - private $entity_type_settings_admin_page; |
|
| 551 | - |
|
| 552 | - /** |
|
| 553 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 554 | - * |
|
| 555 | - * @since 3.11.0 |
|
| 556 | - * @access protected |
|
| 557 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 558 | - */ |
|
| 559 | - protected $related_entities_cloud_widget; |
|
| 560 | - |
|
| 561 | - /** |
|
| 562 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 563 | - * |
|
| 564 | - * @since 3.14.0 |
|
| 565 | - * @access protected |
|
| 566 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 567 | - */ |
|
| 568 | - protected $author_element; |
|
| 569 | - |
|
| 570 | - /** |
|
| 571 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 572 | - * |
|
| 573 | - * @since 3.12.0 |
|
| 574 | - * @access protected |
|
| 575 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 576 | - */ |
|
| 577 | - protected $sample_data_service; |
|
| 578 | - |
|
| 579 | - /** |
|
| 580 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 581 | - * |
|
| 582 | - * @since 3.12.0 |
|
| 583 | - * @access protected |
|
| 584 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 585 | - */ |
|
| 586 | - protected $sample_data_ajax_adapter; |
|
| 587 | - |
|
| 588 | - /** |
|
| 589 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | - * |
|
| 591 | - * @since 3.14.3 |
|
| 592 | - * @access private |
|
| 593 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 594 | - */ |
|
| 595 | - private $relation_rebuild_service; |
|
| 596 | - |
|
| 597 | - /** |
|
| 598 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | - * |
|
| 600 | - * @since 3.14.3 |
|
| 601 | - * @access private |
|
| 602 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 603 | - */ |
|
| 604 | - private $relation_rebuild_adapter; |
|
| 605 | - |
|
| 606 | - /** |
|
| 607 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | - * |
|
| 609 | - * @since 3.18.0 |
|
| 610 | - * @access private |
|
| 611 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 612 | - */ |
|
| 613 | - private $reference_rebuild_service; |
|
| 614 | - |
|
| 615 | - /** |
|
| 616 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | - * |
|
| 618 | - * @since 3.16.0 |
|
| 619 | - * @access protected |
|
| 620 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 621 | - */ |
|
| 622 | - protected $google_analytics_export_service; |
|
| 623 | - |
|
| 624 | - /** |
|
| 625 | - * {@link Wordlift}'s singleton instance. |
|
| 626 | - * |
|
| 627 | - * @since 3.15.0 |
|
| 628 | - * @access protected |
|
| 629 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 630 | - */ |
|
| 631 | - protected $entity_type_adapter; |
|
| 632 | - |
|
| 633 | - /** |
|
| 634 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | - * |
|
| 636 | - * @since 3.15.0 |
|
| 637 | - * @access protected |
|
| 638 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 639 | - */ |
|
| 640 | - protected $linked_data_service; |
|
| 641 | - |
|
| 642 | - /** |
|
| 643 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | - * |
|
| 645 | - * @since 3.15.0 |
|
| 646 | - * @access protected |
|
| 647 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 648 | - */ |
|
| 649 | - protected $storage_factory; |
|
| 650 | - |
|
| 651 | - /** |
|
| 652 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | - * |
|
| 654 | - * @since 3.15.0 |
|
| 655 | - * @access protected |
|
| 656 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 657 | - */ |
|
| 658 | - protected $rendition_factory; |
|
| 659 | - |
|
| 660 | - /** |
|
| 661 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 662 | - * |
|
| 663 | - * @since 3.15.0 |
|
| 664 | - * @access private |
|
| 665 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 666 | - */ |
|
| 667 | - private $autocomplete_adapter; |
|
| 668 | - |
|
| 669 | - /** |
|
| 670 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 671 | - * |
|
| 672 | - * @since 3.15.0 |
|
| 673 | - * @access protected |
|
| 674 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 675 | - */ |
|
| 676 | - protected $relation_service; |
|
| 677 | - |
|
| 678 | - /** |
|
| 679 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 680 | - * |
|
| 681 | - * @since 3.16.0 |
|
| 682 | - * @access protected |
|
| 683 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 684 | - * |
|
| 685 | - */ |
|
| 686 | - protected $cached_postid_to_jsonld_converter; |
|
| 687 | - |
|
| 688 | - /** |
|
| 689 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 690 | - * |
|
| 691 | - * @since 3.16.3 |
|
| 692 | - * @access protected |
|
| 693 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 694 | - */ |
|
| 695 | - protected $entity_uri_service; |
|
| 696 | - |
|
| 697 | - /** |
|
| 698 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 699 | - * |
|
| 700 | - * @since 3.19.0 |
|
| 701 | - * @access protected |
|
| 702 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 703 | - */ |
|
| 704 | - protected $publisher_service; |
|
| 705 | - |
|
| 706 | - /** |
|
| 707 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 708 | - * |
|
| 709 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 710 | - */ |
|
| 711 | - protected $context_cards_service; |
|
| 712 | - |
|
| 713 | - /** |
|
| 714 | - * {@link Wordlift}'s singleton instance. |
|
| 715 | - * |
|
| 716 | - * @since 3.11.2 |
|
| 717 | - * @access private |
|
| 718 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 719 | - */ |
|
| 720 | - private static $instance; |
|
| 721 | - |
|
| 722 | - //</editor-fold> |
|
| 723 | - |
|
| 724 | - /** |
|
| 725 | - * Define the core functionality of the plugin. |
|
| 726 | - * |
|
| 727 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 728 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 729 | - * the public-facing side of the site. |
|
| 730 | - * |
|
| 731 | - * @since 1.0.0 |
|
| 732 | - */ |
|
| 733 | - public function __construct() { |
|
| 734 | - |
|
| 735 | - self::$instance = $this; |
|
| 736 | - |
|
| 737 | - $this->plugin_name = 'wordlift'; |
|
| 738 | - $this->version = '3.26.0-dev'; |
|
| 739 | - $this->load_dependencies(); |
|
| 740 | - $this->set_locale(); |
|
| 741 | - $this->define_admin_hooks(); |
|
| 742 | - $this->define_public_hooks(); |
|
| 743 | - |
|
| 744 | - // If we're in `WP_CLI` load the related files. |
|
| 745 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 746 | - $this->load_cli_dependencies(); |
|
| 747 | - } |
|
| 748 | - |
|
| 749 | - } |
|
| 750 | - |
|
| 751 | - /** |
|
| 752 | - * Get the singleton instance. |
|
| 753 | - * |
|
| 754 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 755 | - * @since 3.11.2 |
|
| 756 | - * |
|
| 757 | - */ |
|
| 758 | - public static function get_instance() { |
|
| 759 | - |
|
| 760 | - return self::$instance; |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - /** |
|
| 764 | - * Load the required dependencies for this plugin. |
|
| 765 | - * |
|
| 766 | - * Include the following files that make up the plugin: |
|
| 767 | - * |
|
| 768 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 769 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 770 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 771 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 772 | - * |
|
| 773 | - * Create an instance of the loader which will be used to register the hooks |
|
| 774 | - * with WordPress. |
|
| 775 | - * |
|
| 776 | - * @throws Exception |
|
| 777 | - * @since 1.0.0 |
|
| 778 | - * @access private |
|
| 779 | - */ |
|
| 780 | - private function load_dependencies() { |
|
| 781 | - |
|
| 782 | - /** |
|
| 783 | - * The class responsible for orchestrating the actions and filters of the |
|
| 784 | - * core plugin. |
|
| 785 | - */ |
|
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 787 | - |
|
| 788 | - // The class responsible for plugin uninstall. |
|
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 790 | - |
|
| 791 | - /** |
|
| 792 | - * The class responsible for defining internationalization functionality |
|
| 793 | - * of the plugin. |
|
| 794 | - */ |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * WordLift's supported languages. |
|
| 54 | + //<editor-fold desc="## FIELDS"> |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 58 | + * the plugin. |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @access protected |
|
| 62 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 63 | + */ |
|
| 64 | + protected $loader; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * The unique identifier of this plugin. |
|
| 68 | + * |
|
| 69 | + * @since 1.0.0 |
|
| 70 | + * @access protected |
|
| 71 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 72 | + */ |
|
| 73 | + protected $plugin_name; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * The current version of the plugin. |
|
| 77 | + * |
|
| 78 | + * @since 1.0.0 |
|
| 79 | + * @access protected |
|
| 80 | + * @var string $version The current version of the plugin. |
|
| 81 | + */ |
|
| 82 | + protected $version; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 86 | + * |
|
| 87 | + * @since 3.12.0 |
|
| 88 | + * @access protected |
|
| 89 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 90 | + */ |
|
| 91 | + protected $tinymce_adapter; |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 95 | + * @since 3.26.0 |
|
| 96 | + * @access protected |
|
| 97 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter. |
|
| 98 | + */ |
|
| 99 | + protected $faq_tinymce_adapter; |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * The Thumbnail service. |
|
| 103 | + * |
|
| 104 | + * @since 3.1.5 |
|
| 105 | + * @access private |
|
| 106 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 107 | + */ |
|
| 108 | + private $thumbnail_service; |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * The UI service. |
|
| 112 | + * |
|
| 113 | + * @since 3.2.0 |
|
| 114 | + * @access private |
|
| 115 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 116 | + */ |
|
| 117 | + private $ui_service; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The Schema service. |
|
| 121 | + * |
|
| 122 | + * @since 3.3.0 |
|
| 123 | + * @access protected |
|
| 124 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 125 | + */ |
|
| 126 | + protected $schema_service; |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * The Entity service. |
|
| 130 | + * |
|
| 131 | + * @since 3.1.0 |
|
| 132 | + * @access protected |
|
| 133 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 134 | + */ |
|
| 135 | + protected $entity_service; |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * The Topic Taxonomy service. |
|
| 139 | + * |
|
| 140 | + * @since 3.5.0 |
|
| 141 | + * @access private |
|
| 142 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 143 | + */ |
|
| 144 | + private $topic_taxonomy_service; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * The Entity Types Taxonomy service. |
|
| 148 | + * |
|
| 149 | + * @since 3.18.0 |
|
| 150 | + * @access private |
|
| 151 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 152 | + */ |
|
| 153 | + private $entity_types_taxonomy_service; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * The User service. |
|
| 157 | + * |
|
| 158 | + * @since 3.1.7 |
|
| 159 | + * @access protected |
|
| 160 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 161 | + */ |
|
| 162 | + protected $user_service; |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * The Timeline service. |
|
| 166 | + * |
|
| 167 | + * @since 3.1.0 |
|
| 168 | + * @access private |
|
| 169 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 170 | + */ |
|
| 171 | + private $timeline_service; |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * The Redirect service. |
|
| 175 | + * |
|
| 176 | + * @since 3.2.0 |
|
| 177 | + * @access private |
|
| 178 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 179 | + */ |
|
| 180 | + private $redirect_service; |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * The Notice service. |
|
| 184 | + * |
|
| 185 | + * @since 3.3.0 |
|
| 186 | + * @access private |
|
| 187 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 188 | + */ |
|
| 189 | + private $notice_service; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * The Entity list customization. |
|
| 193 | + * |
|
| 194 | + * @since 3.3.0 |
|
| 195 | + * @access protected |
|
| 196 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 197 | + */ |
|
| 198 | + protected $entity_list_service; |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * The Entity Types Taxonomy Walker. |
|
| 202 | + * |
|
| 203 | + * @since 3.1.0 |
|
| 204 | + * @access private |
|
| 205 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 206 | + */ |
|
| 207 | + private $entity_types_taxonomy_walker; |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * The ShareThis service. |
|
| 211 | + * |
|
| 212 | + * @since 3.2.0 |
|
| 213 | + * @access private |
|
| 214 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 215 | + */ |
|
| 216 | + private $sharethis_service; |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * The PrimaShop adapter. |
|
| 220 | + * |
|
| 221 | + * @since 3.2.3 |
|
| 222 | + * @access private |
|
| 223 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 224 | + */ |
|
| 225 | + private $primashop_adapter; |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * The WordLift Dashboard adapter. |
|
| 229 | + * |
|
| 230 | + * @since 3.4.0 |
|
| 231 | + * @access private |
|
| 232 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 233 | + */ |
|
| 234 | + private $dashboard_service; |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * The entity type service. |
|
| 238 | + * |
|
| 239 | + * @since 3.6.0 |
|
| 240 | + * @access private |
|
| 241 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 242 | + */ |
|
| 243 | + private $entity_post_type_service; |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 247 | + * |
|
| 248 | + * @since 3.6.0 |
|
| 249 | + * @access private |
|
| 250 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 251 | + */ |
|
| 252 | + private $entity_link_service; |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 256 | + * |
|
| 257 | + * @since 3.6.0 |
|
| 258 | + * @access protected |
|
| 259 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 260 | + */ |
|
| 261 | + protected $sparql_service; |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * A {@link Wordlift_Import_Service} instance. |
|
| 265 | + * |
|
| 266 | + * @since 3.6.0 |
|
| 267 | + * @access private |
|
| 268 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 269 | + */ |
|
| 270 | + private $import_service; |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 274 | + * |
|
| 275 | + * @since 3.6.0 |
|
| 276 | + * @access private |
|
| 277 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 278 | + */ |
|
| 279 | + private $rebuild_service; |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 283 | + * |
|
| 284 | + * @since 3.7.0 |
|
| 285 | + * @access protected |
|
| 286 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 287 | + */ |
|
| 288 | + protected $jsonld_service; |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 292 | + * |
|
| 293 | + * @since 3.14.0 |
|
| 294 | + * @access protected |
|
| 295 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 296 | + */ |
|
| 297 | + protected $jsonld_website_converter; |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 301 | + * |
|
| 302 | + * @since 3.7.0 |
|
| 303 | + * @access private |
|
| 304 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 305 | + */ |
|
| 306 | + private $property_factory; |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * The 'Download Your Data' page. |
|
| 310 | + * |
|
| 311 | + * @since 3.6.0 |
|
| 312 | + * @access private |
|
| 313 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 314 | + */ |
|
| 315 | + private $download_your_data_page; |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * The 'WordLift Settings' page. |
|
| 319 | + * |
|
| 320 | + * @since 3.11.0 |
|
| 321 | + * @access protected |
|
| 322 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 323 | + */ |
|
| 324 | + protected $settings_page; |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * The install wizard page. |
|
| 328 | + * |
|
| 329 | + * @since 3.9.0 |
|
| 330 | + * @access private |
|
| 331 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 332 | + */ |
|
| 333 | + private $admin_setup; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 337 | + * linking of entities to their pages. |
|
| 338 | + * |
|
| 339 | + * @since 3.8.0 |
|
| 340 | + * @access private |
|
| 341 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 342 | + */ |
|
| 343 | + private $content_filter_service; |
|
| 344 | + |
|
| 345 | + /** |
|
| 346 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 347 | + * |
|
| 348 | + * @since 3.9.0 |
|
| 349 | + * @access private |
|
| 350 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 351 | + */ |
|
| 352 | + private $key_validation_service; |
|
| 353 | + |
|
| 354 | + /** |
|
| 355 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 356 | + * |
|
| 357 | + * @since 3.10.0 |
|
| 358 | + * @access private |
|
| 359 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 360 | + */ |
|
| 361 | + private $rating_service; |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 365 | + * |
|
| 366 | + * @since 3.10.0 |
|
| 367 | + * @access protected |
|
| 368 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 369 | + */ |
|
| 370 | + protected $post_to_jsonld_converter; |
|
| 371 | + |
|
| 372 | + /** |
|
| 373 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 374 | + * |
|
| 375 | + * @since 3.10.0 |
|
| 376 | + * @access protected |
|
| 377 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 378 | + */ |
|
| 379 | + protected $configuration_service; |
|
| 380 | + |
|
| 381 | + /** |
|
| 382 | + * A {@link Wordlift_Install_Service} instance. |
|
| 383 | + * |
|
| 384 | + * @since 3.18.0 |
|
| 385 | + * @access protected |
|
| 386 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 387 | + */ |
|
| 388 | + protected $install_service; |
|
| 389 | + |
|
| 390 | + /** |
|
| 391 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 392 | + * |
|
| 393 | + * @since 3.10.0 |
|
| 394 | + * @access protected |
|
| 395 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 396 | + */ |
|
| 397 | + protected $entity_type_service; |
|
| 398 | + |
|
| 399 | + /** |
|
| 400 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 401 | + * |
|
| 402 | + * @since 3.10.0 |
|
| 403 | + * @access protected |
|
| 404 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 405 | + */ |
|
| 406 | + protected $entity_post_to_jsonld_converter; |
|
| 407 | + |
|
| 408 | + /** |
|
| 409 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 410 | + * |
|
| 411 | + * @since 3.10.0 |
|
| 412 | + * @access protected |
|
| 413 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 414 | + */ |
|
| 415 | + protected $postid_to_jsonld_converter; |
|
| 416 | + |
|
| 417 | + /** |
|
| 418 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 419 | + * |
|
| 420 | + * @since 3.9.8 |
|
| 421 | + * @access private |
|
| 422 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 423 | + */ |
|
| 424 | + private $status_page; |
|
| 425 | + |
|
| 426 | + /** |
|
| 427 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 428 | + * |
|
| 429 | + * @since 3.11.0 |
|
| 430 | + * @access protected |
|
| 431 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 432 | + */ |
|
| 433 | + protected $category_taxonomy_service; |
|
| 434 | + |
|
| 435 | + /** |
|
| 436 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 437 | + * |
|
| 438 | + * @since 3.11.0 |
|
| 439 | + * @access protected |
|
| 440 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 441 | + */ |
|
| 442 | + protected $entity_page_service; |
|
| 443 | + |
|
| 444 | + /** |
|
| 445 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 446 | + * |
|
| 447 | + * @since 3.11.0 |
|
| 448 | + * @access protected |
|
| 449 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 450 | + */ |
|
| 451 | + protected $settings_page_action_link; |
|
| 452 | + |
|
| 453 | + /** |
|
| 454 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 455 | + * |
|
| 456 | + * @since 3.11.0 |
|
| 457 | + * @access protected |
|
| 458 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 459 | + */ |
|
| 460 | + protected $analytics_settings_page_action_link; |
|
| 461 | + |
|
| 462 | + /** |
|
| 463 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 464 | + * |
|
| 465 | + * @since 3.11.0 |
|
| 466 | + * @access protected |
|
| 467 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 468 | + */ |
|
| 469 | + protected $analytics_connect; |
|
| 470 | + |
|
| 471 | + /** |
|
| 472 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 473 | + * |
|
| 474 | + * @since 3.11.0 |
|
| 475 | + * @access protected |
|
| 476 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 477 | + */ |
|
| 478 | + protected $publisher_ajax_adapter; |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 482 | + * |
|
| 483 | + * @since 3.11.0 |
|
| 484 | + * @access protected |
|
| 485 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 486 | + */ |
|
| 487 | + protected $input_element; |
|
| 488 | + |
|
| 489 | + /** |
|
| 490 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 491 | + * |
|
| 492 | + * @since 3.13.0 |
|
| 493 | + * @access protected |
|
| 494 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 495 | + */ |
|
| 496 | + protected $radio_input_element; |
|
| 497 | + |
|
| 498 | + /** |
|
| 499 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 500 | + * |
|
| 501 | + * @since 3.11.0 |
|
| 502 | + * @access protected |
|
| 503 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 504 | + */ |
|
| 505 | + protected $language_select_element; |
|
| 506 | + |
|
| 507 | + /** |
|
| 508 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 509 | + * |
|
| 510 | + * @since 3.18.0 |
|
| 511 | + * @access protected |
|
| 512 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 513 | + */ |
|
| 514 | + protected $country_select_element; |
|
| 515 | + |
|
| 516 | + /** |
|
| 517 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 518 | + * |
|
| 519 | + * @since 3.11.0 |
|
| 520 | + * @access protected |
|
| 521 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 522 | + */ |
|
| 523 | + protected $publisher_element; |
|
| 524 | + |
|
| 525 | + /** |
|
| 526 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 527 | + * |
|
| 528 | + * @since 3.11.0 |
|
| 529 | + * @access protected |
|
| 530 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 531 | + */ |
|
| 532 | + protected $select2_element; |
|
| 533 | + |
|
| 534 | + /** |
|
| 535 | + * The controller for the entity type list admin page |
|
| 536 | + * |
|
| 537 | + * @since 3.11.0 |
|
| 538 | + * @access private |
|
| 539 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 540 | + */ |
|
| 541 | + private $entity_type_admin_page; |
|
| 542 | + |
|
| 543 | + /** |
|
| 544 | + * The controller for the entity type settings admin page |
|
| 545 | + * |
|
| 546 | + * @since 3.11.0 |
|
| 547 | + * @access private |
|
| 548 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 549 | + */ |
|
| 550 | + private $entity_type_settings_admin_page; |
|
| 551 | + |
|
| 552 | + /** |
|
| 553 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 554 | + * |
|
| 555 | + * @since 3.11.0 |
|
| 556 | + * @access protected |
|
| 557 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 558 | + */ |
|
| 559 | + protected $related_entities_cloud_widget; |
|
| 560 | + |
|
| 561 | + /** |
|
| 562 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 563 | + * |
|
| 564 | + * @since 3.14.0 |
|
| 565 | + * @access protected |
|
| 566 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 567 | + */ |
|
| 568 | + protected $author_element; |
|
| 569 | + |
|
| 570 | + /** |
|
| 571 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 572 | + * |
|
| 573 | + * @since 3.12.0 |
|
| 574 | + * @access protected |
|
| 575 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 576 | + */ |
|
| 577 | + protected $sample_data_service; |
|
| 578 | + |
|
| 579 | + /** |
|
| 580 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 581 | + * |
|
| 582 | + * @since 3.12.0 |
|
| 583 | + * @access protected |
|
| 584 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 585 | + */ |
|
| 586 | + protected $sample_data_ajax_adapter; |
|
| 587 | + |
|
| 588 | + /** |
|
| 589 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | + * |
|
| 591 | + * @since 3.14.3 |
|
| 592 | + * @access private |
|
| 593 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 594 | + */ |
|
| 595 | + private $relation_rebuild_service; |
|
| 596 | + |
|
| 597 | + /** |
|
| 598 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | + * |
|
| 600 | + * @since 3.14.3 |
|
| 601 | + * @access private |
|
| 602 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 603 | + */ |
|
| 604 | + private $relation_rebuild_adapter; |
|
| 605 | + |
|
| 606 | + /** |
|
| 607 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | + * |
|
| 609 | + * @since 3.18.0 |
|
| 610 | + * @access private |
|
| 611 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 612 | + */ |
|
| 613 | + private $reference_rebuild_service; |
|
| 614 | + |
|
| 615 | + /** |
|
| 616 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | + * |
|
| 618 | + * @since 3.16.0 |
|
| 619 | + * @access protected |
|
| 620 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 621 | + */ |
|
| 622 | + protected $google_analytics_export_service; |
|
| 623 | + |
|
| 624 | + /** |
|
| 625 | + * {@link Wordlift}'s singleton instance. |
|
| 626 | + * |
|
| 627 | + * @since 3.15.0 |
|
| 628 | + * @access protected |
|
| 629 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 630 | + */ |
|
| 631 | + protected $entity_type_adapter; |
|
| 632 | + |
|
| 633 | + /** |
|
| 634 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | + * |
|
| 636 | + * @since 3.15.0 |
|
| 637 | + * @access protected |
|
| 638 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 639 | + */ |
|
| 640 | + protected $linked_data_service; |
|
| 641 | + |
|
| 642 | + /** |
|
| 643 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | + * |
|
| 645 | + * @since 3.15.0 |
|
| 646 | + * @access protected |
|
| 647 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 648 | + */ |
|
| 649 | + protected $storage_factory; |
|
| 650 | + |
|
| 651 | + /** |
|
| 652 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | + * |
|
| 654 | + * @since 3.15.0 |
|
| 655 | + * @access protected |
|
| 656 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 657 | + */ |
|
| 658 | + protected $rendition_factory; |
|
| 659 | + |
|
| 660 | + /** |
|
| 661 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 662 | + * |
|
| 663 | + * @since 3.15.0 |
|
| 664 | + * @access private |
|
| 665 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 666 | + */ |
|
| 667 | + private $autocomplete_adapter; |
|
| 668 | + |
|
| 669 | + /** |
|
| 670 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 671 | + * |
|
| 672 | + * @since 3.15.0 |
|
| 673 | + * @access protected |
|
| 674 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 675 | + */ |
|
| 676 | + protected $relation_service; |
|
| 677 | + |
|
| 678 | + /** |
|
| 679 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 680 | + * |
|
| 681 | + * @since 3.16.0 |
|
| 682 | + * @access protected |
|
| 683 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 684 | + * |
|
| 685 | + */ |
|
| 686 | + protected $cached_postid_to_jsonld_converter; |
|
| 687 | + |
|
| 688 | + /** |
|
| 689 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 690 | + * |
|
| 691 | + * @since 3.16.3 |
|
| 692 | + * @access protected |
|
| 693 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 694 | + */ |
|
| 695 | + protected $entity_uri_service; |
|
| 696 | + |
|
| 697 | + /** |
|
| 698 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 699 | + * |
|
| 700 | + * @since 3.19.0 |
|
| 701 | + * @access protected |
|
| 702 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 703 | + */ |
|
| 704 | + protected $publisher_service; |
|
| 705 | + |
|
| 706 | + /** |
|
| 707 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 708 | + * |
|
| 709 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 710 | + */ |
|
| 711 | + protected $context_cards_service; |
|
| 712 | + |
|
| 713 | + /** |
|
| 714 | + * {@link Wordlift}'s singleton instance. |
|
| 715 | + * |
|
| 716 | + * @since 3.11.2 |
|
| 717 | + * @access private |
|
| 718 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 719 | + */ |
|
| 720 | + private static $instance; |
|
| 721 | + |
|
| 722 | + //</editor-fold> |
|
| 723 | + |
|
| 724 | + /** |
|
| 725 | + * Define the core functionality of the plugin. |
|
| 726 | + * |
|
| 727 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 728 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 729 | + * the public-facing side of the site. |
|
| 730 | + * |
|
| 731 | + * @since 1.0.0 |
|
| 732 | + */ |
|
| 733 | + public function __construct() { |
|
| 734 | + |
|
| 735 | + self::$instance = $this; |
|
| 736 | + |
|
| 737 | + $this->plugin_name = 'wordlift'; |
|
| 738 | + $this->version = '3.26.0-dev'; |
|
| 739 | + $this->load_dependencies(); |
|
| 740 | + $this->set_locale(); |
|
| 741 | + $this->define_admin_hooks(); |
|
| 742 | + $this->define_public_hooks(); |
|
| 743 | + |
|
| 744 | + // If we're in `WP_CLI` load the related files. |
|
| 745 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 746 | + $this->load_cli_dependencies(); |
|
| 747 | + } |
|
| 748 | + |
|
| 749 | + } |
|
| 750 | + |
|
| 751 | + /** |
|
| 752 | + * Get the singleton instance. |
|
| 753 | + * |
|
| 754 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 755 | + * @since 3.11.2 |
|
| 756 | + * |
|
| 757 | + */ |
|
| 758 | + public static function get_instance() { |
|
| 759 | + |
|
| 760 | + return self::$instance; |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + /** |
|
| 764 | + * Load the required dependencies for this plugin. |
|
| 765 | + * |
|
| 766 | + * Include the following files that make up the plugin: |
|
| 767 | + * |
|
| 768 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 769 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 770 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 771 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 772 | + * |
|
| 773 | + * Create an instance of the loader which will be used to register the hooks |
|
| 774 | + * with WordPress. |
|
| 775 | + * |
|
| 776 | + * @throws Exception |
|
| 777 | + * @since 1.0.0 |
|
| 778 | + * @access private |
|
| 779 | + */ |
|
| 780 | + private function load_dependencies() { |
|
| 781 | + |
|
| 782 | + /** |
|
| 783 | + * The class responsible for orchestrating the actions and filters of the |
|
| 784 | + * core plugin. |
|
| 785 | + */ |
|
| 786 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 787 | + |
|
| 788 | + // The class responsible for plugin uninstall. |
|
| 789 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 790 | + |
|
| 791 | + /** |
|
| 792 | + * The class responsible for defining internationalization functionality |
|
| 793 | + * of the plugin. |
|
| 794 | + */ |
|
| 795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * WordLift's supported languages. |
|
| 799 | + */ |
|
| 800 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 801 | + |
|
| 802 | + /** |
|
| 803 | + * WordLift's supported countries. |
|
| 804 | + */ |
|
| 805 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 806 | + |
|
| 807 | + /** |
|
| 808 | + * Provide support functions to sanitize data. |
|
| 809 | + */ |
|
| 810 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 811 | + |
|
| 812 | + /** Services. */ |
|
| 813 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 814 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 815 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 818 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * The Query builder. |
|
| 826 | + */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 828 | + |
|
| 829 | + /** |
|
| 830 | + * The Schema service. |
|
| 831 | + */ |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 833 | + |
|
| 834 | + /** |
|
| 835 | + * The schema:url property service. |
|
| 836 | + */ |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 839 | + |
|
| 840 | + /** |
|
| 841 | + * The UI service. |
|
| 842 | + */ |
|
| 843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 844 | + |
|
| 845 | + /** |
|
| 846 | + * The Thumbnail service. |
|
| 847 | + */ |
|
| 848 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 849 | + |
|
| 850 | + /** |
|
| 851 | + * The Entity Types Taxonomy service. |
|
| 852 | + */ |
|
| 853 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 854 | + |
|
| 855 | + /** |
|
| 856 | + * The Entity service. |
|
| 857 | + */ |
|
| 858 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 860 | + |
|
| 861 | + // Add the entity rating service. |
|
| 862 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 863 | + |
|
| 864 | + /** |
|
| 865 | + * The User service. |
|
| 866 | + */ |
|
| 867 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 868 | + |
|
| 869 | + /** |
|
| 870 | + * The Timeline service. |
|
| 871 | + */ |
|
| 872 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 873 | + |
|
| 874 | + /** |
|
| 875 | + * The Topic Taxonomy service. |
|
| 876 | + */ |
|
| 877 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 878 | + |
|
| 879 | + /** |
|
| 880 | + * The SPARQL service. |
|
| 881 | + */ |
|
| 882 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 883 | + |
|
| 884 | + /** |
|
| 885 | + * The WordLift import service. |
|
| 886 | + */ |
|
| 887 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 888 | + |
|
| 889 | + /** |
|
| 890 | + * The WordLift URI service. |
|
| 891 | + */ |
|
| 892 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 894 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 895 | + |
|
| 896 | + /** |
|
| 897 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 898 | + */ |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 901 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 902 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 903 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 904 | + |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 907 | + |
|
| 908 | + /** |
|
| 909 | + * Load the converters. |
|
| 910 | + */ |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 913 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 914 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 915 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 916 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 917 | + |
|
| 918 | + /** |
|
| 919 | + * Load cache-related files. |
|
| 920 | + */ |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 922 | + |
|
| 923 | + /** |
|
| 924 | + * Load the content filter. |
|
| 925 | + */ |
|
| 926 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 927 | + |
|
| 928 | + /* |
|
| 929 | + * Load the excerpt helper. |
|
| 799 | 930 | */ |
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 801 | - |
|
| 802 | - /** |
|
| 803 | - * WordLift's supported countries. |
|
| 931 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 932 | + |
|
| 933 | + /** |
|
| 934 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 935 | + * |
|
| 936 | + * @since 3.8.0 |
|
| 937 | + */ |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 939 | + |
|
| 940 | + // The Publisher Service and the AJAX adapter. |
|
| 941 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 942 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 943 | + |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 945 | + |
|
| 946 | + /** |
|
| 947 | + * Load the WordLift key validation service. |
|
| 948 | + */ |
|
| 949 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 950 | + |
|
| 951 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 952 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 953 | + |
|
| 954 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 956 | + |
|
| 957 | + /** Linked Data. */ |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 959 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 960 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 964 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 965 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 969 | + |
|
| 970 | + /** Linked Data Rendition. */ |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 975 | + |
|
| 976 | + /** Services. */ |
|
| 977 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 978 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 979 | + |
|
| 980 | + /** Adapters. */ |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 983 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 984 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 986 | + |
|
| 987 | + /** Async Tasks. */ |
|
| 988 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 989 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 991 | + |
|
| 992 | + /** Autocomplete. */ |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 994 | + |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 996 | + |
|
| 997 | + /** Analytics */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 999 | + |
|
| 1000 | + /** |
|
| 1001 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1002 | + */ |
|
| 1003 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1004 | + |
|
| 1005 | + /** |
|
| 1006 | + * The class to customize the entity list admin page. |
|
| 1007 | + */ |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1009 | + |
|
| 1010 | + /** |
|
| 1011 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1012 | + */ |
|
| 1013 | + global $wp_version; |
|
| 1014 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1015 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1016 | + } else { |
|
| 1017 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1018 | + } |
|
| 1019 | + |
|
| 1020 | + /** |
|
| 1021 | + * The Notice service. |
|
| 1022 | + */ |
|
| 1023 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1024 | + |
|
| 1025 | + /** |
|
| 1026 | + * The PrimaShop adapter. |
|
| 1027 | + */ |
|
| 1028 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1029 | + |
|
| 1030 | + /** |
|
| 1031 | + * The WordLift Dashboard service. |
|
| 1032 | + */ |
|
| 1033 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1034 | + |
|
| 1035 | + /** |
|
| 1036 | + * The admin 'Install wizard' page. |
|
| 1037 | + */ |
|
| 1038 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1039 | + |
|
| 1040 | + /** |
|
| 1041 | + * The WordLift entity type list admin page controller. |
|
| 1042 | + */ |
|
| 1043 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1044 | + |
|
| 1045 | + /** |
|
| 1046 | + * The WordLift entity type settings admin page controller. |
|
| 1047 | + */ |
|
| 1048 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1049 | + |
|
| 1050 | + /** |
|
| 1051 | + * The admin 'Download Your Data' page. |
|
| 1052 | + */ |
|
| 1053 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1054 | + |
|
| 1055 | + /** |
|
| 1056 | + * The admin 'WordLift Settings' page. |
|
| 1057 | + */ |
|
| 1058 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1059 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1060 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1062 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1063 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1064 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1065 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1068 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1069 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1073 | + |
|
| 1074 | + /** Admin Pages */ |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1079 | + |
|
| 1080 | + /** |
|
| 1081 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1082 | + * side of the site. |
|
| 1083 | + */ |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1085 | + |
|
| 1086 | + /** |
|
| 1087 | + * The shortcode abstract class. |
|
| 1088 | + */ |
|
| 1089 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1090 | + |
|
| 1091 | + /** |
|
| 1092 | + * The Timeline shortcode. |
|
| 1093 | + */ |
|
| 1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1095 | + |
|
| 1096 | + /** |
|
| 1097 | + * The Navigator shortcode. |
|
| 1098 | + */ |
|
| 1099 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1100 | + |
|
| 1101 | + /** |
|
| 1102 | + * The chord shortcode. |
|
| 1103 | + */ |
|
| 1104 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1105 | + |
|
| 1106 | + /** |
|
| 1107 | + * The geomap shortcode. |
|
| 1108 | + */ |
|
| 1109 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1110 | + |
|
| 1111 | + /** |
|
| 1112 | + * The entity cloud shortcode. |
|
| 1113 | + */ |
|
| 1114 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1115 | + |
|
| 1116 | + /** |
|
| 1117 | + * The entity glossary shortcode. |
|
| 1118 | + */ |
|
| 1119 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1120 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1121 | + |
|
| 1122 | + /** |
|
| 1123 | + * Faceted Search shortcode. |
|
| 1124 | + */ |
|
| 1125 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1126 | + |
|
| 1127 | + /** |
|
| 1128 | + * The ShareThis service. |
|
| 1129 | + */ |
|
| 1130 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1131 | + |
|
| 1132 | + /** |
|
| 1133 | + * The SEO service. |
|
| 1134 | + */ |
|
| 1135 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1136 | + |
|
| 1137 | + /** |
|
| 1138 | + * The AMP service. |
|
| 1139 | + */ |
|
| 1140 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1141 | + |
|
| 1142 | + /** Widgets */ |
|
| 1143 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1144 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1145 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1146 | + |
|
| 1147 | + /* |
|
| 1148 | + * Schema.org Services. |
|
| 1149 | + * |
|
| 1150 | + * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
|
| 804 | 1151 | */ |
| 805 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 1152 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1154 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1155 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1156 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1157 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1158 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1159 | + } else { |
|
| 1160 | + $schemaorg_property_service = null; |
|
| 1161 | + } |
|
| 806 | 1162 | |
| 807 | - /** |
|
| 808 | - * Provide support functions to sanitize data. |
|
| 809 | - */ |
|
| 810 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 811 | - |
|
| 812 | - /** Services. */ |
|
| 813 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 815 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 818 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * The Query builder. |
|
| 826 | - */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 1163 | + $this->loader = new Wordlift_Loader(); |
|
| 828 | 1164 | |
| 829 | - /** |
|
| 830 | - * The Schema service. |
|
| 831 | - */ |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 1165 | + // Instantiate a global logger. |
|
| 1166 | + global $wl_logger; |
|
| 1167 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 833 | 1168 | |
| 834 | - /** |
|
| 835 | - * The schema:url property service. |
|
| 836 | - */ |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 1169 | + // Load the `wl-api` end-point. |
|
| 1170 | + new Wordlift_Http_Api(); |
|
| 839 | 1171 | |
| 840 | - /** |
|
| 841 | - * The UI service. |
|
| 842 | - */ |
|
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 1172 | + // Load the Install Service. |
|
| 1173 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1174 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 844 | 1175 | |
| 845 | - /** |
|
| 846 | - * The Thumbnail service. |
|
| 847 | - */ |
|
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 1176 | + /** Services. */ |
|
| 1177 | + // Create the configuration service. |
|
| 1178 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1179 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 849 | 1180 | |
| 850 | - /** |
|
| 851 | - * The Entity Types Taxonomy service. |
|
| 852 | - */ |
|
| 853 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 1181 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1182 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 854 | 1183 | |
| 855 | - /** |
|
| 856 | - * The Entity service. |
|
| 857 | - */ |
|
| 858 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 1184 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1185 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 860 | 1186 | |
| 861 | - // Add the entity rating service. |
|
| 862 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 1187 | + // Create an instance of the UI service. |
|
| 1188 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 863 | 1189 | |
| 864 | - /** |
|
| 865 | - * The User service. |
|
| 866 | - */ |
|
| 867 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 1190 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1191 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 868 | 1192 | |
| 869 | - /** |
|
| 870 | - * The Timeline service. |
|
| 871 | - */ |
|
| 872 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 1193 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1194 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1195 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1196 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 873 | 1197 | |
| 874 | - /** |
|
| 875 | - * The Topic Taxonomy service. |
|
| 876 | - */ |
|
| 877 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 1198 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1199 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1200 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1201 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 878 | 1202 | |
| 879 | - /** |
|
| 880 | - * The SPARQL service. |
|
| 881 | - */ |
|
| 882 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 1203 | + // Instantiate the JSON-LD service. |
|
| 1204 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 883 | 1205 | |
| 884 | - /** |
|
| 885 | - * The WordLift import service. |
|
| 886 | - */ |
|
| 887 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 1206 | + /** Linked Data. */ |
|
| 1207 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1208 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 888 | 1209 | |
| 889 | - /** |
|
| 890 | - * The WordLift URI service. |
|
| 891 | - */ |
|
| 892 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 1210 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 895 | 1211 | |
| 896 | - /** |
|
| 897 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 898 | - */ |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 901 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 902 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 903 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 1212 | + // Create a new instance of the Redirect service. |
|
| 1213 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1214 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1215 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 904 | 1216 | |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 1217 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1218 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 907 | 1219 | |
| 908 | - /** |
|
| 909 | - * Load the converters. |
|
| 910 | - */ |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 913 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 916 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 917 | - |
|
| 918 | - /** |
|
| 919 | - * Load cache-related files. |
|
| 920 | - */ |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 1220 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 922 | 1221 | |
| 923 | - /** |
|
| 924 | - * Load the content filter. |
|
| 925 | - */ |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 1222 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1223 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 927 | 1224 | |
| 928 | - /* |
|
| 929 | - * Load the excerpt helper. |
|
| 930 | - */ |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 1225 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1226 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 932 | 1227 | |
| 933 | - /** |
|
| 934 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 935 | - * |
|
| 936 | - * @since 3.8.0 |
|
| 937 | - */ |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 1228 | + // Create an instance of the PrimaShop adapter. |
|
| 1229 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 939 | 1230 | |
| 940 | - // The Publisher Service and the AJAX adapter. |
|
| 941 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 942 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 1231 | + // Create an import service instance to hook later to WP's import function. |
|
| 1232 | + $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() ); |
|
| 943 | 1233 | |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 1234 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 945 | 1235 | |
| 946 | - /** |
|
| 947 | - * Load the WordLift key validation service. |
|
| 948 | - */ |
|
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 950 | - |
|
| 951 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 952 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 953 | - |
|
| 954 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 956 | - |
|
| 957 | - /** Linked Data. */ |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 960 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 965 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 969 | - |
|
| 970 | - /** Linked Data Rendition. */ |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 975 | - |
|
| 976 | - /** Services. */ |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 979 | - |
|
| 980 | - /** Adapters. */ |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 986 | - |
|
| 987 | - /** Async Tasks. */ |
|
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 991 | - |
|
| 992 | - /** Autocomplete. */ |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 994 | - |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 996 | - |
|
| 997 | - /** Analytics */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 999 | - |
|
| 1000 | - /** |
|
| 1001 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1002 | - */ |
|
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1236 | + // Create the entity rating service. |
|
| 1237 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1004 | 1238 | |
| 1005 | - /** |
|
| 1006 | - * The class to customize the entity list admin page. |
|
| 1007 | - */ |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1239 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1240 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1009 | 1241 | |
| 1010 | - /** |
|
| 1011 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1012 | - */ |
|
| 1013 | - global $wp_version; |
|
| 1014 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1016 | - } else { |
|
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1018 | - } |
|
| 1019 | - |
|
| 1020 | - /** |
|
| 1021 | - * The Notice service. |
|
| 1022 | - */ |
|
| 1023 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1242 | + // Create a new instance of the Redirect service. |
|
| 1243 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1024 | 1244 | |
| 1025 | - /** |
|
| 1026 | - * The PrimaShop adapter. |
|
| 1027 | - */ |
|
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1245 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1246 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1247 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1248 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1029 | 1249 | |
| 1030 | - /** |
|
| 1031 | - * The WordLift Dashboard service. |
|
| 1032 | - */ |
|
| 1033 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1250 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1034 | 1251 | |
| 1035 | - /** |
|
| 1036 | - * The admin 'Install wizard' page. |
|
| 1037 | - */ |
|
| 1038 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1252 | + // Instantiate the JSON-LD service. |
|
| 1253 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1254 | + $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 ); |
|
| 1255 | + $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 ); |
|
| 1256 | + $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 ); |
|
| 1257 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1039 | 1258 | |
| 1040 | - /** |
|
| 1041 | - * The WordLift entity type list admin page controller. |
|
| 1042 | - */ |
|
| 1043 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1259 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1260 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1261 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1262 | + new Jsonld_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1263 | + // Prints the JSON-LD in the head. |
|
| 1264 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1044 | 1265 | |
| 1045 | - /** |
|
| 1046 | - * The WordLift entity type settings admin page controller. |
|
| 1047 | - */ |
|
| 1048 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1266 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1267 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1268 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1269 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1270 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1271 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1049 | 1272 | |
| 1050 | - /** |
|
| 1051 | - * The admin 'Download Your Data' page. |
|
| 1052 | - */ |
|
| 1053 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1273 | + // Initialize the short-codes. |
|
| 1274 | + new Wordlift_Navigator_Shortcode(); |
|
| 1275 | + new Wordlift_Chord_Shortcode(); |
|
| 1276 | + new Wordlift_Geomap_Shortcode(); |
|
| 1277 | + new Wordlift_Timeline_Shortcode(); |
|
| 1278 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1279 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1280 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1054 | 1281 | |
| 1055 | - /** |
|
| 1056 | - * The admin 'WordLift Settings' page. |
|
| 1057 | - */ |
|
| 1058 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1059 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1062 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1063 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1064 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1073 | - |
|
| 1074 | - /** Admin Pages */ |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1079 | - |
|
| 1080 | - /** |
|
| 1081 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1082 | - * side of the site. |
|
| 1083 | - */ |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1282 | + // Initialize the SEO service. |
|
| 1283 | + new Wordlift_Seo_Service(); |
|
| 1085 | 1284 | |
| 1086 | - /** |
|
| 1087 | - * The shortcode abstract class. |
|
| 1088 | - */ |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1285 | + // Initialize the AMP service. |
|
| 1286 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1090 | 1287 | |
| 1091 | - /** |
|
| 1092 | - * The Timeline shortcode. |
|
| 1093 | - */ |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1288 | + /** Services. */ |
|
| 1289 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1290 | + new Wordlift_Image_Service(); |
|
| 1095 | 1291 | |
| 1096 | - /** |
|
| 1097 | - * The Navigator shortcode. |
|
| 1098 | - */ |
|
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1292 | + /** Adapters. */ |
|
| 1293 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1294 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1295 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1296 | + $this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1297 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1100 | 1298 | |
| 1101 | - /** |
|
| 1102 | - * The chord shortcode. |
|
| 1103 | - */ |
|
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1105 | - |
|
| 1106 | - /** |
|
| 1107 | - * The geomap shortcode. |
|
| 1108 | - */ |
|
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1110 | - |
|
| 1111 | - /** |
|
| 1112 | - * The entity cloud shortcode. |
|
| 1113 | - */ |
|
| 1114 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1115 | - |
|
| 1116 | - /** |
|
| 1117 | - * The entity glossary shortcode. |
|
| 1118 | - */ |
|
| 1119 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1120 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1121 | - |
|
| 1122 | - /** |
|
| 1123 | - * Faceted Search shortcode. |
|
| 1124 | - */ |
|
| 1125 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1126 | - |
|
| 1127 | - /** |
|
| 1128 | - * The ShareThis service. |
|
| 1129 | - */ |
|
| 1130 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1131 | - |
|
| 1132 | - /** |
|
| 1133 | - * The SEO service. |
|
| 1134 | - */ |
|
| 1135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1136 | - |
|
| 1137 | - /** |
|
| 1138 | - * The AMP service. |
|
| 1139 | - */ |
|
| 1140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1141 | - |
|
| 1142 | - /** Widgets */ |
|
| 1143 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1145 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1146 | - |
|
| 1147 | - /* |
|
| 1148 | - * Schema.org Services. |
|
| 1299 | + /* |
|
| 1300 | + * Exclude our public js from WP-Rocket. |
|
| 1149 | 1301 | * |
| 1150 | - * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
|
| 1302 | + * @since 3.19.4 |
|
| 1303 | + * |
|
| 1304 | + * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
|
| 1151 | 1305 | */ |
| 1152 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1155 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1156 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1157 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1158 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1159 | - } else { |
|
| 1160 | - $schemaorg_property_service = null; |
|
| 1161 | - } |
|
| 1162 | - |
|
| 1163 | - $this->loader = new Wordlift_Loader(); |
|
| 1306 | + new Wordlift_WpRocket_Adapter(); |
|
| 1164 | 1307 | |
| 1165 | - // Instantiate a global logger. |
|
| 1166 | - global $wl_logger; |
|
| 1167 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1308 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1309 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1310 | + $this->sparql_service, |
|
| 1311 | + $uri_service |
|
| 1312 | + ); |
|
| 1168 | 1313 | |
| 1169 | - // Load the `wl-api` end-point. |
|
| 1170 | - new Wordlift_Http_Api(); |
|
| 1314 | + /** Async Tasks. */ |
|
| 1315 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1316 | + new Wordlift_Push_References_Async_Task(); |
|
| 1171 | 1317 | |
| 1172 | - // Load the Install Service. |
|
| 1173 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1174 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1318 | + /** WordPress Admin UI. */ |
|
| 1175 | 1319 | |
| 1176 | - /** Services. */ |
|
| 1177 | - // Create the configuration service. |
|
| 1178 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1179 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1180 | - |
|
| 1181 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1182 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1183 | - |
|
| 1184 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1185 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1320 | + // UI elements. |
|
| 1321 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1322 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1323 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1324 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1325 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1326 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1327 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1328 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1186 | 1329 | |
| 1187 | - // Create an instance of the UI service. |
|
| 1188 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1330 | + $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 ); |
|
| 1331 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1189 | 1332 | |
| 1190 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1191 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1333 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1334 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1335 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1192 | 1336 | |
| 1193 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1194 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1195 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1196 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1197 | - |
|
| 1198 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1199 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1200 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1201 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1202 | - |
|
| 1203 | - // Instantiate the JSON-LD service. |
|
| 1204 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1205 | - |
|
| 1206 | - /** Linked Data. */ |
|
| 1207 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1208 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1209 | - |
|
| 1210 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1211 | - |
|
| 1212 | - // Create a new instance of the Redirect service. |
|
| 1213 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1214 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1215 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1216 | - |
|
| 1217 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1218 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1219 | - |
|
| 1220 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1221 | - |
|
| 1222 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1223 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1224 | - |
|
| 1225 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1226 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1227 | - |
|
| 1228 | - // Create an instance of the PrimaShop adapter. |
|
| 1229 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1230 | - |
|
| 1231 | - // Create an import service instance to hook later to WP's import function. |
|
| 1232 | - $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() ); |
|
| 1233 | - |
|
| 1234 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1235 | - |
|
| 1236 | - // Create the entity rating service. |
|
| 1237 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1238 | - |
|
| 1239 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1240 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1241 | - |
|
| 1242 | - // Create a new instance of the Redirect service. |
|
| 1243 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1244 | - |
|
| 1245 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1246 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1247 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1248 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1249 | - |
|
| 1250 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1251 | - |
|
| 1252 | - // Instantiate the JSON-LD service. |
|
| 1253 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1254 | - $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 ); |
|
| 1255 | - $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 ); |
|
| 1256 | - $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 ); |
|
| 1257 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1258 | - |
|
| 1259 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1260 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1261 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1262 | - new Jsonld_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1263 | - // Prints the JSON-LD in the head. |
|
| 1264 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1265 | - |
|
| 1266 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1267 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1268 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1269 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1270 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1271 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1272 | - |
|
| 1273 | - // Initialize the short-codes. |
|
| 1274 | - new Wordlift_Navigator_Shortcode(); |
|
| 1275 | - new Wordlift_Chord_Shortcode(); |
|
| 1276 | - new Wordlift_Geomap_Shortcode(); |
|
| 1277 | - new Wordlift_Timeline_Shortcode(); |
|
| 1278 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1279 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1280 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1281 | - |
|
| 1282 | - // Initialize the SEO service. |
|
| 1283 | - new Wordlift_Seo_Service(); |
|
| 1284 | - |
|
| 1285 | - // Initialize the AMP service. |
|
| 1286 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1287 | - |
|
| 1288 | - /** Services. */ |
|
| 1289 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1290 | - new Wordlift_Image_Service(); |
|
| 1291 | - |
|
| 1292 | - /** Adapters. */ |
|
| 1293 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1294 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1295 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1296 | - $this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1297 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1298 | - |
|
| 1299 | - /* |
|
| 1300 | - * Exclude our public js from WP-Rocket. |
|
| 1301 | - * |
|
| 1302 | - * @since 3.19.4 |
|
| 1303 | - * |
|
| 1304 | - * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
|
| 1305 | - */ |
|
| 1306 | - new Wordlift_WpRocket_Adapter(); |
|
| 1307 | - |
|
| 1308 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1309 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1310 | - $this->sparql_service, |
|
| 1311 | - $uri_service |
|
| 1312 | - ); |
|
| 1313 | - |
|
| 1314 | - /** Async Tasks. */ |
|
| 1315 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1316 | - new Wordlift_Push_References_Async_Task(); |
|
| 1317 | - |
|
| 1318 | - /** WordPress Admin UI. */ |
|
| 1319 | - |
|
| 1320 | - // UI elements. |
|
| 1321 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1322 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1323 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1324 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1325 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1326 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1327 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1328 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1329 | - |
|
| 1330 | - $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 ); |
|
| 1331 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1332 | - |
|
| 1333 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1334 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1335 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1336 | - |
|
| 1337 | - // Pages. |
|
| 1338 | - /* |
|
| 1337 | + // Pages. |
|
| 1338 | + /* |
|
| 1339 | 1339 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1340 | 1340 | * |
| 1341 | 1341 | * @since 3.20.3 |
| 1342 | 1342 | * |
| 1343 | 1343 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1344 | 1344 | */ |
| 1345 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1346 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1347 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1348 | - } |
|
| 1349 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1345 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1346 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1347 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1348 | + } |
|
| 1349 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1350 | 1350 | |
| 1351 | - // create an instance of the entity type list admin page controller. |
|
| 1352 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1351 | + // create an instance of the entity type list admin page controller. |
|
| 1352 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1353 | 1353 | |
| 1354 | - // create an instance of the entity type setting admin page controller. |
|
| 1355 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1354 | + // create an instance of the entity type setting admin page controller. |
|
| 1355 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1356 | 1356 | |
| 1357 | - /** Widgets */ |
|
| 1358 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1357 | + /** Widgets */ |
|
| 1358 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1359 | 1359 | |
| 1360 | - /* WordPress Admin. */ |
|
| 1361 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1362 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1360 | + /* WordPress Admin. */ |
|
| 1361 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1362 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1363 | 1363 | |
| 1364 | - // Create an instance of the install wizard. |
|
| 1365 | - $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 ); |
|
| 1364 | + // Create an instance of the install wizard. |
|
| 1365 | + $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 ); |
|
| 1366 | 1366 | |
| 1367 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1367 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1368 | 1368 | |
| 1369 | - // User Profile. |
|
| 1370 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1369 | + // User Profile. |
|
| 1370 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1371 | 1371 | |
| 1372 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1372 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1373 | 1373 | |
| 1374 | - // Load the debug service if WP is in debug mode. |
|
| 1375 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1376 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1377 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1378 | - } |
|
| 1374 | + // Load the debug service if WP is in debug mode. |
|
| 1375 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1376 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1377 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1378 | + } |
|
| 1379 | 1379 | |
| 1380 | - // Remote Image Service. |
|
| 1381 | - new Wordlift_Remote_Image_Service(); |
|
| 1380 | + // Remote Image Service. |
|
| 1381 | + new Wordlift_Remote_Image_Service(); |
|
| 1382 | 1382 | |
| 1383 | - /* |
|
| 1383 | + /* |
|
| 1384 | 1384 | * Provides mappings between post types and entity types. |
| 1385 | 1385 | * |
| 1386 | 1386 | * @since 3.20.0 |
| 1387 | 1387 | * |
| 1388 | 1388 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1389 | 1389 | */ |
| 1390 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1391 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1392 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1390 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1391 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1392 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1393 | 1393 | |
| 1394 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1395 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1394 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1395 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1396 | 1396 | |
| 1397 | - /* |
|
| 1397 | + /* |
|
| 1398 | 1398 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1399 | 1399 | * |
| 1400 | 1400 | * Eventually Batch Actions will become Batch Operations. |
| 1401 | 1401 | * |
| 1402 | 1402 | * @since 3.20.0 |
| 1403 | 1403 | */ |
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1404 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1405 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1406 | 1406 | |
| 1407 | - /* |
|
| 1407 | + /* |
|
| 1408 | 1408 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1409 | 1409 | * |
| 1410 | 1410 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1411 | 1411 | * |
| 1412 | 1412 | * @since 3.20.0 |
| 1413 | 1413 | */ |
| 1414 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1415 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1414 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1415 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1416 | 1416 | |
| 1417 | - /* |
|
| 1417 | + /* |
|
| 1418 | 1418 | * Load dependencies for the front-end. |
| 1419 | 1419 | * |
| 1420 | 1420 | * @since 3.20.0 |
| 1421 | 1421 | */ |
| 1422 | - if ( ! is_admin() ) { |
|
| 1423 | - /* |
|
| 1422 | + if ( ! is_admin() ) { |
|
| 1423 | + /* |
|
| 1424 | 1424 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1425 | 1425 | * |
| 1426 | 1426 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1427 | 1427 | * |
| 1428 | 1428 | * @since 3.20.0 |
| 1429 | 1429 | */ |
| 1430 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1431 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1432 | - } |
|
| 1430 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1431 | + new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1432 | + } |
|
| 1433 | 1433 | |
| 1434 | - /* |
|
| 1434 | + /* |
|
| 1435 | 1435 | * Initialize the Context Cards Service |
| 1436 | 1436 | * |
| 1437 | 1437 | * @link https://github.com/insideout10/wordlift-plugin/issues/934 |
| 1438 | 1438 | * |
| 1439 | 1439 | * @since 3.22.0 |
| 1440 | 1440 | */ |
| 1441 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1441 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1442 | 1442 | |
| 1443 | - /* |
|
| 1443 | + /* |
|
| 1444 | 1444 | * Load the Mappings JSON-LD post processing. |
| 1445 | 1445 | * |
| 1446 | 1446 | * @since 3.25.0 |
| 1447 | 1447 | */ |
| 1448 | 1448 | |
| 1449 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1450 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1451 | - new Post_Type_Rule_Validator(); |
|
| 1452 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1453 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1454 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1449 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1450 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1451 | + new Post_Type_Rule_Validator(); |
|
| 1452 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1453 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1454 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1455 | 1455 | |
| 1456 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1457 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1458 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1456 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1457 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1458 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1459 | 1459 | |
| 1460 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1460 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1461 | 1461 | |
| 1462 | - /** |
|
| 1463 | - * @since 3.26.0 |
|
| 1464 | - * Initialize the Faq JSON LD converter here. |
|
| 1465 | - */ |
|
| 1466 | - new Faq_To_Jsonld_Converter(); |
|
| 1467 | - /* |
|
| 1462 | + /** |
|
| 1463 | + * @since 3.26.0 |
|
| 1464 | + * Initialize the Faq JSON LD converter here. |
|
| 1465 | + */ |
|
| 1466 | + new Faq_To_Jsonld_Converter(); |
|
| 1467 | + /* |
|
| 1468 | 1468 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1469 | 1469 | * end-point. |
| 1470 | 1470 | * |
| 1471 | 1471 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1472 | 1472 | * @since 3.24.4 |
| 1473 | 1473 | */ |
| 1474 | - new Templates_Ajax_Endpoint(); |
|
| 1475 | - // Call this static method to register FAQ routes to rest api |
|
| 1476 | - FAQ_Rest_Controller::register_routes(); |
|
| 1474 | + new Templates_Ajax_Endpoint(); |
|
| 1475 | + // Call this static method to register FAQ routes to rest api |
|
| 1476 | + FAQ_Rest_Controller::register_routes(); |
|
| 1477 | 1477 | |
| 1478 | - /* |
|
| 1478 | + /* |
|
| 1479 | 1479 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1480 | 1480 | */ |
| 1481 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1482 | - new Analysis_Response_Ops_Factory( |
|
| 1483 | - $this->entity_uri_service, |
|
| 1484 | - $this->entity_service, |
|
| 1485 | - $this->entity_type_service, |
|
| 1486 | - $this->storage_factory->post_images(), |
|
| 1487 | - $entity_helper |
|
| 1488 | - ); |
|
| 1489 | - |
|
| 1490 | - /** WL Autocomplete. */ |
|
| 1491 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1492 | - new Local_Autocomplete_Service(), |
|
| 1493 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1494 | - ) ); |
|
| 1495 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1496 | - |
|
| 1497 | - } |
|
| 1498 | - |
|
| 1499 | - /** |
|
| 1500 | - * Define the locale for this plugin for internationalization. |
|
| 1501 | - * |
|
| 1502 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1503 | - * with WordPress. |
|
| 1504 | - * |
|
| 1505 | - * @since 1.0.0 |
|
| 1506 | - * @access private |
|
| 1507 | - */ |
|
| 1508 | - private function set_locale() { |
|
| 1509 | - |
|
| 1510 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1511 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1512 | - |
|
| 1513 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1514 | - |
|
| 1515 | - } |
|
| 1516 | - |
|
| 1517 | - /** |
|
| 1518 | - * Register all of the hooks related to the admin area functionality |
|
| 1519 | - * of the plugin. |
|
| 1520 | - * |
|
| 1521 | - * @since 1.0.0 |
|
| 1522 | - * @access private |
|
| 1523 | - */ |
|
| 1524 | - private function define_admin_hooks() { |
|
| 1525 | - |
|
| 1526 | - $plugin_admin = new Wordlift_Admin( |
|
| 1527 | - $this->get_plugin_name(), |
|
| 1528 | - $this->get_version(), |
|
| 1529 | - $this->configuration_service, |
|
| 1530 | - $this->notice_service, |
|
| 1531 | - $this->user_service |
|
| 1532 | - ); |
|
| 1533 | - |
|
| 1534 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1535 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1536 | - |
|
| 1537 | - // Hook the init action to taxonomy services. |
|
| 1538 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1539 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1540 | - |
|
| 1541 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1542 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1543 | - |
|
| 1544 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1545 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1546 | - |
|
| 1547 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1548 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1549 | - |
|
| 1550 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1551 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1552 | - |
|
| 1553 | - // Register custom allowed redirect hosts. |
|
| 1554 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1555 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1556 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1557 | - |
|
| 1558 | - /* |
|
| 1481 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1482 | + new Analysis_Response_Ops_Factory( |
|
| 1483 | + $this->entity_uri_service, |
|
| 1484 | + $this->entity_service, |
|
| 1485 | + $this->entity_type_service, |
|
| 1486 | + $this->storage_factory->post_images(), |
|
| 1487 | + $entity_helper |
|
| 1488 | + ); |
|
| 1489 | + |
|
| 1490 | + /** WL Autocomplete. */ |
|
| 1491 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1492 | + new Local_Autocomplete_Service(), |
|
| 1493 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1494 | + ) ); |
|
| 1495 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1496 | + |
|
| 1497 | + } |
|
| 1498 | + |
|
| 1499 | + /** |
|
| 1500 | + * Define the locale for this plugin for internationalization. |
|
| 1501 | + * |
|
| 1502 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1503 | + * with WordPress. |
|
| 1504 | + * |
|
| 1505 | + * @since 1.0.0 |
|
| 1506 | + * @access private |
|
| 1507 | + */ |
|
| 1508 | + private function set_locale() { |
|
| 1509 | + |
|
| 1510 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1511 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1512 | + |
|
| 1513 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1514 | + |
|
| 1515 | + } |
|
| 1516 | + |
|
| 1517 | + /** |
|
| 1518 | + * Register all of the hooks related to the admin area functionality |
|
| 1519 | + * of the plugin. |
|
| 1520 | + * |
|
| 1521 | + * @since 1.0.0 |
|
| 1522 | + * @access private |
|
| 1523 | + */ |
|
| 1524 | + private function define_admin_hooks() { |
|
| 1525 | + |
|
| 1526 | + $plugin_admin = new Wordlift_Admin( |
|
| 1527 | + $this->get_plugin_name(), |
|
| 1528 | + $this->get_version(), |
|
| 1529 | + $this->configuration_service, |
|
| 1530 | + $this->notice_service, |
|
| 1531 | + $this->user_service |
|
| 1532 | + ); |
|
| 1533 | + |
|
| 1534 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1535 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1536 | + |
|
| 1537 | + // Hook the init action to taxonomy services. |
|
| 1538 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1539 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1540 | + |
|
| 1541 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1542 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1543 | + |
|
| 1544 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1545 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1546 | + |
|
| 1547 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1548 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1549 | + |
|
| 1550 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1551 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1552 | + |
|
| 1553 | + // Register custom allowed redirect hosts. |
|
| 1554 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1555 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1556 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1557 | + |
|
| 1558 | + /* |
|
| 1559 | 1559 | * The old dashboard is replaced with dashboard v2. |
| 1560 | 1560 | * |
| 1561 | 1561 | * The old dashboard service is still loaded because its functions are used. |
@@ -1564,313 +1564,313 @@ discard block |
||
| 1564 | 1564 | * |
| 1565 | 1565 | * @since 3.20.0 |
| 1566 | 1566 | */ |
| 1567 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1568 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1569 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1570 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1571 | - |
|
| 1572 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1573 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1574 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1575 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1576 | - |
|
| 1577 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1578 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1579 | - |
|
| 1580 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1581 | - // Add custom columns. |
|
| 1582 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1583 | - // no explicit entity as it prevents handling of other post types. |
|
| 1584 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1585 | - // Add 4W selection. |
|
| 1586 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1587 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1588 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1589 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1590 | - |
|
| 1591 | - /* |
|
| 1567 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1568 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1569 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1570 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1571 | + |
|
| 1572 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1573 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1574 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1575 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1576 | + |
|
| 1577 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1578 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1579 | + |
|
| 1580 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1581 | + // Add custom columns. |
|
| 1582 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1583 | + // no explicit entity as it prevents handling of other post types. |
|
| 1584 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1585 | + // Add 4W selection. |
|
| 1586 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1587 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1588 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1589 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1590 | + |
|
| 1591 | + /* |
|
| 1592 | 1592 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1593 | 1593 | * |
| 1594 | 1594 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1595 | 1595 | */ |
| 1596 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1597 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1598 | - } |
|
| 1596 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1597 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1598 | + } |
|
| 1599 | 1599 | |
| 1600 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1601 | - // entities. |
|
| 1602 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1600 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1601 | + // entities. |
|
| 1602 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1603 | 1603 | |
| 1604 | - // Filter imported post meta. |
|
| 1605 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1604 | + // Filter imported post meta. |
|
| 1605 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1606 | 1606 | |
| 1607 | - // Notify the import service when an import starts and ends. |
|
| 1608 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1609 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1607 | + // Notify the import service when an import starts and ends. |
|
| 1608 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1609 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1610 | 1610 | |
| 1611 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1612 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1613 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1611 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1612 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1613 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1614 | 1614 | |
| 1615 | - // Hook the menu to the Download Your Data page. |
|
| 1616 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1617 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1618 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1615 | + // Hook the menu to the Download Your Data page. |
|
| 1616 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1617 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1618 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1619 | 1619 | |
| 1620 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1621 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1620 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1621 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1622 | 1622 | |
| 1623 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1624 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1625 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1626 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1623 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1624 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1625 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1626 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1627 | 1627 | |
| 1628 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1629 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1628 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1629 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1630 | 1630 | |
| 1631 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1632 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1631 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1632 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1633 | 1633 | |
| 1634 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1635 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1634 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1635 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1636 | 1636 | |
| 1637 | - // Hook the admin_init to the settings page. |
|
| 1638 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1639 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1637 | + // Hook the admin_init to the settings page. |
|
| 1638 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1639 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1640 | 1640 | |
| 1641 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1641 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1642 | 1642 | |
| 1643 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1644 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1643 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1644 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1645 | 1645 | |
| 1646 | - /* |
|
| 1646 | + /* |
|
| 1647 | 1647 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1648 | 1648 | * |
| 1649 | 1649 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1650 | 1650 | * |
| 1651 | 1651 | * @since 3.20.0 |
| 1652 | 1652 | */ |
| 1653 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1654 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1655 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1656 | - } |
|
| 1653 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1654 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1655 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1656 | + } |
|
| 1657 | 1657 | |
| 1658 | - // Hook key update. |
|
| 1659 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1660 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1658 | + // Hook key update. |
|
| 1659 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1660 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1661 | 1661 | |
| 1662 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1663 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1662 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1663 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1664 | 1664 | |
| 1665 | - /* |
|
| 1665 | + /* |
|
| 1666 | 1666 | * Remove the Analytics Settings link from the plugin page. |
| 1667 | 1667 | * |
| 1668 | 1668 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1669 | 1669 | * @since 3.21.1 |
| 1670 | 1670 | */ |
| 1671 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1671 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1672 | 1672 | |
| 1673 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1674 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1673 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1674 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1675 | 1675 | |
| 1676 | - // Hook row actions for the entity type list admin. |
|
| 1677 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1676 | + // Hook row actions for the entity type list admin. |
|
| 1677 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1678 | 1678 | |
| 1679 | - /** Ajax actions. */ |
|
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1679 | + /** Ajax actions. */ |
|
| 1680 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1681 | 1681 | |
| 1682 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1683 | - // page on WordPress versions before 4.7. |
|
| 1684 | - global $wp_version; |
|
| 1685 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1686 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1687 | - } |
|
| 1688 | - |
|
| 1689 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1690 | - |
|
| 1691 | - /** Adapters. */ |
|
| 1692 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1693 | - /** |
|
| 1694 | - * Load the tinymce editor button on the tool bar. |
|
| 1695 | - * @since 3.26.0 |
|
| 1696 | - */ |
|
| 1697 | - $this->loader->add_filter('mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1); |
|
| 1698 | - $this->loader->add_filter('mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1); |
|
| 1682 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1683 | + // page on WordPress versions before 4.7. |
|
| 1684 | + global $wp_version; |
|
| 1685 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1686 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1687 | + } |
|
| 1699 | 1688 | |
| 1689 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1700 | 1690 | |
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1702 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1703 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1691 | + /** Adapters. */ |
|
| 1692 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1693 | + /** |
|
| 1694 | + * Load the tinymce editor button on the tool bar. |
|
| 1695 | + * @since 3.26.0 |
|
| 1696 | + */ |
|
| 1697 | + $this->loader->add_filter('mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1); |
|
| 1698 | + $this->loader->add_filter('mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1); |
|
| 1704 | 1699 | |
| 1705 | 1700 | |
| 1706 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1707 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1701 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1702 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1703 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1708 | 1704 | |
| 1709 | - // Handle the autocomplete request. |
|
| 1710 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1711 | - $this->autocomplete_adapter, |
|
| 1712 | - 'wl_autocomplete', |
|
| 1713 | - ) ); |
|
| 1714 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1715 | - $this->autocomplete_adapter, |
|
| 1716 | - 'wl_autocomplete', |
|
| 1717 | - ) ); |
|
| 1718 | 1705 | |
| 1719 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1720 | - if ( is_multisite() ) { |
|
| 1721 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1722 | - } |
|
| 1723 | - |
|
| 1724 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1725 | - |
|
| 1726 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1727 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1728 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1729 | - |
|
| 1730 | - /** |
|
| 1731 | - * Always allow the `wordlift/classification` block. |
|
| 1732 | - * |
|
| 1733 | - * @since 3.23.0 |
|
| 1734 | - */ |
|
| 1735 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1706 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1707 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1736 | 1708 | |
| 1737 | - if ( true === $value ) { |
|
| 1738 | - return $value; |
|
| 1739 | - } |
|
| 1709 | + // Handle the autocomplete request. |
|
| 1710 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1711 | + $this->autocomplete_adapter, |
|
| 1712 | + 'wl_autocomplete', |
|
| 1713 | + ) ); |
|
| 1714 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1715 | + $this->autocomplete_adapter, |
|
| 1716 | + 'wl_autocomplete', |
|
| 1717 | + ) ); |
|
| 1740 | 1718 | |
| 1741 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1742 | - }, PHP_INT_MAX ); |
|
| 1719 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1720 | + if ( is_multisite() ) { |
|
| 1721 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1722 | + } |
|
| 1743 | 1723 | |
| 1744 | - } |
|
| 1724 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1745 | 1725 | |
| 1746 | - /** |
|
| 1747 | - * Register all of the hooks related to the public-facing functionality |
|
| 1748 | - * of the plugin. |
|
| 1749 | - * |
|
| 1750 | - * @since 1.0.0 |
|
| 1751 | - * @access private |
|
| 1752 | - */ |
|
| 1753 | - private function define_public_hooks() { |
|
| 1726 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1727 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1728 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1754 | 1729 | |
| 1755 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1730 | + /** |
|
| 1731 | + * Always allow the `wordlift/classification` block. |
|
| 1732 | + * |
|
| 1733 | + * @since 3.23.0 |
|
| 1734 | + */ |
|
| 1735 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1756 | 1736 | |
| 1757 | - // Register the entity post type. |
|
| 1758 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1737 | + if ( true === $value ) { |
|
| 1738 | + return $value; |
|
| 1739 | + } |
|
| 1759 | 1740 | |
| 1760 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1761 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1762 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1763 | - $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 ); |
|
| 1764 | - $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 ); |
|
| 1741 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1742 | + }, PHP_INT_MAX ); |
|
| 1765 | 1743 | |
| 1766 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1767 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1768 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1744 | + } |
|
| 1769 | 1745 | |
| 1770 | - // Hook the content filter service to add entity links. |
|
| 1771 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1772 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1773 | - } |
|
| 1746 | + /** |
|
| 1747 | + * Register all of the hooks related to the public-facing functionality |
|
| 1748 | + * of the plugin. |
|
| 1749 | + * |
|
| 1750 | + * @since 1.0.0 |
|
| 1751 | + * @access private |
|
| 1752 | + */ |
|
| 1753 | + private function define_public_hooks() { |
|
| 1774 | 1754 | |
| 1775 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1776 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1755 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1777 | 1756 | |
| 1778 | - // Hook the ShareThis service. |
|
| 1779 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1780 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1757 | + // Register the entity post type. |
|
| 1758 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1781 | 1759 | |
| 1782 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1783 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1760 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1761 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1762 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1763 | + $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 ); |
|
| 1764 | + $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 ); |
|
| 1784 | 1765 | |
| 1785 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1786 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1787 | - // to categories. |
|
| 1788 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1766 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1767 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1768 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1789 | 1769 | |
| 1790 | - /* |
|
| 1770 | + // Hook the content filter service to add entity links. |
|
| 1771 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1772 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1773 | + } |
|
| 1774 | + |
|
| 1775 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1776 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1777 | + |
|
| 1778 | + // Hook the ShareThis service. |
|
| 1779 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1780 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1781 | + |
|
| 1782 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1783 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1784 | + |
|
| 1785 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1786 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1787 | + // to categories. |
|
| 1788 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1789 | + |
|
| 1790 | + /* |
|
| 1791 | 1791 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1792 | 1792 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1793 | 1793 | * order of start time. |
| 1794 | 1794 | */ |
| 1795 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1796 | - |
|
| 1797 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1798 | - |
|
| 1799 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1800 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1801 | - |
|
| 1802 | - // Analytics Script Frontend. |
|
| 1803 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1804 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1805 | - } |
|
| 1806 | - |
|
| 1807 | - } |
|
| 1808 | - |
|
| 1809 | - /** |
|
| 1810 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1811 | - * |
|
| 1812 | - * @since 1.0.0 |
|
| 1813 | - */ |
|
| 1814 | - public function run() { |
|
| 1815 | - $this->loader->run(); |
|
| 1816 | - } |
|
| 1817 | - |
|
| 1818 | - /** |
|
| 1819 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1820 | - * WordPress and to define internationalization functionality. |
|
| 1821 | - * |
|
| 1822 | - * @return string The name of the plugin. |
|
| 1823 | - * @since 1.0.0 |
|
| 1824 | - */ |
|
| 1825 | - public function get_plugin_name() { |
|
| 1826 | - return $this->plugin_name; |
|
| 1827 | - } |
|
| 1828 | - |
|
| 1829 | - /** |
|
| 1830 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1831 | - * |
|
| 1832 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1833 | - * @since 1.0.0 |
|
| 1834 | - */ |
|
| 1835 | - public function get_loader() { |
|
| 1836 | - return $this->loader; |
|
| 1837 | - } |
|
| 1838 | - |
|
| 1839 | - /** |
|
| 1840 | - * Retrieve the version number of the plugin. |
|
| 1841 | - * |
|
| 1842 | - * @return string The version number of the plugin. |
|
| 1843 | - * @since 1.0.0 |
|
| 1844 | - */ |
|
| 1845 | - public function get_version() { |
|
| 1846 | - return $this->version; |
|
| 1847 | - } |
|
| 1848 | - |
|
| 1849 | - /** |
|
| 1850 | - * Load dependencies for WP-CLI. |
|
| 1851 | - * |
|
| 1852 | - * @throws Exception |
|
| 1853 | - * @since 3.18.0 |
|
| 1854 | - */ |
|
| 1855 | - private function load_cli_dependencies() { |
|
| 1856 | - |
|
| 1857 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1858 | - |
|
| 1859 | - $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 ); |
|
| 1860 | - |
|
| 1861 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1862 | - |
|
| 1863 | - } |
|
| 1864 | - |
|
| 1865 | - /** |
|
| 1866 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1867 | - * |
|
| 1868 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1869 | - * @since 3.20.0 |
|
| 1870 | - */ |
|
| 1871 | - public function get_dashboard_service() { |
|
| 1872 | - |
|
| 1873 | - return $this->dashboard_service; |
|
| 1874 | - } |
|
| 1795 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1796 | + |
|
| 1797 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1798 | + |
|
| 1799 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1800 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1801 | + |
|
| 1802 | + // Analytics Script Frontend. |
|
| 1803 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1804 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1805 | + } |
|
| 1806 | + |
|
| 1807 | + } |
|
| 1808 | + |
|
| 1809 | + /** |
|
| 1810 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1811 | + * |
|
| 1812 | + * @since 1.0.0 |
|
| 1813 | + */ |
|
| 1814 | + public function run() { |
|
| 1815 | + $this->loader->run(); |
|
| 1816 | + } |
|
| 1817 | + |
|
| 1818 | + /** |
|
| 1819 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1820 | + * WordPress and to define internationalization functionality. |
|
| 1821 | + * |
|
| 1822 | + * @return string The name of the plugin. |
|
| 1823 | + * @since 1.0.0 |
|
| 1824 | + */ |
|
| 1825 | + public function get_plugin_name() { |
|
| 1826 | + return $this->plugin_name; |
|
| 1827 | + } |
|
| 1828 | + |
|
| 1829 | + /** |
|
| 1830 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1831 | + * |
|
| 1832 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1833 | + * @since 1.0.0 |
|
| 1834 | + */ |
|
| 1835 | + public function get_loader() { |
|
| 1836 | + return $this->loader; |
|
| 1837 | + } |
|
| 1838 | + |
|
| 1839 | + /** |
|
| 1840 | + * Retrieve the version number of the plugin. |
|
| 1841 | + * |
|
| 1842 | + * @return string The version number of the plugin. |
|
| 1843 | + * @since 1.0.0 |
|
| 1844 | + */ |
|
| 1845 | + public function get_version() { |
|
| 1846 | + return $this->version; |
|
| 1847 | + } |
|
| 1848 | + |
|
| 1849 | + /** |
|
| 1850 | + * Load dependencies for WP-CLI. |
|
| 1851 | + * |
|
| 1852 | + * @throws Exception |
|
| 1853 | + * @since 3.18.0 |
|
| 1854 | + */ |
|
| 1855 | + private function load_cli_dependencies() { |
|
| 1856 | + |
|
| 1857 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1858 | + |
|
| 1859 | + $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 ); |
|
| 1860 | + |
|
| 1861 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1862 | + |
|
| 1863 | + } |
|
| 1864 | + |
|
| 1865 | + /** |
|
| 1866 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1867 | + * |
|
| 1868 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1869 | + * @since 3.20.0 |
|
| 1870 | + */ |
|
| 1871 | + public function get_dashboard_service() { |
|
| 1872 | + |
|
| 1873 | + return $this->dashboard_service; |
|
| 1874 | + } |
|
| 1875 | 1875 | |
| 1876 | 1876 | } |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | $this->define_public_hooks(); |
| 743 | 743 | |
| 744 | 744 | // If we're in `WP_CLI` load the related files. |
| 745 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 745 | + if (class_exists('WP_CLI')) { |
|
| 746 | 746 | $this->load_cli_dependencies(); |
| 747 | 747 | } |
| 748 | 748 | |
@@ -783,376 +783,376 @@ discard block |
||
| 783 | 783 | * The class responsible for orchestrating the actions and filters of the |
| 784 | 784 | * core plugin. |
| 785 | 785 | */ |
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 786 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 787 | 787 | |
| 788 | 788 | // The class responsible for plugin uninstall. |
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 789 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 790 | 790 | |
| 791 | 791 | /** |
| 792 | 792 | * The class responsible for defining internationalization functionality |
| 793 | 793 | * of the plugin. |
| 794 | 794 | */ |
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 795 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * WordLift's supported languages. |
| 799 | 799 | */ |
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 800 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 801 | 801 | |
| 802 | 802 | /** |
| 803 | 803 | * WordLift's supported countries. |
| 804 | 804 | */ |
| 805 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 805 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 806 | 806 | |
| 807 | 807 | /** |
| 808 | 808 | * Provide support functions to sanitize data. |
| 809 | 809 | */ |
| 810 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 810 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 811 | 811 | |
| 812 | 812 | /** Services. */ |
| 813 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 815 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 818 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 813 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 814 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 815 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 816 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 817 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 818 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 819 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 820 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 821 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 823 | 823 | |
| 824 | 824 | /** |
| 825 | 825 | * The Query builder. |
| 826 | 826 | */ |
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 828 | 828 | |
| 829 | 829 | /** |
| 830 | 830 | * The Schema service. |
| 831 | 831 | */ |
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 832 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 833 | 833 | |
| 834 | 834 | /** |
| 835 | 835 | * The schema:url property service. |
| 836 | 836 | */ |
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 837 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | 841 | * The UI service. |
| 842 | 842 | */ |
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 843 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 844 | 844 | |
| 845 | 845 | /** |
| 846 | 846 | * The Thumbnail service. |
| 847 | 847 | */ |
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 848 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 849 | 849 | |
| 850 | 850 | /** |
| 851 | 851 | * The Entity Types Taxonomy service. |
| 852 | 852 | */ |
| 853 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 853 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 854 | 854 | |
| 855 | 855 | /** |
| 856 | 856 | * The Entity service. |
| 857 | 857 | */ |
| 858 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 858 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 859 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 860 | 860 | |
| 861 | 861 | // Add the entity rating service. |
| 862 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 862 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 863 | 863 | |
| 864 | 864 | /** |
| 865 | 865 | * The User service. |
| 866 | 866 | */ |
| 867 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 867 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 868 | 868 | |
| 869 | 869 | /** |
| 870 | 870 | * The Timeline service. |
| 871 | 871 | */ |
| 872 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 872 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 873 | 873 | |
| 874 | 874 | /** |
| 875 | 875 | * The Topic Taxonomy service. |
| 876 | 876 | */ |
| 877 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 877 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 878 | 878 | |
| 879 | 879 | /** |
| 880 | 880 | * The SPARQL service. |
| 881 | 881 | */ |
| 882 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 882 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 883 | 883 | |
| 884 | 884 | /** |
| 885 | 885 | * The WordLift import service. |
| 886 | 886 | */ |
| 887 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 887 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 888 | 888 | |
| 889 | 889 | /** |
| 890 | 890 | * The WordLift URI service. |
| 891 | 891 | */ |
| 892 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 892 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 893 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 894 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 895 | 895 | |
| 896 | 896 | /** |
| 897 | 897 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 898 | 898 | */ |
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 901 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 902 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 903 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 901 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 902 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 903 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 904 | 904 | |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 906 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 907 | 907 | |
| 908 | 908 | /** |
| 909 | 909 | * Load the converters. |
| 910 | 910 | */ |
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 913 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 914 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 916 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 912 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 913 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 914 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 915 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 916 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 917 | 917 | |
| 918 | 918 | /** |
| 919 | 919 | * Load cache-related files. |
| 920 | 920 | */ |
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 921 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 922 | 922 | |
| 923 | 923 | /** |
| 924 | 924 | * Load the content filter. |
| 925 | 925 | */ |
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 926 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 927 | 927 | |
| 928 | 928 | /* |
| 929 | 929 | * Load the excerpt helper. |
| 930 | 930 | */ |
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 931 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 932 | 932 | |
| 933 | 933 | /** |
| 934 | 934 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 935 | 935 | * |
| 936 | 936 | * @since 3.8.0 |
| 937 | 937 | */ |
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 938 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 939 | 939 | |
| 940 | 940 | // The Publisher Service and the AJAX adapter. |
| 941 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 942 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 941 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 942 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 943 | 943 | |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 945 | 945 | |
| 946 | 946 | /** |
| 947 | 947 | * Load the WordLift key validation service. |
| 948 | 948 | */ |
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 949 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 950 | 950 | |
| 951 | 951 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 952 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 952 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 953 | 953 | |
| 954 | 954 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 956 | 956 | |
| 957 | 957 | /** Linked Data. */ |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 960 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 965 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 959 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 960 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 962 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 964 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 965 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 966 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 967 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 968 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 969 | 969 | |
| 970 | 970 | /** Linked Data Rendition. */ |
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 975 | 975 | |
| 976 | 976 | /** Services. */ |
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 977 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 978 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 979 | 979 | |
| 980 | 980 | /** Adapters. */ |
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 983 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 984 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 986 | 986 | |
| 987 | 987 | /** Async Tasks. */ |
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 988 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 989 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 991 | 991 | |
| 992 | 992 | /** Autocomplete. */ |
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 994 | 994 | |
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** Analytics */ |
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 999 | 999 | |
| 1000 | 1000 | /** |
| 1001 | 1001 | * The class responsible for defining all actions that occur in the admin area. |
| 1002 | 1002 | */ |
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1003 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1004 | 1004 | |
| 1005 | 1005 | /** |
| 1006 | 1006 | * The class to customize the entity list admin page. |
| 1007 | 1007 | */ |
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1008 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1009 | 1009 | |
| 1010 | 1010 | /** |
| 1011 | 1011 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1012 | 1012 | */ |
| 1013 | 1013 | global $wp_version; |
| 1014 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1014 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 1015 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1016 | 1016 | } else { |
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1017 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | /** |
| 1021 | 1021 | * The Notice service. |
| 1022 | 1022 | */ |
| 1023 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1023 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1024 | 1024 | |
| 1025 | 1025 | /** |
| 1026 | 1026 | * The PrimaShop adapter. |
| 1027 | 1027 | */ |
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1028 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1029 | 1029 | |
| 1030 | 1030 | /** |
| 1031 | 1031 | * The WordLift Dashboard service. |
| 1032 | 1032 | */ |
| 1033 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1033 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1034 | 1034 | |
| 1035 | 1035 | /** |
| 1036 | 1036 | * The admin 'Install wizard' page. |
| 1037 | 1037 | */ |
| 1038 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1038 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1039 | 1039 | |
| 1040 | 1040 | /** |
| 1041 | 1041 | * The WordLift entity type list admin page controller. |
| 1042 | 1042 | */ |
| 1043 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1043 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1044 | 1044 | |
| 1045 | 1045 | /** |
| 1046 | 1046 | * The WordLift entity type settings admin page controller. |
| 1047 | 1047 | */ |
| 1048 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1048 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1049 | 1049 | |
| 1050 | 1050 | /** |
| 1051 | 1051 | * The admin 'Download Your Data' page. |
| 1052 | 1052 | */ |
| 1053 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1053 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1054 | 1054 | |
| 1055 | 1055 | /** |
| 1056 | 1056 | * The admin 'WordLift Settings' page. |
| 1057 | 1057 | */ |
| 1058 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1059 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1062 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1063 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1064 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1058 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1059 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1060 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1061 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1062 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1063 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1064 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1065 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1066 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1067 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1068 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1069 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1072 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1073 | 1073 | |
| 1074 | 1074 | /** Admin Pages */ |
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1079 | 1079 | |
| 1080 | 1080 | /** |
| 1081 | 1081 | * The class responsible for defining all actions that occur in the public-facing |
| 1082 | 1082 | * side of the site. |
| 1083 | 1083 | */ |
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1084 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1085 | 1085 | |
| 1086 | 1086 | /** |
| 1087 | 1087 | * The shortcode abstract class. |
| 1088 | 1088 | */ |
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1089 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1090 | 1090 | |
| 1091 | 1091 | /** |
| 1092 | 1092 | * The Timeline shortcode. |
| 1093 | 1093 | */ |
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1094 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1095 | 1095 | |
| 1096 | 1096 | /** |
| 1097 | 1097 | * The Navigator shortcode. |
| 1098 | 1098 | */ |
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1099 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1100 | 1100 | |
| 1101 | 1101 | /** |
| 1102 | 1102 | * The chord shortcode. |
| 1103 | 1103 | */ |
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1104 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1105 | 1105 | |
| 1106 | 1106 | /** |
| 1107 | 1107 | * The geomap shortcode. |
| 1108 | 1108 | */ |
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1109 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1110 | 1110 | |
| 1111 | 1111 | /** |
| 1112 | 1112 | * The entity cloud shortcode. |
| 1113 | 1113 | */ |
| 1114 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1114 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1115 | 1115 | |
| 1116 | 1116 | /** |
| 1117 | 1117 | * The entity glossary shortcode. |
| 1118 | 1118 | */ |
| 1119 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1120 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1119 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1120 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1121 | 1121 | |
| 1122 | 1122 | /** |
| 1123 | 1123 | * Faceted Search shortcode. |
| 1124 | 1124 | */ |
| 1125 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1125 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1126 | 1126 | |
| 1127 | 1127 | /** |
| 1128 | 1128 | * The ShareThis service. |
| 1129 | 1129 | */ |
| 1130 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1130 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1131 | 1131 | |
| 1132 | 1132 | /** |
| 1133 | 1133 | * The SEO service. |
| 1134 | 1134 | */ |
| 1135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1135 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1136 | 1136 | |
| 1137 | 1137 | /** |
| 1138 | 1138 | * The AMP service. |
| 1139 | 1139 | */ |
| 1140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1140 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1141 | 1141 | |
| 1142 | 1142 | /** Widgets */ |
| 1143 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1145 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1143 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1144 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1145 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php'; |
|
| 1146 | 1146 | |
| 1147 | 1147 | /* |
| 1148 | 1148 | * Schema.org Services. |
| 1149 | 1149 | * |
| 1150 | 1150 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1151 | 1151 | */ |
| 1152 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1155 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1152 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1153 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1154 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1155 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1156 | 1156 | new Wordlift_Schemaorg_Sync_Service(); |
| 1157 | 1157 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1158 | 1158 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1164,25 +1164,25 @@ discard block |
||
| 1164 | 1164 | |
| 1165 | 1165 | // Instantiate a global logger. |
| 1166 | 1166 | global $wl_logger; |
| 1167 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1167 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1168 | 1168 | |
| 1169 | 1169 | // Load the `wl-api` end-point. |
| 1170 | 1170 | new Wordlift_Http_Api(); |
| 1171 | 1171 | |
| 1172 | 1172 | // Load the Install Service. |
| 1173 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1173 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 1174 | 1174 | $this->install_service = new Wordlift_Install_Service(); |
| 1175 | 1175 | |
| 1176 | 1176 | /** Services. */ |
| 1177 | 1177 | // Create the configuration service. |
| 1178 | 1178 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1179 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1179 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1180 | 1180 | |
| 1181 | 1181 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1182 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1182 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1183 | 1183 | |
| 1184 | 1184 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1185 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1185 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1186 | 1186 | |
| 1187 | 1187 | // Create an instance of the UI service. |
| 1188 | 1188 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1191,31 +1191,31 @@ discard block |
||
| 1191 | 1191 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1192 | 1192 | |
| 1193 | 1193 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1194 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1194 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1195 | 1195 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1196 | 1196 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1197 | 1197 | |
| 1198 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1199 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1200 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1201 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1198 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1199 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1200 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1201 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1202 | 1202 | |
| 1203 | 1203 | // Instantiate the JSON-LD service. |
| 1204 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1204 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1205 | 1205 | |
| 1206 | 1206 | /** Linked Data. */ |
| 1207 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1208 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1207 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1208 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1209 | 1209 | |
| 1210 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1210 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1211 | 1211 | |
| 1212 | 1212 | // Create a new instance of the Redirect service. |
| 1213 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1214 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1215 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1213 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1214 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1215 | + $this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
| 1216 | 1216 | |
| 1217 | 1217 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1218 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1218 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1219 | 1219 | |
| 1220 | 1220 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1221 | 1221 | |
@@ -1229,72 +1229,72 @@ discard block |
||
| 1229 | 1229 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1230 | 1230 | |
| 1231 | 1231 | // Create an import service instance to hook later to WP's import function. |
| 1232 | - $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() ); |
|
| 1232 | + $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()); |
|
| 1233 | 1233 | |
| 1234 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1234 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1235 | 1235 | |
| 1236 | 1236 | // Create the entity rating service. |
| 1237 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1237 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1238 | 1238 | |
| 1239 | 1239 | // Create entity list customization (wp-admin/edit.php). |
| 1240 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1240 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1241 | 1241 | |
| 1242 | 1242 | // Create a new instance of the Redirect service. |
| 1243 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1243 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1244 | 1244 | |
| 1245 | 1245 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1246 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1247 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1248 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1246 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1247 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1248 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1249 | 1249 | |
| 1250 | 1250 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1251 | 1251 | |
| 1252 | 1252 | // Instantiate the JSON-LD service. |
| 1253 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1254 | - $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 ); |
|
| 1255 | - $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 ); |
|
| 1256 | - $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 ); |
|
| 1257 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1258 | - |
|
| 1259 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1260 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1261 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1262 | - new Jsonld_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1253 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1254 | + $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); |
|
| 1255 | + $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); |
|
| 1256 | + $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); |
|
| 1257 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1258 | + |
|
| 1259 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1260 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache); |
|
| 1261 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1262 | + new Jsonld_Endpoint($this->jsonld_service, $this->entity_uri_service); |
|
| 1263 | 1263 | // Prints the JSON-LD in the head. |
| 1264 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1264 | + new Jsonld_Adapter($this->jsonld_service); |
|
| 1265 | 1265 | |
| 1266 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1267 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1268 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1269 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1270 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1271 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1266 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1267 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1268 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1269 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1270 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1271 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service); |
|
| 1272 | 1272 | |
| 1273 | 1273 | // Initialize the short-codes. |
| 1274 | 1274 | new Wordlift_Navigator_Shortcode(); |
| 1275 | 1275 | new Wordlift_Chord_Shortcode(); |
| 1276 | 1276 | new Wordlift_Geomap_Shortcode(); |
| 1277 | 1277 | new Wordlift_Timeline_Shortcode(); |
| 1278 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1279 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1278 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1279 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1280 | 1280 | new Wordlift_Faceted_Search_Shortcode(); |
| 1281 | 1281 | |
| 1282 | 1282 | // Initialize the SEO service. |
| 1283 | 1283 | new Wordlift_Seo_Service(); |
| 1284 | 1284 | |
| 1285 | 1285 | // Initialize the AMP service. |
| 1286 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1286 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1287 | 1287 | |
| 1288 | 1288 | /** Services. */ |
| 1289 | 1289 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1290 | 1290 | new Wordlift_Image_Service(); |
| 1291 | 1291 | |
| 1292 | 1292 | /** Adapters. */ |
| 1293 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1294 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1295 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1293 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1294 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1295 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1296 | 1296 | $this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
| 1297 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1297 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1298 | 1298 | |
| 1299 | 1299 | /* |
| 1300 | 1300 | * Exclude our public js from WP-Rocket. |
@@ -1324,14 +1324,14 @@ discard block |
||
| 1324 | 1324 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1325 | 1325 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1326 | 1326 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1327 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1328 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1327 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1328 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1329 | 1329 | |
| 1330 | - $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 ); |
|
| 1331 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1330 | + $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); |
|
| 1331 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1332 | 1332 | |
| 1333 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1334 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1333 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1334 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1335 | 1335 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1336 | 1336 | |
| 1337 | 1337 | // Pages. |
@@ -1342,9 +1342,9 @@ discard block |
||
| 1342 | 1342 | * |
| 1343 | 1343 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1344 | 1344 | */ |
| 1345 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1346 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1347 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1345 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1346 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1347 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1348 | 1348 | } |
| 1349 | 1349 | new Wordlift_Entity_Type_Admin_Service(); |
| 1350 | 1350 | |
@@ -1358,23 +1358,23 @@ discard block |
||
| 1358 | 1358 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1359 | 1359 | |
| 1360 | 1360 | /* WordPress Admin. */ |
| 1361 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1362 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1361 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1362 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1363 | 1363 | |
| 1364 | 1364 | // Create an instance of the install wizard. |
| 1365 | - $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 ); |
|
| 1365 | + $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); |
|
| 1366 | 1366 | |
| 1367 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1367 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1368 | 1368 | |
| 1369 | 1369 | // User Profile. |
| 1370 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1370 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1371 | 1371 | |
| 1372 | 1372 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1373 | 1373 | |
| 1374 | 1374 | // Load the debug service if WP is in debug mode. |
| 1375 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1376 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1377 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1375 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1376 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1377 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | // Remote Image Service. |
@@ -1387,12 +1387,12 @@ discard block |
||
| 1387 | 1387 | * |
| 1388 | 1388 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1389 | 1389 | */ |
| 1390 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1391 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1392 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1390 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1391 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1392 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1393 | 1393 | |
| 1394 | 1394 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1395 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1395 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1396 | 1396 | |
| 1397 | 1397 | /* |
| 1398 | 1398 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1401,8 +1401,8 @@ discard block |
||
| 1401 | 1401 | * |
| 1402 | 1402 | * @since 3.20.0 |
| 1403 | 1403 | */ |
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1404 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1405 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1406 | 1406 | |
| 1407 | 1407 | /* |
| 1408 | 1408 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1411,15 +1411,15 @@ discard block |
||
| 1411 | 1411 | * |
| 1412 | 1412 | * @since 3.20.0 |
| 1413 | 1413 | */ |
| 1414 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1415 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1414 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1415 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1416 | 1416 | |
| 1417 | 1417 | /* |
| 1418 | 1418 | * Load dependencies for the front-end. |
| 1419 | 1419 | * |
| 1420 | 1420 | * @since 3.20.0 |
| 1421 | 1421 | */ |
| 1422 | - if ( ! is_admin() ) { |
|
| 1422 | + if ( ! is_admin()) { |
|
| 1423 | 1423 | /* |
| 1424 | 1424 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1425 | 1425 | * |
@@ -1427,8 +1427,8 @@ discard block |
||
| 1427 | 1427 | * |
| 1428 | 1428 | * @since 3.20.0 |
| 1429 | 1429 | */ |
| 1430 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1431 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1430 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1431 | + new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | /* |
@@ -1449,15 +1449,15 @@ discard block |
||
| 1449 | 1449 | $mappings_dbo = new Mappings_DBO(); |
| 1450 | 1450 | $default_rule_validator = new Taxonomy_Rule_Validator(); |
| 1451 | 1451 | new Post_Type_Rule_Validator(); |
| 1452 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1453 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1454 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1452 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1453 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1454 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1455 | 1455 | |
| 1456 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1456 | + new Url_To_Entity_Transform_Function($this->entity_uri_service); |
|
| 1457 | 1457 | new Taxonomy_To_Terms_Transform_Function(); |
| 1458 | 1458 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
| 1459 | 1459 | |
| 1460 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1460 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1461 | 1461 | |
| 1462 | 1462 | /** |
| 1463 | 1463 | * @since 3.26.0 |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | /* |
| 1479 | 1479 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1480 | 1480 | */ |
| 1481 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1481 | + $entity_helper = new Entity_Helper($this->entity_uri_service, $this->entity_service); |
|
| 1482 | 1482 | new Analysis_Response_Ops_Factory( |
| 1483 | 1483 | $this->entity_uri_service, |
| 1484 | 1484 | $this->entity_service, |
@@ -1488,11 +1488,11 @@ discard block |
||
| 1488 | 1488 | ); |
| 1489 | 1489 | |
| 1490 | 1490 | /** WL Autocomplete. */ |
| 1491 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1491 | + $autocomplete_service = new All_Autocomplete_Service(array( |
|
| 1492 | 1492 | new Local_Autocomplete_Service(), |
| 1493 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1494 | - ) ); |
|
| 1495 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1493 | + new Linked_Data_Autocomplete_Service($this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service), |
|
| 1494 | + )); |
|
| 1495 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1496 | 1496 | |
| 1497 | 1497 | } |
| 1498 | 1498 | |
@@ -1508,9 +1508,9 @@ discard block |
||
| 1508 | 1508 | private function set_locale() { |
| 1509 | 1509 | |
| 1510 | 1510 | $plugin_i18n = new Wordlift_i18n(); |
| 1511 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1511 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1512 | 1512 | |
| 1513 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1513 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1514 | 1514 | |
| 1515 | 1515 | } |
| 1516 | 1516 | |
@@ -1531,29 +1531,29 @@ discard block |
||
| 1531 | 1531 | $this->user_service |
| 1532 | 1532 | ); |
| 1533 | 1533 | |
| 1534 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1535 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1534 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1535 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1536 | 1536 | |
| 1537 | 1537 | // Hook the init action to taxonomy services. |
| 1538 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1539 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1538 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1539 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1540 | 1540 | |
| 1541 | 1541 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1542 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1542 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1543 | 1543 | |
| 1544 | 1544 | // Hook the added_post_meta action to the Thumbnail service. |
| 1545 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1545 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1546 | 1546 | |
| 1547 | 1547 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1548 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1548 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1549 | 1549 | |
| 1550 | 1550 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1551 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1551 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1552 | 1552 | |
| 1553 | 1553 | // Register custom allowed redirect hosts. |
| 1554 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1554 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1555 | 1555 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1556 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1556 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1557 | 1557 | |
| 1558 | 1558 | /* |
| 1559 | 1559 | * The old dashboard is replaced with dashboard v2. |
@@ -1571,77 +1571,77 @@ discard block |
||
| 1571 | 1571 | |
| 1572 | 1572 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1573 | 1573 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1574 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1575 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1574 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1575 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1576 | 1576 | |
| 1577 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1578 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1577 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1578 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1579 | 1579 | |
| 1580 | 1580 | // Entity listing customization (wp-admin/edit.php) |
| 1581 | 1581 | // Add custom columns. |
| 1582 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1582 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1583 | 1583 | // no explicit entity as it prevents handling of other post types. |
| 1584 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1584 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1585 | 1585 | // Add 4W selection. |
| 1586 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1587 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1588 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1589 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1586 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1587 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1588 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1589 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1590 | 1590 | |
| 1591 | 1591 | /* |
| 1592 | 1592 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1593 | 1593 | * |
| 1594 | 1594 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1595 | 1595 | */ |
| 1596 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1597 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1596 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1597 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1601 | 1601 | // entities. |
| 1602 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1602 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1603 | 1603 | |
| 1604 | 1604 | // Filter imported post meta. |
| 1605 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1605 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1606 | 1606 | |
| 1607 | 1607 | // Notify the import service when an import starts and ends. |
| 1608 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1609 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1608 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1609 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1610 | 1610 | |
| 1611 | 1611 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1612 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1613 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1612 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1613 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1614 | 1614 | |
| 1615 | 1615 | // Hook the menu to the Download Your Data page. |
| 1616 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1617 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1618 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1616 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1617 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1618 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1619 | 1619 | |
| 1620 | 1620 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1621 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1621 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1622 | 1622 | |
| 1623 | 1623 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1624 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1625 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1626 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1624 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1625 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1626 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1627 | 1627 | |
| 1628 | 1628 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1629 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1629 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1630 | 1630 | |
| 1631 | 1631 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1632 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1632 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1633 | 1633 | |
| 1634 | 1634 | // Hook the `admin_init` function to the Admin Setup. |
| 1635 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1635 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1636 | 1636 | |
| 1637 | 1637 | // Hook the admin_init to the settings page. |
| 1638 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1639 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1638 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1639 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1640 | 1640 | |
| 1641 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1641 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1642 | 1642 | |
| 1643 | 1643 | // Hook the menu creation on the general wordlift menu creation. |
| 1644 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1644 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1645 | 1645 | |
| 1646 | 1646 | /* |
| 1647 | 1647 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
@@ -1650,17 +1650,17 @@ discard block |
||
| 1650 | 1650 | * |
| 1651 | 1651 | * @since 3.20.0 |
| 1652 | 1652 | */ |
| 1653 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1653 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
| 1654 | 1654 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
| 1655 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1655 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
| 1656 | 1656 | } |
| 1657 | 1657 | |
| 1658 | 1658 | // Hook key update. |
| 1659 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1660 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1659 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1660 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1661 | 1661 | |
| 1662 | 1662 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1663 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1663 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1664 | 1664 | |
| 1665 | 1665 | /* |
| 1666 | 1666 | * Remove the Analytics Settings link from the plugin page. |
@@ -1671,25 +1671,25 @@ discard block |
||
| 1671 | 1671 | // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1672 | 1672 | |
| 1673 | 1673 | // Hook the AJAX `wl_publisher` action name. |
| 1674 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1674 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1675 | 1675 | |
| 1676 | 1676 | // Hook row actions for the entity type list admin. |
| 1677 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1677 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1678 | 1678 | |
| 1679 | 1679 | /** Ajax actions. */ |
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1680 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1681 | 1681 | |
| 1682 | 1682 | // Hook capabilities manipulation to allow access to entity type admin |
| 1683 | 1683 | // page on WordPress versions before 4.7. |
| 1684 | 1684 | global $wp_version; |
| 1685 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1686 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1685 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1686 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1689 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1690 | 1690 | |
| 1691 | 1691 | /** Adapters. */ |
| 1692 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1692 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1693 | 1693 | /** |
| 1694 | 1694 | * Load the tinymce editor button on the tool bar. |
| 1695 | 1695 | * @since 3.26.0 |
@@ -1698,48 +1698,48 @@ discard block |
||
| 1698 | 1698 | $this->loader->add_filter('mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1); |
| 1699 | 1699 | |
| 1700 | 1700 | |
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1702 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1703 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1701 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1702 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1703 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1704 | 1704 | |
| 1705 | 1705 | |
| 1706 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1707 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1706 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1707 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1708 | 1708 | |
| 1709 | 1709 | // Handle the autocomplete request. |
| 1710 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1710 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1711 | 1711 | $this->autocomplete_adapter, |
| 1712 | 1712 | 'wl_autocomplete', |
| 1713 | - ) ); |
|
| 1714 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1713 | + )); |
|
| 1714 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1715 | 1715 | $this->autocomplete_adapter, |
| 1716 | 1716 | 'wl_autocomplete', |
| 1717 | - ) ); |
|
| 1717 | + )); |
|
| 1718 | 1718 | |
| 1719 | 1719 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1720 | - if ( is_multisite() ) { |
|
| 1721 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1720 | + if (is_multisite()) { |
|
| 1721 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1724 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1725 | 1725 | |
| 1726 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1727 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1728 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1726 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1727 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1728 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1729 | 1729 | |
| 1730 | 1730 | /** |
| 1731 | 1731 | * Always allow the `wordlift/classification` block. |
| 1732 | 1732 | * |
| 1733 | 1733 | * @since 3.23.0 |
| 1734 | 1734 | */ |
| 1735 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1735 | + add_filter('allowed_block_types', function($value) { |
|
| 1736 | 1736 | |
| 1737 | - if ( true === $value ) { |
|
| 1737 | + if (true === $value) { |
|
| 1738 | 1738 | return $value; |
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1742 | - }, PHP_INT_MAX ); |
|
| 1741 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1742 | + }, PHP_INT_MAX); |
|
| 1743 | 1743 | |
| 1744 | 1744 | } |
| 1745 | 1745 | |
@@ -1752,56 +1752,56 @@ discard block |
||
| 1752 | 1752 | */ |
| 1753 | 1753 | private function define_public_hooks() { |
| 1754 | 1754 | |
| 1755 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1755 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1756 | 1756 | |
| 1757 | 1757 | // Register the entity post type. |
| 1758 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1758 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1759 | 1759 | |
| 1760 | 1760 | // Bind the link generation and handling hooks to the entity link service. |
| 1761 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1762 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1763 | - $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 ); |
|
| 1764 | - $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 ); |
|
| 1761 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1762 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1763 | + $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); |
|
| 1764 | + $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); |
|
| 1765 | 1765 | |
| 1766 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1767 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1768 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1766 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1767 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1768 | + $this->loader->add_action('wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts'); |
|
| 1769 | 1769 | |
| 1770 | 1770 | // Hook the content filter service to add entity links. |
| 1771 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1772 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1771 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1772 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1773 | 1773 | } |
| 1774 | 1774 | |
| 1775 | 1775 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1776 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1776 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1777 | 1777 | |
| 1778 | 1778 | // Hook the ShareThis service. |
| 1779 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1780 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1779 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1780 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1781 | 1781 | |
| 1782 | 1782 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1783 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1783 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1784 | 1784 | |
| 1785 | 1785 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1786 | 1786 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1787 | 1787 | // to categories. |
| 1788 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1788 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1789 | 1789 | |
| 1790 | 1790 | /* |
| 1791 | 1791 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1792 | 1792 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1793 | 1793 | * order of start time. |
| 1794 | 1794 | */ |
| 1795 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1795 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1796 | 1796 | |
| 1797 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1797 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1798 | 1798 | |
| 1799 | 1799 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1800 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1800 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1801 | 1801 | |
| 1802 | 1802 | // Analytics Script Frontend. |
| 1803 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1804 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1803 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1804 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1805 | 1805 | } |
| 1806 | 1806 | |
| 1807 | 1807 | } |
@@ -1854,11 +1854,11 @@ discard block |
||
| 1854 | 1854 | */ |
| 1855 | 1855 | private function load_cli_dependencies() { |
| 1856 | 1856 | |
| 1857 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1857 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1858 | 1858 | |
| 1859 | - $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 ); |
|
| 1859 | + $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); |
|
| 1860 | 1860 | |
| 1861 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1861 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1862 | 1862 | |
| 1863 | 1863 | } |
| 1864 | 1864 | |
@@ -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; |
|
| 74 | - $plugins['wl_tinymce_2'] = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
| 75 | - return $plugins; |
|
| 76 | - } |
|
| 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 | + $plugins['wl_tinymce_2'] = plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
| 75 | + return $plugins; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | } |
@@ -17,154 +17,154 @@ |
||
| 17 | 17 | * |
| 18 | 18 | */ |
| 19 | 19 | class FAQ_Rest_Controller { |
| 20 | - const FAQ_META_KEY = 'wl_faq'; |
|
| 21 | - public static function register_routes() { |
|
| 22 | - add_action( 'rest_api_init', 'Wordlift\FAQ\FAQ_Rest_Controller::register_route_callback' ); |
|
| 23 | - } |
|
| 20 | + const FAQ_META_KEY = 'wl_faq'; |
|
| 21 | + public static function register_routes() { |
|
| 22 | + add_action( 'rest_api_init', 'Wordlift\FAQ\FAQ_Rest_Controller::register_route_callback' ); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public static function register_route_callback() { |
|
| 26 | - /** |
|
| 27 | - * Rest route for creating new faq item. |
|
| 28 | - */ |
|
| 29 | - register_rest_route( |
|
| 30 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 31 | - '/faq', |
|
| 32 | - array( |
|
| 33 | - 'methods' => \WP_REST_Server::CREATABLE, |
|
| 34 | - 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::add_faq_items', |
|
| 35 | - 'permission_callback' => function () { |
|
| 36 | - return current_user_can( 'publish_posts' ); |
|
| 37 | - }, |
|
| 38 | - ) |
|
| 39 | - ); |
|
| 40 | - /** |
|
| 41 | - * Rest route for updating faq items. |
|
| 42 | - */ |
|
| 43 | - register_rest_route( |
|
| 44 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 45 | - '/faq', |
|
| 46 | - array( |
|
| 47 | - 'methods' => \WP_REST_Server::EDITABLE, |
|
| 48 | - 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::update_faq_items', |
|
| 49 | - 'permission_callback' => function () { |
|
| 50 | - return current_user_can( 'publish_posts' ); |
|
| 51 | - }, |
|
| 52 | - ) |
|
| 53 | - ); |
|
| 54 | - /** |
|
| 55 | - * Rest route for getting the faq items. |
|
| 56 | - */ |
|
| 57 | - register_rest_route( |
|
| 58 | - WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 59 | - '/faq/(?P<post_id>\d+)', |
|
| 60 | - array( |
|
| 61 | - 'methods' => \WP_REST_Server::READABLE, |
|
| 62 | - 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::get_faq_items', |
|
| 63 | - 'permission_callback' => function () { |
|
| 64 | - return current_user_can( 'publish_posts' ); |
|
| 65 | - }, |
|
| 66 | - ) |
|
| 67 | - ); |
|
| 25 | + public static function register_route_callback() { |
|
| 26 | + /** |
|
| 27 | + * Rest route for creating new faq item. |
|
| 28 | + */ |
|
| 29 | + register_rest_route( |
|
| 30 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 31 | + '/faq', |
|
| 32 | + array( |
|
| 33 | + 'methods' => \WP_REST_Server::CREATABLE, |
|
| 34 | + 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::add_faq_items', |
|
| 35 | + 'permission_callback' => function () { |
|
| 36 | + return current_user_can( 'publish_posts' ); |
|
| 37 | + }, |
|
| 38 | + ) |
|
| 39 | + ); |
|
| 40 | + /** |
|
| 41 | + * Rest route for updating faq items. |
|
| 42 | + */ |
|
| 43 | + register_rest_route( |
|
| 44 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 45 | + '/faq', |
|
| 46 | + array( |
|
| 47 | + 'methods' => \WP_REST_Server::EDITABLE, |
|
| 48 | + 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::update_faq_items', |
|
| 49 | + 'permission_callback' => function () { |
|
| 50 | + return current_user_can( 'publish_posts' ); |
|
| 51 | + }, |
|
| 52 | + ) |
|
| 53 | + ); |
|
| 54 | + /** |
|
| 55 | + * Rest route for getting the faq items. |
|
| 56 | + */ |
|
| 57 | + register_rest_route( |
|
| 58 | + WL_REST_ROUTE_DEFAULT_NAMESPACE, |
|
| 59 | + '/faq/(?P<post_id>\d+)', |
|
| 60 | + array( |
|
| 61 | + 'methods' => \WP_REST_Server::READABLE, |
|
| 62 | + 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::get_faq_items', |
|
| 63 | + 'permission_callback' => function () { |
|
| 64 | + return current_user_can( 'publish_posts' ); |
|
| 65 | + }, |
|
| 66 | + ) |
|
| 67 | + ); |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Get all FAQ items for a post id. |
|
| 73 | - * |
|
| 74 | - * @param $request $request WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 75 | - * |
|
| 76 | - * @return array Result array, if post id is not given then error array is returned. |
|
| 77 | - */ |
|
| 78 | - public static function get_faq_items( $request ) { |
|
| 79 | - $data = $request->get_params(); |
|
| 80 | - if ( array_key_exists('post_id', $data ) ) { |
|
| 81 | - $post_id = (int) $data['post_id']; |
|
| 82 | - return get_post_meta( $post_id, self::FAQ_META_KEY ); |
|
| 83 | - } |
|
| 84 | - else { |
|
| 85 | - return array( |
|
| 86 | - 'status' => 'failure', |
|
| 87 | - 'message' => __( 'Invalid data, post_id missing', 'wordlift' ) |
|
| 88 | - ); |
|
| 89 | - } |
|
| 90 | - } |
|
| 71 | + /** |
|
| 72 | + * Get all FAQ items for a post id. |
|
| 73 | + * |
|
| 74 | + * @param $request $request WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 75 | + * |
|
| 76 | + * @return array Result array, if post id is not given then error array is returned. |
|
| 77 | + */ |
|
| 78 | + public static function get_faq_items( $request ) { |
|
| 79 | + $data = $request->get_params(); |
|
| 80 | + if ( array_key_exists('post_id', $data ) ) { |
|
| 81 | + $post_id = (int) $data['post_id']; |
|
| 82 | + return get_post_meta( $post_id, self::FAQ_META_KEY ); |
|
| 83 | + } |
|
| 84 | + else { |
|
| 85 | + return array( |
|
| 86 | + 'status' => 'failure', |
|
| 87 | + 'message' => __( 'Invalid data, post_id missing', 'wordlift' ) |
|
| 88 | + ); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Update all FAQ items for a post id. |
|
| 94 | - * |
|
| 95 | - * @param $request $request WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 96 | - * |
|
| 97 | - * @return array Result array, if post id is not given then error array is returned. |
|
| 98 | - */ |
|
| 99 | - public static function update_faq_items( $request ) { |
|
| 100 | - $data = $request->get_params(); |
|
| 101 | - if ( array_key_exists('post_id', $data ) && array_key_exists('faq_items', $data ) ) { |
|
| 92 | + /** |
|
| 93 | + * Update all FAQ items for a post id. |
|
| 94 | + * |
|
| 95 | + * @param $request $request WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 96 | + * |
|
| 97 | + * @return array Result array, if post id is not given then error array is returned. |
|
| 98 | + */ |
|
| 99 | + public static function update_faq_items( $request ) { |
|
| 100 | + $data = $request->get_params(); |
|
| 101 | + if ( array_key_exists('post_id', $data ) && array_key_exists('faq_items', $data ) ) { |
|
| 102 | 102 | |
| 103 | - $post_id = (int) $data['post_id']; |
|
| 104 | - $faq_items = (array) $data['faq_items']; |
|
| 105 | - foreach ( $faq_items as $faq_item ) { |
|
| 106 | - $previous_value = array( |
|
| 107 | - 'question' => (string) $faq_item['previous_question_value'], |
|
| 108 | - 'answer' => (string) $faq_item['previous_answer_value'], |
|
| 109 | - 'id' => (int) $faq_item['id'] |
|
| 110 | - ); |
|
| 111 | - $new_value = array( |
|
| 112 | - 'question' => (string) $faq_item['question'], |
|
| 113 | - 'answer' => (string) $faq_item['answer'], |
|
| 114 | - 'id' => (int) $faq_item['id'] |
|
| 115 | - ); |
|
| 116 | - update_post_meta( $post_id, self::FAQ_META_KEY, $new_value, $previous_value ); |
|
| 117 | - } |
|
| 118 | - return array( |
|
| 119 | - 'status' => 'success', |
|
| 120 | - 'message' => __('Faq Items updated successfully') |
|
| 121 | - ); |
|
| 122 | - } |
|
| 123 | - else { |
|
| 124 | - return array( |
|
| 125 | - 'status' => 'failure', |
|
| 126 | - 'message' => __('Failure in updating Faq items') |
|
| 127 | - ); |
|
| 128 | - } |
|
| 129 | - } |
|
| 103 | + $post_id = (int) $data['post_id']; |
|
| 104 | + $faq_items = (array) $data['faq_items']; |
|
| 105 | + foreach ( $faq_items as $faq_item ) { |
|
| 106 | + $previous_value = array( |
|
| 107 | + 'question' => (string) $faq_item['previous_question_value'], |
|
| 108 | + 'answer' => (string) $faq_item['previous_answer_value'], |
|
| 109 | + 'id' => (int) $faq_item['id'] |
|
| 110 | + ); |
|
| 111 | + $new_value = array( |
|
| 112 | + 'question' => (string) $faq_item['question'], |
|
| 113 | + 'answer' => (string) $faq_item['answer'], |
|
| 114 | + 'id' => (int) $faq_item['id'] |
|
| 115 | + ); |
|
| 116 | + update_post_meta( $post_id, self::FAQ_META_KEY, $new_value, $previous_value ); |
|
| 117 | + } |
|
| 118 | + return array( |
|
| 119 | + 'status' => 'success', |
|
| 120 | + 'message' => __('Faq Items updated successfully') |
|
| 121 | + ); |
|
| 122 | + } |
|
| 123 | + else { |
|
| 124 | + return array( |
|
| 125 | + 'status' => 'failure', |
|
| 126 | + 'message' => __('Failure in updating Faq items') |
|
| 127 | + ); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Insert or update FAQ items. |
|
| 133 | - * |
|
| 134 | - * @param $request WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 135 | - * |
|
| 136 | - * @return array Associative array whether the faq item is inserted or not |
|
| 137 | - */ |
|
| 138 | - public static function add_faq_items( $request ) { |
|
| 139 | - $post_data = $request->get_params(); |
|
| 140 | - if ( array_key_exists('post_id', $post_data) && |
|
| 141 | - array_key_exists( 'faq_items', $post_data) ) { |
|
| 142 | - $post_id = $post_data['post_id']; |
|
| 143 | - $faq_items = $post_data['faq_items']; |
|
| 144 | - foreach ( $faq_items as &$faq_item ) { |
|
| 145 | - // Add an identifier id to the faq item, it helps to prevent duplication problem. |
|
| 146 | - /** |
|
| 147 | - * We are using time() and a random integer to prevent |
|
| 148 | - * duplication problem. |
|
| 149 | - */ |
|
| 150 | - $faq_item['id'] = time() + rand(1, 100); |
|
| 151 | - add_post_meta( (int) $post_id, self::FAQ_META_KEY, $faq_item); |
|
| 152 | - } |
|
| 131 | + /** |
|
| 132 | + * Insert or update FAQ items. |
|
| 133 | + * |
|
| 134 | + * @param $request WP_REST_Request $request {@link WP_REST_Request instance}. |
|
| 135 | + * |
|
| 136 | + * @return array Associative array whether the faq item is inserted or not |
|
| 137 | + */ |
|
| 138 | + public static function add_faq_items( $request ) { |
|
| 139 | + $post_data = $request->get_params(); |
|
| 140 | + if ( array_key_exists('post_id', $post_data) && |
|
| 141 | + array_key_exists( 'faq_items', $post_data) ) { |
|
| 142 | + $post_id = $post_data['post_id']; |
|
| 143 | + $faq_items = $post_data['faq_items']; |
|
| 144 | + foreach ( $faq_items as &$faq_item ) { |
|
| 145 | + // Add an identifier id to the faq item, it helps to prevent duplication problem. |
|
| 146 | + /** |
|
| 147 | + * We are using time() and a random integer to prevent |
|
| 148 | + * duplication problem. |
|
| 149 | + */ |
|
| 150 | + $faq_item['id'] = time() + rand(1, 100); |
|
| 151 | + add_post_meta( (int) $post_id, self::FAQ_META_KEY, $faq_item); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * We are returning only the first item id, since the user can select only one text at a time. |
|
| 156 | - */ |
|
| 157 | - return array( |
|
| 158 | - 'status' => 'success', |
|
| 159 | - 'message' => __('Question successfully added.'), |
|
| 160 | - 'id' => (int) $faq_items[0]['id'], |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - else { |
|
| 164 | - return array( |
|
| 165 | - 'status' => 'failure', |
|
| 166 | - 'message' => __( 'Invalid data, post_id or faq_items missing', 'wordlift' ) |
|
| 167 | - ); |
|
| 168 | - } |
|
| 169 | - } |
|
| 154 | + /** |
|
| 155 | + * We are returning only the first item id, since the user can select only one text at a time. |
|
| 156 | + */ |
|
| 157 | + return array( |
|
| 158 | + 'status' => 'success', |
|
| 159 | + 'message' => __('Question successfully added.'), |
|
| 160 | + 'id' => (int) $faq_items[0]['id'], |
|
| 161 | + ); |
|
| 162 | + } |
|
| 163 | + else { |
|
| 164 | + return array( |
|
| 165 | + 'status' => 'failure', |
|
| 166 | + 'message' => __( 'Invalid data, post_id or faq_items missing', 'wordlift' ) |
|
| 167 | + ); |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | 170 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | class FAQ_Rest_Controller { |
| 20 | 20 | const FAQ_META_KEY = 'wl_faq'; |
| 21 | 21 | public static function register_routes() { |
| 22 | - add_action( 'rest_api_init', 'Wordlift\FAQ\FAQ_Rest_Controller::register_route_callback' ); |
|
| 22 | + add_action('rest_api_init', 'Wordlift\FAQ\FAQ_Rest_Controller::register_route_callback'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function register_route_callback() { |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | array( |
| 33 | 33 | 'methods' => \WP_REST_Server::CREATABLE, |
| 34 | 34 | 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::add_faq_items', |
| 35 | - 'permission_callback' => function () { |
|
| 36 | - return current_user_can( 'publish_posts' ); |
|
| 35 | + 'permission_callback' => function() { |
|
| 36 | + return current_user_can('publish_posts'); |
|
| 37 | 37 | }, |
| 38 | 38 | ) |
| 39 | 39 | ); |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | array( |
| 47 | 47 | 'methods' => \WP_REST_Server::EDITABLE, |
| 48 | 48 | 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::update_faq_items', |
| 49 | - 'permission_callback' => function () { |
|
| 50 | - return current_user_can( 'publish_posts' ); |
|
| 49 | + 'permission_callback' => function() { |
|
| 50 | + return current_user_can('publish_posts'); |
|
| 51 | 51 | }, |
| 52 | 52 | ) |
| 53 | 53 | ); |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | array( |
| 61 | 61 | 'methods' => \WP_REST_Server::READABLE, |
| 62 | 62 | 'callback' => 'Wordlift\FAQ\FAQ_Rest_Controller::get_faq_items', |
| 63 | - 'permission_callback' => function () { |
|
| 64 | - return current_user_can( 'publish_posts' ); |
|
| 63 | + 'permission_callback' => function() { |
|
| 64 | + return current_user_can('publish_posts'); |
|
| 65 | 65 | }, |
| 66 | 66 | ) |
| 67 | 67 | ); |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return array Result array, if post id is not given then error array is returned. |
| 77 | 77 | */ |
| 78 | - public static function get_faq_items( $request ) { |
|
| 78 | + public static function get_faq_items($request) { |
|
| 79 | 79 | $data = $request->get_params(); |
| 80 | - if ( array_key_exists('post_id', $data ) ) { |
|
| 80 | + if (array_key_exists('post_id', $data)) { |
|
| 81 | 81 | $post_id = (int) $data['post_id']; |
| 82 | - return get_post_meta( $post_id, self::FAQ_META_KEY ); |
|
| 82 | + return get_post_meta($post_id, self::FAQ_META_KEY); |
|
| 83 | 83 | } |
| 84 | 84 | else { |
| 85 | 85 | return array( |
| 86 | 86 | 'status' => 'failure', |
| 87 | - 'message' => __( 'Invalid data, post_id missing', 'wordlift' ) |
|
| 87 | + 'message' => __('Invalid data, post_id missing', 'wordlift') |
|
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return array Result array, if post id is not given then error array is returned. |
| 98 | 98 | */ |
| 99 | - public static function update_faq_items( $request ) { |
|
| 99 | + public static function update_faq_items($request) { |
|
| 100 | 100 | $data = $request->get_params(); |
| 101 | - if ( array_key_exists('post_id', $data ) && array_key_exists('faq_items', $data ) ) { |
|
| 101 | + if (array_key_exists('post_id', $data) && array_key_exists('faq_items', $data)) { |
|
| 102 | 102 | |
| 103 | 103 | $post_id = (int) $data['post_id']; |
| 104 | 104 | $faq_items = (array) $data['faq_items']; |
| 105 | - foreach ( $faq_items as $faq_item ) { |
|
| 105 | + foreach ($faq_items as $faq_item) { |
|
| 106 | 106 | $previous_value = array( |
| 107 | 107 | 'question' => (string) $faq_item['previous_question_value'], |
| 108 | 108 | 'answer' => (string) $faq_item['previous_answer_value'], |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'answer' => (string) $faq_item['answer'], |
| 114 | 114 | 'id' => (int) $faq_item['id'] |
| 115 | 115 | ); |
| 116 | - update_post_meta( $post_id, self::FAQ_META_KEY, $new_value, $previous_value ); |
|
| 116 | + update_post_meta($post_id, self::FAQ_META_KEY, $new_value, $previous_value); |
|
| 117 | 117 | } |
| 118 | 118 | return array( |
| 119 | 119 | 'status' => 'success', |
@@ -135,20 +135,20 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return array Associative array whether the faq item is inserted or not |
| 137 | 137 | */ |
| 138 | - public static function add_faq_items( $request ) { |
|
| 138 | + public static function add_faq_items($request) { |
|
| 139 | 139 | $post_data = $request->get_params(); |
| 140 | - if ( array_key_exists('post_id', $post_data) && |
|
| 141 | - array_key_exists( 'faq_items', $post_data) ) { |
|
| 140 | + if (array_key_exists('post_id', $post_data) && |
|
| 141 | + array_key_exists('faq_items', $post_data)) { |
|
| 142 | 142 | $post_id = $post_data['post_id']; |
| 143 | 143 | $faq_items = $post_data['faq_items']; |
| 144 | - foreach ( $faq_items as &$faq_item ) { |
|
| 144 | + foreach ($faq_items as &$faq_item) { |
|
| 145 | 145 | // Add an identifier id to the faq item, it helps to prevent duplication problem. |
| 146 | 146 | /** |
| 147 | 147 | * We are using time() and a random integer to prevent |
| 148 | 148 | * duplication problem. |
| 149 | 149 | */ |
| 150 | 150 | $faq_item['id'] = time() + rand(1, 100); |
| 151 | - add_post_meta( (int) $post_id, self::FAQ_META_KEY, $faq_item); |
|
| 151 | + add_post_meta((int) $post_id, self::FAQ_META_KEY, $faq_item); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | else { |
| 164 | 164 | return array( |
| 165 | 165 | 'status' => 'failure', |
| 166 | - 'message' => __( 'Invalid data, post_id or faq_items missing', 'wordlift' ) |
|
| 166 | + 'message' => __('Invalid data, post_id or faq_items missing', 'wordlift') |
|
| 167 | 167 | ); |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -80,8 +80,7 @@ discard block |
||
| 80 | 80 | if ( array_key_exists('post_id', $data ) ) { |
| 81 | 81 | $post_id = (int) $data['post_id']; |
| 82 | 82 | return get_post_meta( $post_id, self::FAQ_META_KEY ); |
| 83 | - } |
|
| 84 | - else { |
|
| 83 | + } else { |
|
| 85 | 84 | return array( |
| 86 | 85 | 'status' => 'failure', |
| 87 | 86 | 'message' => __( 'Invalid data, post_id missing', 'wordlift' ) |
@@ -119,8 +118,7 @@ discard block |
||
| 119 | 118 | 'status' => 'success', |
| 120 | 119 | 'message' => __('Faq Items updated successfully') |
| 121 | 120 | ); |
| 122 | - } |
|
| 123 | - else { |
|
| 121 | + } else { |
|
| 124 | 122 | return array( |
| 125 | 123 | 'status' => 'failure', |
| 126 | 124 | 'message' => __('Failure in updating Faq items') |
@@ -159,8 +157,7 @@ discard block |
||
| 159 | 157 | 'message' => __('Question successfully added.'), |
| 160 | 158 | 'id' => (int) $faq_items[0]['id'], |
| 161 | 159 | ); |
| 162 | - } |
|
| 163 | - else { |
|
| 160 | + } else { |
|
| 164 | 161 | return array( |
| 165 | 162 | 'status' => 'failure', |
| 166 | 163 | 'message' => __( 'Invalid data, post_id or faq_items missing', 'wordlift' ) |
@@ -13,23 +13,23 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Faq_Tinymce_Adapter { |
| 15 | 15 | |
| 16 | - const FAQ_TINYMCE_PLUGIN_NAME = "wl_faq_tinymce"; |
|
| 17 | - |
|
| 18 | - const FAQ_TINYMCE_ADD_BUTTON_ID = "wl-faq-toolbar-button"; |
|
| 19 | - |
|
| 20 | - public function register_faq_tinymce_plugin( $plugins ) { |
|
| 21 | - /** |
|
| 22 | - * Registering the tinymce plugin for FAQ here. |
|
| 23 | - * @since 3.26.0 |
|
| 24 | - */ |
|
| 25 | - $version = Wordlift::get_instance()->get_version(); |
|
| 26 | - $plugins[self::FAQ_TINYMCE_PLUGIN_NAME] = plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/tinymce-faq-plugin.js?ver=' . $version; |
|
| 27 | - return $plugins; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function register_faq_toolbar_button( $buttons ) { |
|
| 31 | - array_push( $buttons, self::FAQ_TINYMCE_ADD_BUTTON_ID ); |
|
| 32 | - return $buttons; |
|
| 33 | - } |
|
| 16 | + const FAQ_TINYMCE_PLUGIN_NAME = "wl_faq_tinymce"; |
|
| 17 | + |
|
| 18 | + const FAQ_TINYMCE_ADD_BUTTON_ID = "wl-faq-toolbar-button"; |
|
| 19 | + |
|
| 20 | + public function register_faq_tinymce_plugin( $plugins ) { |
|
| 21 | + /** |
|
| 22 | + * Registering the tinymce plugin for FAQ here. |
|
| 23 | + * @since 3.26.0 |
|
| 24 | + */ |
|
| 25 | + $version = Wordlift::get_instance()->get_version(); |
|
| 26 | + $plugins[self::FAQ_TINYMCE_PLUGIN_NAME] = plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/tinymce-faq-plugin.js?ver=' . $version; |
|
| 27 | + return $plugins; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function register_faq_toolbar_button( $buttons ) { |
|
| 31 | + array_push( $buttons, self::FAQ_TINYMCE_ADD_BUTTON_ID ); |
|
| 32 | + return $buttons; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | } |
@@ -17,18 +17,18 @@ |
||
| 17 | 17 | |
| 18 | 18 | const FAQ_TINYMCE_ADD_BUTTON_ID = "wl-faq-toolbar-button"; |
| 19 | 19 | |
| 20 | - public function register_faq_tinymce_plugin( $plugins ) { |
|
| 20 | + public function register_faq_tinymce_plugin($plugins) { |
|
| 21 | 21 | /** |
| 22 | 22 | * Registering the tinymce plugin for FAQ here. |
| 23 | 23 | * @since 3.26.0 |
| 24 | 24 | */ |
| 25 | 25 | $version = Wordlift::get_instance()->get_version(); |
| 26 | - $plugins[self::FAQ_TINYMCE_PLUGIN_NAME] = plugin_dir_url( dirname( __DIR__ ) ) . 'js/dist/tinymce-faq-plugin.js?ver=' . $version; |
|
| 26 | + $plugins[self::FAQ_TINYMCE_PLUGIN_NAME] = plugin_dir_url(dirname(__DIR__)).'js/dist/tinymce-faq-plugin.js?ver='.$version; |
|
| 27 | 27 | return $plugins; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function register_faq_toolbar_button( $buttons ) { |
|
| 31 | - array_push( $buttons, self::FAQ_TINYMCE_ADD_BUTTON_ID ); |
|
| 30 | + public function register_faq_toolbar_button($buttons) { |
|
| 31 | + array_push($buttons, self::FAQ_TINYMCE_ADD_BUTTON_ID); |
|
| 32 | 32 | return $buttons; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -17,86 +17,86 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Faq_To_Jsonld_Converter { |
| 19 | 19 | |
| 20 | - const FAQ_JSONLD_TYPE = 'FAQPage'; |
|
| 20 | + const FAQ_JSONLD_TYPE = 'FAQPage'; |
|
| 21 | 21 | |
| 22 | - public function __construct() { |
|
| 23 | - add_filter( 'wl_post_jsonld_array', array( $this, 'get_jsonld_for_faq' ), 11, 2 ); |
|
| 24 | - add_filter( 'wl_entity_jsonld_array', array( $this, 'get_jsonld_for_faq' ), 11, 2 ); |
|
| 25 | - } |
|
| 22 | + public function __construct() { |
|
| 23 | + add_filter( 'wl_post_jsonld_array', array( $this, 'get_jsonld_for_faq' ), 11, 2 ); |
|
| 24 | + add_filter( 'wl_entity_jsonld_array', array( $this, 'get_jsonld_for_faq' ), 11, 2 ); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Set the FAQ type to the json ld array |
|
| 29 | - * |
|
| 30 | - * @param $jsonld array The jsonld array. |
|
| 31 | - * |
|
| 32 | - * @return array Returns the json ld array with the type set. |
|
| 33 | - */ |
|
| 34 | - public function set_faq_type( $jsonld ) { |
|
| 35 | - if ( array_key_exists('@type', $jsonld)) { |
|
| 36 | - if ( is_string($jsonld['@type'])) { |
|
| 37 | - // If a plain string is present, create an array with previous items. |
|
| 38 | - $jsonld['@type'] = array($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
|
| 39 | - return $jsonld; |
|
| 40 | - } |
|
| 41 | - // check if it is a array, then append the type. |
|
| 42 | - if ( is_array($jsonld['@type']) && ! in_array(self::FAQ_JSONLD_TYPE, $jsonld['@type'])) { |
|
| 43 | - array_push($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
|
| 44 | - return $jsonld; |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - else { |
|
| 48 | - $jsonld['@type'] = array(self::FAQ_JSONLD_TYPE); |
|
| 49 | - } |
|
| 50 | - return $jsonld; |
|
| 51 | - } |
|
| 52 | - /** |
|
| 53 | - * @param $post_id int The id of the post. |
|
| 54 | - * |
|
| 55 | - * @return array Get the converted jsonld data |
|
| 56 | - */ |
|
| 57 | - public function get_jsonld_for_faq( $value, $post_id ) { |
|
| 27 | + /** |
|
| 28 | + * Set the FAQ type to the json ld array |
|
| 29 | + * |
|
| 30 | + * @param $jsonld array The jsonld array. |
|
| 31 | + * |
|
| 32 | + * @return array Returns the json ld array with the type set. |
|
| 33 | + */ |
|
| 34 | + public function set_faq_type( $jsonld ) { |
|
| 35 | + if ( array_key_exists('@type', $jsonld)) { |
|
| 36 | + if ( is_string($jsonld['@type'])) { |
|
| 37 | + // If a plain string is present, create an array with previous items. |
|
| 38 | + $jsonld['@type'] = array($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
|
| 39 | + return $jsonld; |
|
| 40 | + } |
|
| 41 | + // check if it is a array, then append the type. |
|
| 42 | + if ( is_array($jsonld['@type']) && ! in_array(self::FAQ_JSONLD_TYPE, $jsonld['@type'])) { |
|
| 43 | + array_push($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
|
| 44 | + return $jsonld; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + else { |
|
| 48 | + $jsonld['@type'] = array(self::FAQ_JSONLD_TYPE); |
|
| 49 | + } |
|
| 50 | + return $jsonld; |
|
| 51 | + } |
|
| 52 | + /** |
|
| 53 | + * @param $post_id int The id of the post. |
|
| 54 | + * |
|
| 55 | + * @return array Get the converted jsonld data |
|
| 56 | + */ |
|
| 57 | + public function get_jsonld_for_faq( $value, $post_id ) { |
|
| 58 | 58 | |
| 59 | - $jsonld = $value['jsonld']; |
|
| 60 | - $references = $value['references']; |
|
| 59 | + $jsonld = $value['jsonld']; |
|
| 60 | + $references = $value['references']; |
|
| 61 | 61 | |
| 62 | - $faq_items = get_post_meta( $post_id, FAQ_Rest_Controller::FAQ_META_KEY); |
|
| 63 | - /** |
|
| 64 | - * Apply the FAQ mapping only if the FAQ items are present. |
|
| 65 | - */ |
|
| 66 | - if ( count($faq_items) > 0 ) { |
|
| 67 | - $faq_data = $this->get_faq_data( $faq_items ); |
|
| 68 | - // Merge the FAQ data with jsonld. |
|
| 69 | - $jsonld = array_merge( $jsonld, $faq_data); |
|
| 70 | - // check if the @type is set on json ld |
|
| 71 | - $jsonld = $this->set_faq_type($jsonld); |
|
| 72 | - } |
|
| 73 | - return array( |
|
| 74 | - 'jsonld' => $jsonld, |
|
| 75 | - 'references' => $references, |
|
| 76 | - ); |
|
| 77 | - } |
|
| 62 | + $faq_items = get_post_meta( $post_id, FAQ_Rest_Controller::FAQ_META_KEY); |
|
| 63 | + /** |
|
| 64 | + * Apply the FAQ mapping only if the FAQ items are present. |
|
| 65 | + */ |
|
| 66 | + if ( count($faq_items) > 0 ) { |
|
| 67 | + $faq_data = $this->get_faq_data( $faq_items ); |
|
| 68 | + // Merge the FAQ data with jsonld. |
|
| 69 | + $jsonld = array_merge( $jsonld, $faq_data); |
|
| 70 | + // check if the @type is set on json ld |
|
| 71 | + $jsonld = $this->set_faq_type($jsonld); |
|
| 72 | + } |
|
| 73 | + return array( |
|
| 74 | + 'jsonld' => $jsonld, |
|
| 75 | + 'references' => $references, |
|
| 76 | + ); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @param $faq_items array List of FAQ items extracted from the meta. |
|
| 81 | - * |
|
| 82 | - * @return array Associtative array of type, mainEntity. |
|
| 83 | - */ |
|
| 84 | - private function get_faq_data( $faq_items ) { |
|
| 85 | - $jsonld_data['mainEntity'] = array(); |
|
| 86 | - foreach ( $faq_items as $faq_item ) { |
|
| 87 | - if ( 0 === strlen($faq_item['question']) || 0 === strlen($faq_item['answer']) ) { |
|
| 88 | - // Bail out if question or answer is not present |
|
| 89 | - continue; |
|
| 90 | - } |
|
| 91 | - $faq_data = array(); |
|
| 92 | - $faq_data['@type'] = 'Question'; |
|
| 93 | - $faq_data['name'] = $faq_item['question']; |
|
| 94 | - $faq_data['acceptedAnswer'] = array(); |
|
| 95 | - $faq_data['acceptedAnswer']['@type'] = 'Answer'; |
|
| 96 | - $faq_data['acceptedAnswer']['text'] = $faq_item['answer']; |
|
| 97 | - array_push( $jsonld_data['mainEntity'], $faq_data ); |
|
| 98 | - } |
|
| 79 | + /** |
|
| 80 | + * @param $faq_items array List of FAQ items extracted from the meta. |
|
| 81 | + * |
|
| 82 | + * @return array Associtative array of type, mainEntity. |
|
| 83 | + */ |
|
| 84 | + private function get_faq_data( $faq_items ) { |
|
| 85 | + $jsonld_data['mainEntity'] = array(); |
|
| 86 | + foreach ( $faq_items as $faq_item ) { |
|
| 87 | + if ( 0 === strlen($faq_item['question']) || 0 === strlen($faq_item['answer']) ) { |
|
| 88 | + // Bail out if question or answer is not present |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 91 | + $faq_data = array(); |
|
| 92 | + $faq_data['@type'] = 'Question'; |
|
| 93 | + $faq_data['name'] = $faq_item['question']; |
|
| 94 | + $faq_data['acceptedAnswer'] = array(); |
|
| 95 | + $faq_data['acceptedAnswer']['@type'] = 'Answer'; |
|
| 96 | + $faq_data['acceptedAnswer']['text'] = $faq_item['answer']; |
|
| 97 | + array_push( $jsonld_data['mainEntity'], $faq_data ); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - return $jsonld_data; |
|
| 101 | - } |
|
| 100 | + return $jsonld_data; |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | const FAQ_JSONLD_TYPE = 'FAQPage'; |
| 21 | 21 | |
| 22 | 22 | public function __construct() { |
| 23 | - add_filter( 'wl_post_jsonld_array', array( $this, 'get_jsonld_for_faq' ), 11, 2 ); |
|
| 24 | - add_filter( 'wl_entity_jsonld_array', array( $this, 'get_jsonld_for_faq' ), 11, 2 ); |
|
| 23 | + add_filter('wl_post_jsonld_array', array($this, 'get_jsonld_for_faq'), 11, 2); |
|
| 24 | + add_filter('wl_entity_jsonld_array', array($this, 'get_jsonld_for_faq'), 11, 2); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return array Returns the json ld array with the type set. |
| 33 | 33 | */ |
| 34 | - public function set_faq_type( $jsonld ) { |
|
| 35 | - if ( array_key_exists('@type', $jsonld)) { |
|
| 36 | - if ( is_string($jsonld['@type'])) { |
|
| 34 | + public function set_faq_type($jsonld) { |
|
| 35 | + if (array_key_exists('@type', $jsonld)) { |
|
| 36 | + if (is_string($jsonld['@type'])) { |
|
| 37 | 37 | // If a plain string is present, create an array with previous items. |
| 38 | 38 | $jsonld['@type'] = array($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
| 39 | 39 | return $jsonld; |
| 40 | 40 | } |
| 41 | 41 | // check if it is a array, then append the type. |
| 42 | - if ( is_array($jsonld['@type']) && ! in_array(self::FAQ_JSONLD_TYPE, $jsonld['@type'])) { |
|
| 42 | + if (is_array($jsonld['@type']) && ! in_array(self::FAQ_JSONLD_TYPE, $jsonld['@type'])) { |
|
| 43 | 43 | array_push($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
| 44 | 44 | return $jsonld; |
| 45 | 45 | } |
@@ -54,19 +54,19 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return array Get the converted jsonld data |
| 56 | 56 | */ |
| 57 | - public function get_jsonld_for_faq( $value, $post_id ) { |
|
| 57 | + public function get_jsonld_for_faq($value, $post_id) { |
|
| 58 | 58 | |
| 59 | 59 | $jsonld = $value['jsonld']; |
| 60 | 60 | $references = $value['references']; |
| 61 | 61 | |
| 62 | - $faq_items = get_post_meta( $post_id, FAQ_Rest_Controller::FAQ_META_KEY); |
|
| 62 | + $faq_items = get_post_meta($post_id, FAQ_Rest_Controller::FAQ_META_KEY); |
|
| 63 | 63 | /** |
| 64 | 64 | * Apply the FAQ mapping only if the FAQ items are present. |
| 65 | 65 | */ |
| 66 | - if ( count($faq_items) > 0 ) { |
|
| 67 | - $faq_data = $this->get_faq_data( $faq_items ); |
|
| 66 | + if (count($faq_items) > 0) { |
|
| 67 | + $faq_data = $this->get_faq_data($faq_items); |
|
| 68 | 68 | // Merge the FAQ data with jsonld. |
| 69 | - $jsonld = array_merge( $jsonld, $faq_data); |
|
| 69 | + $jsonld = array_merge($jsonld, $faq_data); |
|
| 70 | 70 | // check if the @type is set on json ld |
| 71 | 71 | $jsonld = $this->set_faq_type($jsonld); |
| 72 | 72 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return array Associtative array of type, mainEntity. |
| 83 | 83 | */ |
| 84 | - private function get_faq_data( $faq_items ) { |
|
| 84 | + private function get_faq_data($faq_items) { |
|
| 85 | 85 | $jsonld_data['mainEntity'] = array(); |
| 86 | - foreach ( $faq_items as $faq_item ) { |
|
| 87 | - if ( 0 === strlen($faq_item['question']) || 0 === strlen($faq_item['answer']) ) { |
|
| 86 | + foreach ($faq_items as $faq_item) { |
|
| 87 | + if (0 === strlen($faq_item['question']) || 0 === strlen($faq_item['answer'])) { |
|
| 88 | 88 | // Bail out if question or answer is not present |
| 89 | 89 | continue; |
| 90 | 90 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $faq_data['acceptedAnswer'] = array(); |
| 95 | 95 | $faq_data['acceptedAnswer']['@type'] = 'Answer'; |
| 96 | 96 | $faq_data['acceptedAnswer']['text'] = $faq_item['answer']; |
| 97 | - array_push( $jsonld_data['mainEntity'], $faq_data ); |
|
| 97 | + array_push($jsonld_data['mainEntity'], $faq_data); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | return $jsonld_data; |
@@ -43,8 +43,7 @@ |
||
| 43 | 43 | array_push($jsonld['@type'], self::FAQ_JSONLD_TYPE); |
| 44 | 44 | return $jsonld; |
| 45 | 45 | } |
| 46 | - } |
|
| 47 | - else { |
|
| 46 | + } else { |
|
| 48 | 47 | $jsonld['@type'] = array(self::FAQ_JSONLD_TYPE); |
| 49 | 48 | } |
| 50 | 49 | return $jsonld; |