@@ -4,186 +4,186 @@ |
||
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | class Config { |
| 7 | - /** |
|
| 8 | - * @var \Wordlift_Admin_Setup |
|
| 9 | - */ |
|
| 10 | - private $admin_setup; |
|
| 11 | - /** |
|
| 12 | - * @var \Wordlift_Key_Validation_Service |
|
| 13 | - */ |
|
| 14 | - private $key_validation_service; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * Config constructor. |
|
| 18 | - * |
|
| 19 | - * @param $admin_setup \Wordlift_Admin_Setup |
|
| 20 | - * @param $key_validation_service \Wordlift_Key_Validation_Service |
|
| 21 | - */ |
|
| 22 | - public function __construct( $admin_setup, $key_validation_service ) { |
|
| 23 | - |
|
| 24 | - $this->admin_setup = $admin_setup; |
|
| 25 | - $this->key_validation_service = $key_validation_service; |
|
| 26 | - add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) ); |
|
| 27 | - |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Check if the key is valid and also not bound to any domain. |
|
| 32 | - * |
|
| 33 | - * @param $key string |
|
| 34 | - * |
|
| 35 | - * @return bool |
|
| 36 | - */ |
|
| 37 | - private function is_key_valid_and_not_bound_to_any_domain( $key ) { |
|
| 38 | - $account_info = $this->key_validation_service->get_account_info( $key ); |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * we need to check if the key is not associated with any account |
|
| 42 | - * before setting it, we should check if the url is null. |
|
| 43 | - */ |
|
| 44 | - if ( is_wp_error( $account_info ) |
|
| 45 | - || wp_remote_retrieve_response_code( $account_info ) !== 200 ) { |
|
| 46 | - return false; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - $account_info_json = $account_info['body']; |
|
| 50 | - |
|
| 51 | - $account_info_data = json_decode( $account_info_json, true ); |
|
| 52 | - |
|
| 53 | - if ( ! $account_info_data ) { |
|
| 54 | - // Invalid json returned by api. |
|
| 55 | - return false; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) ); |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - if ( $account_info_data['url'] === null ) { |
|
| 62 | - return true; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - // Check if the key belongs to same site. |
|
| 66 | - if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) { |
|
| 67 | - // key already associated with another account. |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // Return true if the key domain and site domain are the same. |
|
| 72 | - return true; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - public function config() { |
|
| 77 | - |
|
| 78 | - // Perform validation check for all the parameters. |
|
| 79 | - $required_fields = array( |
|
| 80 | - 'diagnostic', |
|
| 81 | - 'vocabulary', |
|
| 7 | + /** |
|
| 8 | + * @var \Wordlift_Admin_Setup |
|
| 9 | + */ |
|
| 10 | + private $admin_setup; |
|
| 11 | + /** |
|
| 12 | + * @var \Wordlift_Key_Validation_Service |
|
| 13 | + */ |
|
| 14 | + private $key_validation_service; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * Config constructor. |
|
| 18 | + * |
|
| 19 | + * @param $admin_setup \Wordlift_Admin_Setup |
|
| 20 | + * @param $key_validation_service \Wordlift_Key_Validation_Service |
|
| 21 | + */ |
|
| 22 | + public function __construct( $admin_setup, $key_validation_service ) { |
|
| 23 | + |
|
| 24 | + $this->admin_setup = $admin_setup; |
|
| 25 | + $this->key_validation_service = $key_validation_service; |
|
| 26 | + add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) ); |
|
| 27 | + |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Check if the key is valid and also not bound to any domain. |
|
| 32 | + * |
|
| 33 | + * @param $key string |
|
| 34 | + * |
|
| 35 | + * @return bool |
|
| 36 | + */ |
|
| 37 | + private function is_key_valid_and_not_bound_to_any_domain( $key ) { |
|
| 38 | + $account_info = $this->key_validation_service->get_account_info( $key ); |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * we need to check if the key is not associated with any account |
|
| 42 | + * before setting it, we should check if the url is null. |
|
| 43 | + */ |
|
| 44 | + if ( is_wp_error( $account_info ) |
|
| 45 | + || wp_remote_retrieve_response_code( $account_info ) !== 200 ) { |
|
| 46 | + return false; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + $account_info_json = $account_info['body']; |
|
| 50 | + |
|
| 51 | + $account_info_data = json_decode( $account_info_json, true ); |
|
| 52 | + |
|
| 53 | + if ( ! $account_info_data ) { |
|
| 54 | + // Invalid json returned by api. |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) ); |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + if ( $account_info_data['url'] === null ) { |
|
| 62 | + return true; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + // Check if the key belongs to same site. |
|
| 66 | + if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) { |
|
| 67 | + // key already associated with another account. |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // Return true if the key domain and site domain are the same. |
|
| 72 | + return true; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + public function config() { |
|
| 77 | + |
|
| 78 | + // Perform validation check for all the parameters. |
|
| 79 | + $required_fields = array( |
|
| 80 | + 'diagnostic', |
|
| 81 | + 'vocabulary', |
|
| 82 | 82 | // Don't ask for language from webapp. |
| 83 | 83 | // 'language', |
| 84 | - 'country', |
|
| 85 | - 'publisherName', |
|
| 86 | - 'publisher', |
|
| 87 | - 'license' |
|
| 88 | - ); |
|
| 84 | + 'country', |
|
| 85 | + 'publisherName', |
|
| 86 | + 'publisher', |
|
| 87 | + 'license' |
|
| 88 | + ); |
|
| 89 | 89 | |
| 90 | - header( 'Access-Control-Allow-Origin: *' ); |
|
| 90 | + header( 'Access-Control-Allow-Origin: *' ); |
|
| 91 | 91 | |
| 92 | - // validate all the fields before processing |
|
| 93 | - foreach ( $required_fields as $field ) { |
|
| 94 | - if ( ! array_key_exists( $field, $_POST ) ) { |
|
| 95 | - wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 ); |
|
| 92 | + // validate all the fields before processing |
|
| 93 | + foreach ( $required_fields as $field ) { |
|
| 94 | + if ( ! array_key_exists( $field, $_POST ) ) { |
|
| 95 | + wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 ); |
|
| 96 | 96 | |
| 97 | - return; |
|
| 98 | - } |
|
| 99 | - } |
|
| 97 | + return; |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - $key = (string) $_POST['license']; |
|
| 101 | + $key = (string) $_POST['license']; |
|
| 102 | 102 | |
| 103 | - if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) { |
|
| 104 | - wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 ); |
|
| 103 | + if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) { |
|
| 104 | + wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 ); |
|
| 105 | 105 | |
| 106 | - // exit if not valid. |
|
| 107 | - return; |
|
| 108 | - } |
|
| 106 | + // exit if not valid. |
|
| 107 | + return; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | - // check if key is already configured, if yes then dont save settings. |
|
| 112 | - if ( \Wordlift_Configuration_Service::get_instance()->get_key() ) { |
|
| 113 | - wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 ); |
|
| 111 | + // check if key is already configured, if yes then dont save settings. |
|
| 112 | + if ( \Wordlift_Configuration_Service::get_instance()->get_key() ) { |
|
| 113 | + wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 ); |
|
| 114 | 114 | |
| 115 | - // key already configured |
|
| 116 | - return; |
|
| 117 | - } |
|
| 115 | + // key already configured |
|
| 116 | + return; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - $this->admin_setup->save_configuration( $this->get_params() ); |
|
| 119 | + $this->admin_setup->save_configuration( $this->get_params() ); |
|
| 120 | 120 | |
| 121 | 121 | |
| 122 | - wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) ); |
|
| 123 | - } |
|
| 122 | + wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) ); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * |
|
| 127 | - * @return array |
|
| 128 | - */ |
|
| 129 | - private function get_params() { |
|
| 125 | + /** |
|
| 126 | + * |
|
| 127 | + * @return array |
|
| 128 | + */ |
|
| 129 | + private function get_params() { |
|
| 130 | 130 | |
| 131 | - $attachment_id = $this->may_be_get_attachment_id(); |
|
| 131 | + $attachment_id = $this->may_be_get_attachment_id(); |
|
| 132 | 132 | |
| 133 | - $params = array( |
|
| 134 | - 'key' => isset( $_POST['license'] ) ? (string) $_POST['license'] : '', |
|
| 135 | - 'vocabulary' => isset( $_POST['vocabulary'] ) ? (string) $_POST['vocabulary'] : '', |
|
| 136 | - 'wl-country-code' => isset( $_POST['country'] ) ? (string) $_POST['country'] : '', |
|
| 137 | - 'name' => isset( $_POST['publisherName'] ) ? (string) $_POST['publisherName'] : '', |
|
| 138 | - 'user_type' => isset( $_POST['publisher'] ) ? (string) $_POST['publisher'] : '', |
|
| 139 | - 'logo' => $attachment_id |
|
| 140 | - ); |
|
| 133 | + $params = array( |
|
| 134 | + 'key' => isset( $_POST['license'] ) ? (string) $_POST['license'] : '', |
|
| 135 | + 'vocabulary' => isset( $_POST['vocabulary'] ) ? (string) $_POST['vocabulary'] : '', |
|
| 136 | + 'wl-country-code' => isset( $_POST['country'] ) ? (string) $_POST['country'] : '', |
|
| 137 | + 'name' => isset( $_POST['publisherName'] ) ? (string) $_POST['publisherName'] : '', |
|
| 138 | + 'user_type' => isset( $_POST['publisher'] ) ? (string) $_POST['publisher'] : '', |
|
| 139 | + 'logo' => $attachment_id |
|
| 140 | + ); |
|
| 141 | 141 | |
| 142 | - $diagnostic = isset( $_POST['diagnostic'] ) ? (bool) $_POST['diagnostic'] : false; |
|
| 143 | - if ( $diagnostic ) { |
|
| 144 | - $params['share-diagnostic'] = 'on'; |
|
| 145 | - } |
|
| 142 | + $diagnostic = isset( $_POST['diagnostic'] ) ? (bool) $_POST['diagnostic'] : false; |
|
| 143 | + if ( $diagnostic ) { |
|
| 144 | + $params['share-diagnostic'] = 'on'; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - return $params; |
|
| 148 | - } |
|
| 147 | + return $params; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * @return int | bool |
|
| 152 | - */ |
|
| 153 | - private function may_be_get_attachment_id() { |
|
| 150 | + /** |
|
| 151 | + * @return int | bool |
|
| 152 | + */ |
|
| 153 | + private function may_be_get_attachment_id() { |
|
| 154 | 154 | |
| 155 | - // if image or image extension not posted then return false. |
|
| 156 | - if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) { |
|
| 157 | - return false; |
|
| 158 | - } |
|
| 155 | + // if image or image extension not posted then return false. |
|
| 156 | + if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) { |
|
| 157 | + return false; |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - $allowed_extensions = array( 'png', 'jpeg', 'jpg' ); |
|
| 161 | - $image_string = (string) $_POST['image']; |
|
| 162 | - $image_ext = (string) $_POST['imageExtension']; |
|
| 160 | + $allowed_extensions = array( 'png', 'jpeg', 'jpg' ); |
|
| 161 | + $image_string = (string) $_POST['image']; |
|
| 162 | + $image_ext = (string) $_POST['imageExtension']; |
|
| 163 | 163 | |
| 164 | - if ( ! in_array( $image_ext, $allowed_extensions ) ) { |
|
| 165 | - return false; |
|
| 166 | - } |
|
| 164 | + if ( ! in_array( $image_ext, $allowed_extensions ) ) { |
|
| 165 | + return false; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - $image_decoded_string = base64_decode( $image_string ); |
|
| 168 | + $image_decoded_string = base64_decode( $image_string ); |
|
| 169 | 169 | |
| 170 | - $upload_dir = wp_upload_dir(); |
|
| 170 | + $upload_dir = wp_upload_dir(); |
|
| 171 | 171 | |
| 172 | - $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext; |
|
| 172 | + $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext; |
|
| 173 | 173 | |
| 174 | - file_put_contents( $file_path, $image_decoded_string ); |
|
| 174 | + file_put_contents( $file_path, $image_decoded_string ); |
|
| 175 | 175 | |
| 176 | - $attachment_id = wp_insert_attachment( array( |
|
| 177 | - 'post_status' => 'inherit', |
|
| 178 | - 'post_mime_type' => "image/$image_ext" |
|
| 179 | - ), $file_path ); |
|
| 176 | + $attachment_id = wp_insert_attachment( array( |
|
| 177 | + 'post_status' => 'inherit', |
|
| 178 | + 'post_mime_type' => "image/$image_ext" |
|
| 179 | + ), $file_path ); |
|
| 180 | 180 | |
| 181 | - // Generate the metadata for the attachment, and update the database record. |
|
| 182 | - $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path ); |
|
| 183 | - // Update the attachment metadata. |
|
| 184 | - wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 181 | + // Generate the metadata for the attachment, and update the database record. |
|
| 182 | + $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path ); |
|
| 183 | + // Update the attachment metadata. |
|
| 184 | + wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 185 | 185 | |
| 186 | - return $attachment_id; |
|
| 187 | - } |
|
| 186 | + return $attachment_id; |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | } |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | * @param $admin_setup \Wordlift_Admin_Setup |
| 20 | 20 | * @param $key_validation_service \Wordlift_Key_Validation_Service |
| 21 | 21 | */ |
| 22 | - public function __construct( $admin_setup, $key_validation_service ) { |
|
| 22 | + public function __construct($admin_setup, $key_validation_service) { |
|
| 23 | 23 | |
| 24 | 24 | $this->admin_setup = $admin_setup; |
| 25 | 25 | $this->key_validation_service = $key_validation_service; |
| 26 | - add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) ); |
|
| 26 | + add_action('wp_ajax_nopriv_wl_config_plugin', array($this, 'config')); |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | |
@@ -34,36 +34,36 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return bool |
| 36 | 36 | */ |
| 37 | - private function is_key_valid_and_not_bound_to_any_domain( $key ) { |
|
| 38 | - $account_info = $this->key_validation_service->get_account_info( $key ); |
|
| 37 | + private function is_key_valid_and_not_bound_to_any_domain($key) { |
|
| 38 | + $account_info = $this->key_validation_service->get_account_info($key); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * we need to check if the key is not associated with any account |
| 42 | 42 | * before setting it, we should check if the url is null. |
| 43 | 43 | */ |
| 44 | - if ( is_wp_error( $account_info ) |
|
| 45 | - || wp_remote_retrieve_response_code( $account_info ) !== 200 ) { |
|
| 44 | + if (is_wp_error($account_info) |
|
| 45 | + || wp_remote_retrieve_response_code($account_info) !== 200) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $account_info_json = $account_info['body']; |
| 50 | 50 | |
| 51 | - $account_info_data = json_decode( $account_info_json, true ); |
|
| 51 | + $account_info_data = json_decode($account_info_json, true); |
|
| 52 | 52 | |
| 53 | - if ( ! $account_info_data ) { |
|
| 53 | + if ( ! $account_info_data) { |
|
| 54 | 54 | // Invalid json returned by api. |
| 55 | 55 | return false; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) ); |
|
| 58 | + $site_url = apply_filters('wl_production_site_url', untrailingslashit(get_option('home'))); |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - if ( $account_info_data['url'] === null ) { |
|
| 61 | + if ($account_info_data['url'] === null) { |
|
| 62 | 62 | return true; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Check if the key belongs to same site. |
| 66 | - if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) { |
|
| 66 | + if ($site_url !== untrailingslashit($account_info_data['url'])) { |
|
| 67 | 67 | // key already associated with another account. |
| 68 | 68 | return false; |
| 69 | 69 | } |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | 'license' |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - header( 'Access-Control-Allow-Origin: *' ); |
|
| 90 | + header('Access-Control-Allow-Origin: *'); |
|
| 91 | 91 | |
| 92 | 92 | // validate all the fields before processing |
| 93 | - foreach ( $required_fields as $field ) { |
|
| 94 | - if ( ! array_key_exists( $field, $_POST ) ) { |
|
| 95 | - wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 ); |
|
| 93 | + foreach ($required_fields as $field) { |
|
| 94 | + if ( ! array_key_exists($field, $_POST)) { |
|
| 95 | + wp_send_json_error(sprintf(__('Field %s is required', 'wordlift'), $field), 422); |
|
| 96 | 96 | |
| 97 | 97 | return; |
| 98 | 98 | } |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $key = (string) $_POST['license']; |
| 102 | 102 | |
| 103 | - if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) { |
|
| 104 | - wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 ); |
|
| 103 | + if ( ! $this->is_key_valid_and_not_bound_to_any_domain($key)) { |
|
| 104 | + wp_send_json_error(__('Key is not valid or associated with other domain', 'wordlift'), 403); |
|
| 105 | 105 | |
| 106 | 106 | // exit if not valid. |
| 107 | 107 | return; |
@@ -109,17 +109,17 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | // check if key is already configured, if yes then dont save settings. |
| 112 | - if ( \Wordlift_Configuration_Service::get_instance()->get_key() ) { |
|
| 113 | - wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 ); |
|
| 112 | + if (\Wordlift_Configuration_Service::get_instance()->get_key()) { |
|
| 113 | + wp_send_json_error(__('Key already configured.', 'wordlift'), 403); |
|
| 114 | 114 | |
| 115 | 115 | // key already configured |
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $this->admin_setup->save_configuration( $this->get_params() ); |
|
| 119 | + $this->admin_setup->save_configuration($this->get_params()); |
|
| 120 | 120 | |
| 121 | 121 | |
| 122 | - wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) ); |
|
| 122 | + wp_send_json_success(__('Configuration Saved', 'wordlift')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -131,16 +131,16 @@ discard block |
||
| 131 | 131 | $attachment_id = $this->may_be_get_attachment_id(); |
| 132 | 132 | |
| 133 | 133 | $params = array( |
| 134 | - 'key' => isset( $_POST['license'] ) ? (string) $_POST['license'] : '', |
|
| 135 | - 'vocabulary' => isset( $_POST['vocabulary'] ) ? (string) $_POST['vocabulary'] : '', |
|
| 136 | - 'wl-country-code' => isset( $_POST['country'] ) ? (string) $_POST['country'] : '', |
|
| 137 | - 'name' => isset( $_POST['publisherName'] ) ? (string) $_POST['publisherName'] : '', |
|
| 138 | - 'user_type' => isset( $_POST['publisher'] ) ? (string) $_POST['publisher'] : '', |
|
| 134 | + 'key' => isset($_POST['license']) ? (string) $_POST['license'] : '', |
|
| 135 | + 'vocabulary' => isset($_POST['vocabulary']) ? (string) $_POST['vocabulary'] : '', |
|
| 136 | + 'wl-country-code' => isset($_POST['country']) ? (string) $_POST['country'] : '', |
|
| 137 | + 'name' => isset($_POST['publisherName']) ? (string) $_POST['publisherName'] : '', |
|
| 138 | + 'user_type' => isset($_POST['publisher']) ? (string) $_POST['publisher'] : '', |
|
| 139 | 139 | 'logo' => $attachment_id |
| 140 | 140 | ); |
| 141 | 141 | |
| 142 | - $diagnostic = isset( $_POST['diagnostic'] ) ? (bool) $_POST['diagnostic'] : false; |
|
| 143 | - if ( $diagnostic ) { |
|
| 142 | + $diagnostic = isset($_POST['diagnostic']) ? (bool) $_POST['diagnostic'] : false; |
|
| 143 | + if ($diagnostic) { |
|
| 144 | 144 | $params['share-diagnostic'] = 'on'; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -153,35 +153,35 @@ discard block |
||
| 153 | 153 | private function may_be_get_attachment_id() { |
| 154 | 154 | |
| 155 | 155 | // if image or image extension not posted then return false. |
| 156 | - if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) { |
|
| 156 | + if ( ! isset($_POST['image']) || ! isset($_POST['imageExtension'])) { |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $allowed_extensions = array( 'png', 'jpeg', 'jpg' ); |
|
| 160 | + $allowed_extensions = array('png', 'jpeg', 'jpg'); |
|
| 161 | 161 | $image_string = (string) $_POST['image']; |
| 162 | 162 | $image_ext = (string) $_POST['imageExtension']; |
| 163 | 163 | |
| 164 | - if ( ! in_array( $image_ext, $allowed_extensions ) ) { |
|
| 164 | + if ( ! in_array($image_ext, $allowed_extensions)) { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $image_decoded_string = base64_decode( $image_string ); |
|
| 168 | + $image_decoded_string = base64_decode($image_string); |
|
| 169 | 169 | |
| 170 | 170 | $upload_dir = wp_upload_dir(); |
| 171 | 171 | |
| 172 | - $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext; |
|
| 172 | + $file_path = $upload_dir['path'].DIRECTORY_SEPARATOR.md5($image_string).".".$image_ext; |
|
| 173 | 173 | |
| 174 | - file_put_contents( $file_path, $image_decoded_string ); |
|
| 174 | + file_put_contents($file_path, $image_decoded_string); |
|
| 175 | 175 | |
| 176 | - $attachment_id = wp_insert_attachment( array( |
|
| 176 | + $attachment_id = wp_insert_attachment(array( |
|
| 177 | 177 | 'post_status' => 'inherit', |
| 178 | 178 | 'post_mime_type' => "image/$image_ext" |
| 179 | - ), $file_path ); |
|
| 179 | + ), $file_path); |
|
| 180 | 180 | |
| 181 | 181 | // Generate the metadata for the attachment, and update the database record. |
| 182 | - $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path ); |
|
| 182 | + $attachment_data = wp_generate_attachment_metadata($attachment_id, $file_path); |
|
| 183 | 183 | // Update the attachment metadata. |
| 184 | - wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 184 | + wp_update_attachment_metadata($attachment_id, $attachment_data); |
|
| 185 | 185 | |
| 186 | 186 | return $attachment_id; |
| 187 | 187 | } |
@@ -10,102 +10,102 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Recipe_Maker_Warning { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @var Recipe_Maker_Validation_Service |
|
| 15 | - */ |
|
| 16 | - private $recipe_maker_validation_service; |
|
| 17 | - |
|
| 18 | - public function __construct( $recipe_maker_validation_service ) { |
|
| 19 | - $this->recipe_maker_validation_service = $recipe_maker_validation_service; |
|
| 20 | - /** |
|
| 21 | - * Filter: wl_feature__enable__notices. |
|
| 22 | - * |
|
| 23 | - * @param bool whether the notices needs to be enabled or not. |
|
| 24 | - * |
|
| 25 | - * @return bool |
|
| 26 | - * @since 3.27.6 |
|
| 27 | - */ |
|
| 28 | - if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
| 29 | - add_action( 'admin_notices', array( $this, 'display_image_size_warning' ) ); |
|
| 30 | - } |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Show the warning after applying the conditions. |
|
| 35 | - */ |
|
| 36 | - public function display_image_size_warning() { |
|
| 37 | - |
|
| 38 | - // Check if we are on the post. |
|
| 39 | - if ( ! get_post() instanceof \WP_Post ) { |
|
| 40 | - return false; |
|
| 41 | - } |
|
| 42 | - if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) { |
|
| 43 | - return false; |
|
| 44 | - } |
|
| 45 | - $post_id = get_the_ID(); |
|
| 46 | - |
|
| 47 | - // Dont show notification if there is no recipes referred by the post. |
|
| 48 | - if ( ! $this->recipe_maker_validation_service->is_atleast_once_recipe_present_in_the_post( $post_id ) ) { |
|
| 49 | - return false; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - $recipe_with_image_warnings = $this->get_warnings( $post_id ); |
|
| 53 | - |
|
| 54 | - if ( count( $recipe_with_image_warnings ) > 0 ) { |
|
| 55 | - // Show notification. |
|
| 56 | - ?> |
|
| 13 | + /** |
|
| 14 | + * @var Recipe_Maker_Validation_Service |
|
| 15 | + */ |
|
| 16 | + private $recipe_maker_validation_service; |
|
| 17 | + |
|
| 18 | + public function __construct( $recipe_maker_validation_service ) { |
|
| 19 | + $this->recipe_maker_validation_service = $recipe_maker_validation_service; |
|
| 20 | + /** |
|
| 21 | + * Filter: wl_feature__enable__notices. |
|
| 22 | + * |
|
| 23 | + * @param bool whether the notices needs to be enabled or not. |
|
| 24 | + * |
|
| 25 | + * @return bool |
|
| 26 | + * @since 3.27.6 |
|
| 27 | + */ |
|
| 28 | + if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
| 29 | + add_action( 'admin_notices', array( $this, 'display_image_size_warning' ) ); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Show the warning after applying the conditions. |
|
| 35 | + */ |
|
| 36 | + public function display_image_size_warning() { |
|
| 37 | + |
|
| 38 | + // Check if we are on the post. |
|
| 39 | + if ( ! get_post() instanceof \WP_Post ) { |
|
| 40 | + return false; |
|
| 41 | + } |
|
| 42 | + if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) { |
|
| 43 | + return false; |
|
| 44 | + } |
|
| 45 | + $post_id = get_the_ID(); |
|
| 46 | + |
|
| 47 | + // Dont show notification if there is no recipes referred by the post. |
|
| 48 | + if ( ! $this->recipe_maker_validation_service->is_atleast_once_recipe_present_in_the_post( $post_id ) ) { |
|
| 49 | + return false; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + $recipe_with_image_warnings = $this->get_warnings( $post_id ); |
|
| 53 | + |
|
| 54 | + if ( count( $recipe_with_image_warnings ) > 0 ) { |
|
| 55 | + // Show notification. |
|
| 56 | + ?> |
|
| 57 | 57 | <div class="notice notice-warning is-dismissible"> |
| 58 | 58 | <p><?php echo __( 'The following recipes didnt have minimum image size of 1200 x 1200 px', 'wordlift' ); ?></p> |
| 59 | 59 | <ol> |
| 60 | 60 | <?php |
| 61 | - foreach ( $recipe_with_image_warnings as $post_id ) { |
|
| 62 | - echo "<li>" . get_the_title( $post_id ) . "</li>"; |
|
| 63 | - } |
|
| 64 | - ?> |
|
| 61 | + foreach ( $recipe_with_image_warnings as $post_id ) { |
|
| 62 | + echo "<li>" . get_the_title( $post_id ) . "</li>"; |
|
| 63 | + } |
|
| 64 | + ?> |
|
| 65 | 65 | </ol> |
| 66 | 66 | </div> |
| 67 | 67 | <?php |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @param $post_id |
|
| 74 | - * |
|
| 75 | - * @return array |
|
| 76 | - */ |
|
| 77 | - private function get_warnings( $post_id ) { |
|
| 72 | + /** |
|
| 73 | + * @param $post_id |
|
| 74 | + * |
|
| 75 | + * @return array |
|
| 76 | + */ |
|
| 77 | + private function get_warnings( $post_id ) { |
|
| 78 | 78 | |
| 79 | - $recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post( $post_id ); |
|
| 79 | + $recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post( $post_id ); |
|
| 80 | 80 | |
| 81 | - // Dont show duplicate warnings. |
|
| 82 | - $recipe_ids = array_unique( $recipe_ids ); |
|
| 81 | + // Dont show duplicate warnings. |
|
| 82 | + $recipe_ids = array_unique( $recipe_ids ); |
|
| 83 | 83 | |
| 84 | - $recipe_with_image_warnings = array(); |
|
| 84 | + $recipe_with_image_warnings = array(); |
|
| 85 | 85 | |
| 86 | - foreach ( $recipe_ids as $recipe_id ) { |
|
| 87 | - $recipe = \WPRM_Recipe_Manager::get_recipe( $recipe_id ); |
|
| 86 | + foreach ( $recipe_ids as $recipe_id ) { |
|
| 87 | + $recipe = \WPRM_Recipe_Manager::get_recipe( $recipe_id ); |
|
| 88 | 88 | if ( ! $recipe ) { |
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | - $image_id = $recipe->image_id(); |
|
| 92 | - $image_data = wp_get_attachment_image_src( $image_id, array( 1200, 1200 ) ); |
|
| 93 | - if ( ! is_array( $image_data ) ) { |
|
| 94 | - continue; |
|
| 95 | - } |
|
| 96 | - $image_width = array_key_exists( 1, $image_data ) ? $image_data [1] : false; |
|
| 97 | - $image_height = array_key_exists( 2, $image_data ) ? $image_data [2] : false; |
|
| 98 | - if ( ! ( $image_height && $image_width ) ) { |
|
| 99 | - continue; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ( $image_height < 1200 || $image_width < 1200 ) { |
|
| 103 | - // Image size not present in 1200 * 1200, show a warning. |
|
| 104 | - $recipe_with_image_warnings[] = $recipe_id; |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - return $recipe_with_image_warnings; |
|
| 109 | - } |
|
| 91 | + $image_id = $recipe->image_id(); |
|
| 92 | + $image_data = wp_get_attachment_image_src( $image_id, array( 1200, 1200 ) ); |
|
| 93 | + if ( ! is_array( $image_data ) ) { |
|
| 94 | + continue; |
|
| 95 | + } |
|
| 96 | + $image_width = array_key_exists( 1, $image_data ) ? $image_data [1] : false; |
|
| 97 | + $image_height = array_key_exists( 2, $image_data ) ? $image_data [2] : false; |
|
| 98 | + if ( ! ( $image_height && $image_width ) ) { |
|
| 99 | + continue; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ( $image_height < 1200 || $image_width < 1200 ) { |
|
| 103 | + // Image size not present in 1200 * 1200, show a warning. |
|
| 104 | + $recipe_with_image_warnings[] = $recipe_id; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + return $recipe_with_image_warnings; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | private $recipe_maker_validation_service; |
| 17 | 17 | |
| 18 | - public function __construct( $recipe_maker_validation_service ) { |
|
| 18 | + public function __construct($recipe_maker_validation_service) { |
|
| 19 | 19 | $this->recipe_maker_validation_service = $recipe_maker_validation_service; |
| 20 | 20 | /** |
| 21 | 21 | * Filter: wl_feature__enable__notices. |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * @return bool |
| 26 | 26 | * @since 3.27.6 |
| 27 | 27 | */ |
| 28 | - if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
| 29 | - add_action( 'admin_notices', array( $this, 'display_image_size_warning' ) ); |
|
| 28 | + if (apply_filters('wl_feature__enable__notices', true)) { |
|
| 29 | + add_action('admin_notices', array($this, 'display_image_size_warning')); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -36,30 +36,30 @@ discard block |
||
| 36 | 36 | public function display_image_size_warning() { |
| 37 | 37 | |
| 38 | 38 | // Check if we are on the post. |
| 39 | - if ( ! get_post() instanceof \WP_Post ) { |
|
| 39 | + if ( ! get_post() instanceof \WP_Post) { |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | - if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available() ) { |
|
| 42 | + if ( ! $this->recipe_maker_validation_service->is_wp_recipe_maker_available()) { |
|
| 43 | 43 | return false; |
| 44 | 44 | } |
| 45 | 45 | $post_id = get_the_ID(); |
| 46 | 46 | |
| 47 | 47 | // Dont show notification if there is no recipes referred by the post. |
| 48 | - if ( ! $this->recipe_maker_validation_service->is_atleast_once_recipe_present_in_the_post( $post_id ) ) { |
|
| 48 | + if ( ! $this->recipe_maker_validation_service->is_atleast_once_recipe_present_in_the_post($post_id)) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $recipe_with_image_warnings = $this->get_warnings( $post_id ); |
|
| 52 | + $recipe_with_image_warnings = $this->get_warnings($post_id); |
|
| 53 | 53 | |
| 54 | - if ( count( $recipe_with_image_warnings ) > 0 ) { |
|
| 54 | + if (count($recipe_with_image_warnings) > 0) { |
|
| 55 | 55 | // Show notification. |
| 56 | 56 | ?> |
| 57 | 57 | <div class="notice notice-warning is-dismissible"> |
| 58 | - <p><?php echo __( 'The following recipes didnt have minimum image size of 1200 x 1200 px', 'wordlift' ); ?></p> |
|
| 58 | + <p><?php echo __('The following recipes didnt have minimum image size of 1200 x 1200 px', 'wordlift'); ?></p> |
|
| 59 | 59 | <ol> |
| 60 | 60 | <?php |
| 61 | - foreach ( $recipe_with_image_warnings as $post_id ) { |
|
| 62 | - echo "<li>" . get_the_title( $post_id ) . "</li>"; |
|
| 61 | + foreach ($recipe_with_image_warnings as $post_id) { |
|
| 62 | + echo "<li>".get_the_title($post_id)."</li>"; |
|
| 63 | 63 | } |
| 64 | 64 | ?> |
| 65 | 65 | </ol> |
@@ -74,32 +74,32 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return array |
| 76 | 76 | */ |
| 77 | - private function get_warnings( $post_id ) { |
|
| 77 | + private function get_warnings($post_id) { |
|
| 78 | 78 | |
| 79 | - $recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post( $post_id ); |
|
| 79 | + $recipe_ids = \WPRM_Recipe_Manager::get_recipe_ids_from_post($post_id); |
|
| 80 | 80 | |
| 81 | 81 | // Dont show duplicate warnings. |
| 82 | - $recipe_ids = array_unique( $recipe_ids ); |
|
| 82 | + $recipe_ids = array_unique($recipe_ids); |
|
| 83 | 83 | |
| 84 | 84 | $recipe_with_image_warnings = array(); |
| 85 | 85 | |
| 86 | - foreach ( $recipe_ids as $recipe_id ) { |
|
| 87 | - $recipe = \WPRM_Recipe_Manager::get_recipe( $recipe_id ); |
|
| 88 | - if ( ! $recipe ) { |
|
| 86 | + foreach ($recipe_ids as $recipe_id) { |
|
| 87 | + $recipe = \WPRM_Recipe_Manager::get_recipe($recipe_id); |
|
| 88 | + if ( ! $recipe) { |
|
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | 91 | $image_id = $recipe->image_id(); |
| 92 | - $image_data = wp_get_attachment_image_src( $image_id, array( 1200, 1200 ) ); |
|
| 93 | - if ( ! is_array( $image_data ) ) { |
|
| 92 | + $image_data = wp_get_attachment_image_src($image_id, array(1200, 1200)); |
|
| 93 | + if ( ! is_array($image_data)) { |
|
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | - $image_width = array_key_exists( 1, $image_data ) ? $image_data [1] : false; |
|
| 97 | - $image_height = array_key_exists( 2, $image_data ) ? $image_data [2] : false; |
|
| 98 | - if ( ! ( $image_height && $image_width ) ) { |
|
| 96 | + $image_width = array_key_exists(1, $image_data) ? $image_data [1] : false; |
|
| 97 | + $image_height = array_key_exists(2, $image_data) ? $image_data [2] : false; |
|
| 98 | + if ( ! ($image_height && $image_width)) { |
|
| 99 | 99 | continue; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if ( $image_height < 1200 || $image_width < 1200 ) { |
|
| 102 | + if ($image_height < 1200 || $image_width < 1200) { |
|
| 103 | 103 | // Image size not present in 1200 * 1200, show a warning. |
| 104 | 104 | $recipe_with_image_warnings[] = $recipe_id; |
| 105 | 105 | } |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | white-space: nowrap; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - <?php $blu_dot_url = plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'images/blu-dot.gif'; ?> |
|
| 122 | + <?php $blu_dot_url = plugin_dir_url(dirname(dirname(__FILE__))).'images/blu-dot.gif'; ?> |
|
| 123 | 123 | #wl-dashboard-v2 .wl-dashboard__block--top-entities .wl-dashboard__block__body > div:nth-child(even) { |
| 124 | 124 | flex: calc(100% - 120px); |
| 125 | 125 | background-color: #ebf6ff; |
| 126 | - background-image: url('<?php echo esc_url( $blu_dot_url ); ?>'), url('<?php echo esc_url( $blu_dot_url ); ?>'), url('<?php echo esc_url( $blu_dot_url ); ?>'); |
|
| 126 | + background-image: url('<?php echo esc_url($blu_dot_url); ?>'), url('<?php echo esc_url($blu_dot_url); ?>'), url('<?php echo esc_url($blu_dot_url); ?>'); |
|
| 127 | 127 | background-position: 25% center, 50%, 75%; |
| 128 | 128 | background-size: 1px 4px; |
| 129 | 129 | background-repeat: repeat-y; |
@@ -220,55 +220,55 @@ discard block |
||
| 220 | 220 | $country_code = $configuration_service->get_country_code(); |
| 221 | 221 | |
| 222 | 222 | $top_entities = $this->get_top_entities(); |
| 223 | -if ( ! empty( $top_entities ) ) { |
|
| 223 | +if ( ! empty($top_entities)) { |
|
| 224 | 224 | ?> |
| 225 | 225 | <div class="wl-dashboard__block wl-dashboard__block--top-entities"> |
| 226 | 226 | <header> |
| 227 | 227 | <span class="dashicons dashicons-editor-help"></span> |
| 228 | - <h3><?php echo __( 'Top entities', 'wordlift' ); ?></h3> |
|
| 229 | - <span class="wl-dashboard__legend wl-dashboard__legend--entities"><?php echo esc_html( _x( 'Links with entities', 'Dashboard', 'wordlift' ) ); ?></span> |
|
| 230 | - <span class="wl-dashboard__legend wl-dashboard__legend--posts"><?php echo esc_html( _x( 'Post with entities', 'Dashboard', 'wordlift' ) ); ?></span> |
|
| 228 | + <h3><?php echo __('Top entities', 'wordlift'); ?></h3> |
|
| 229 | + <span class="wl-dashboard__legend wl-dashboard__legend--entities"><?php echo esc_html(_x('Links with entities', 'Dashboard', 'wordlift')); ?></span> |
|
| 230 | + <span class="wl-dashboard__legend wl-dashboard__legend--posts"><?php echo esc_html(_x('Post with entities', 'Dashboard', 'wordlift')); ?></span> |
|
| 231 | 231 | </header> |
| 232 | 232 | <div class="wl-dashboard__block__body"> |
| 233 | 233 | <?php |
| 234 | 234 | $max = $top_entities[0]->total; |
| 235 | - $unit = intval( '1' . str_repeat( '0', strlen( $max ) - 1 ) ); |
|
| 236 | - $max_value = ceil( (float) $max / $unit ) * $unit; |
|
| 235 | + $unit = intval('1'.str_repeat('0', strlen($max) - 1)); |
|
| 236 | + $max_value = ceil((float) $max / $unit) * $unit; |
|
| 237 | 237 | $chunk_value = $max_value / 4; |
| 238 | 238 | ?> |
| 239 | 239 | <div></div> |
| 240 | 240 | <div class="wl-dashboard__block__body__table-header"> |
| 241 | - <?php for ( $i = 0; $i <= $max_value; $i += $chunk_value ) { ?> |
|
| 242 | - <span><?php echo esc_html( $i ); ?></span><?php } ?> |
|
| 241 | + <?php for ($i = 0; $i <= $max_value; $i += $chunk_value) { ?> |
|
| 242 | + <span><?php echo esc_html($i); ?></span><?php } ?> |
|
| 243 | 243 | </div> |
| 244 | 244 | <?php |
| 245 | 245 | $i = 0; |
| 246 | - foreach ( $this->get_top_entities() as $post ) { |
|
| 247 | - $permalink = get_permalink( $post->ID ); |
|
| 246 | + foreach ($this->get_top_entities() as $post) { |
|
| 247 | + $permalink = get_permalink($post->ID); |
|
| 248 | 248 | $title = $post->post_title; |
| 249 | 249 | $entities_100 = 100 * $post->entities / $max_value; |
| 250 | 250 | $posts_100 = 100 * $post->posts / $max_value; |
| 251 | 251 | |
| 252 | 252 | ?> |
| 253 | - <div><a href="<?php echo esc_attr( $permalink ); ?>"><?php echo esc_html( $title ); ?></a></div> |
|
| 253 | + <div><a href="<?php echo esc_attr($permalink); ?>"><?php echo esc_html($title); ?></a></div> |
|
| 254 | 254 | <div> |
| 255 | 255 | <div class="wl-dashboard__bar wl-dashboard__bar--posts" |
| 256 | - style="width: <?php echo esc_attr( $posts_100 ); ?>%;"> |
|
| 256 | + style="width: <?php echo esc_attr($posts_100); ?>%;"> |
|
| 257 | 257 | </div> |
| 258 | 258 | <div class="wl-dashboard__bar wl-dashboard__bar--entities" |
| 259 | - style="width: <?php echo esc_attr( $entities_100 ); ?>%;"> |
|
| 259 | + style="width: <?php echo esc_attr($entities_100); ?>%;"> |
|
| 260 | 260 | </div> |
| 261 | 261 | </div> |
| 262 | 262 | <?php |
| 263 | - if ( 4 === $i ++ ) { |
|
| 263 | + if (4 === $i++) { |
|
| 264 | 264 | ?> |
| 265 | 265 | <input id="wl-dashboard__show-more" type="checkbox"> |
| 266 | 266 | <label for="wl-dashboard__show-more"> |
| 267 | 267 | <span> |
| 268 | - <?php echo esc_html( __( 'Show more', 'wordlift' ) ); ?> |
|
| 268 | + <?php echo esc_html(__('Show more', 'wordlift')); ?> |
|
| 269 | 269 | </span> |
| 270 | 270 | <span> |
| 271 | - <?php echo esc_html( __( 'Hide', 'wordlift' ) ); ?> |
|
| 271 | + <?php echo esc_html(__('Hide', 'wordlift')); ?> |
|
| 272 | 272 | </span> |
| 273 | 273 | </label> |
| 274 | 274 | <?php |
@@ -280,41 +280,41 @@ discard block |
||
| 280 | 280 | <?php |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | -$not_enriched_url = admin_url( 'edit.php?post_type=post&wl_enriched=no' ); |
|
| 283 | +$not_enriched_url = admin_url('edit.php?post_type=post&wl_enriched=no'); |
|
| 284 | 284 | $dashboard_service = Wordlift_Dashboard_Service::get_instance(); |
| 285 | 285 | ?> |
| 286 | 286 | <div class="wl-dashboard__block wl-dashboard__block--enriched-posts"> |
| 287 | 287 | <header> |
| 288 | 288 | <span class="dashicons dashicons-editor-help"></span> |
| 289 | - <h3><?php echo esc_html__( 'Enriched posts', 'wordlift' ); ?></h3> |
|
| 289 | + <h3><?php echo esc_html__('Enriched posts', 'wordlift'); ?></h3> |
|
| 290 | 290 | </header> |
| 291 | 291 | <div class="wl-dashboard__block__body"> |
| 292 | - <a href="<?php echo esc_url( $not_enriched_url ); ?>"><?php echo esc_html( $dashboard_service->count_annotated_posts() ); ?></a> |
|
| 293 | - / <?php echo esc_html( $dashboard_service->count_posts() ); ?> |
|
| 294 | - <a href="<?php echo esc_url( $not_enriched_url ); ?>"><?php echo esc_html( _x( 'Enrich', 'Dashboard', 'wordlift' ) ); ?></a> |
|
| 292 | + <a href="<?php echo esc_url($not_enriched_url); ?>"><?php echo esc_html($dashboard_service->count_annotated_posts()); ?></a> |
|
| 293 | + / <?php echo esc_html($dashboard_service->count_posts()); ?> |
|
| 294 | + <a href="<?php echo esc_url($not_enriched_url); ?>"><?php echo esc_html(_x('Enrich', 'Dashboard', 'wordlift')); ?></a> |
|
| 295 | 295 | </div> |
| 296 | 296 | </div> |
| 297 | 297 | |
| 298 | -<?php $vocabulary_url = admin_url( 'edit.php?post_type=entity' ); ?> |
|
| 298 | +<?php $vocabulary_url = admin_url('edit.php?post_type=entity'); ?> |
|
| 299 | 299 | <div class="wl-dashboard__block wl-dashboard__block--created-entities"> |
| 300 | 300 | <header> |
| 301 | 301 | <span class="dashicons dashicons-editor-help"></span> |
| 302 | - <h3><?php esc_html_e( 'Created entities', 'wordlift' ); ?></h3> |
|
| 302 | + <h3><?php esc_html_e('Created entities', 'wordlift'); ?></h3> |
|
| 303 | 303 | </header> |
| 304 | 304 | <div class="wl-dashboard__block__body"> |
| 305 | - <a href="<?php echo esc_url( $vocabulary_url ); ?>"><?php echo esc_html( $this->entity_service->count() ); ?></a> |
|
| 306 | - <a href="<?php echo esc_url( $vocabulary_url ); ?>"><?php echo esc_html( _x( 'Vocabulary', 'Dashboard', 'wordlift' ) ); ?></a> |
|
| 305 | + <a href="<?php echo esc_url($vocabulary_url); ?>"><?php echo esc_html($this->entity_service->count()); ?></a> |
|
| 306 | + <a href="<?php echo esc_url($vocabulary_url); ?>"><?php echo esc_html(_x('Vocabulary', 'Dashboard', 'wordlift')); ?></a> |
|
| 307 | 307 | </div> |
| 308 | 308 | </div> |
| 309 | 309 | |
| 310 | 310 | <div class="wl-dashboard__block wl-dashboard__block--average-entity-rating"> |
| 311 | 311 | <header> |
| 312 | 312 | <span class="dashicons dashicons-editor-help"></span> |
| 313 | - <h3><?php echo esc_html__( 'Average entity rating', 'wordlift' ); ?></h3> |
|
| 313 | + <h3><?php echo esc_html__('Average entity rating', 'wordlift'); ?></h3> |
|
| 314 | 314 | </header> |
| 315 | 315 | <div class="wl-dashboard__block__body"> |
| 316 | - <?php echo esc_html( $dashboard_service->average_entities_rating() ); ?> |
|
| 317 | - <?php echo esc_html( _x( 'Boost', 'Dashboard', 'wordlift' ) ); ?> |
|
| 316 | + <?php echo esc_html($dashboard_service->average_entities_rating()); ?> |
|
| 317 | + <?php echo esc_html(_x('Boost', 'Dashboard', 'wordlift')); ?> |
|
| 318 | 318 | </div> |
| 319 | 319 | </div> |
| 320 | 320 | <?php |
@@ -325,4 +325,4 @@ discard block |
||
| 325 | 325 | * @author Naveen Muthusamy <[email protected]> |
| 326 | 326 | * Action name : wl_admin_dashboard_widgets |
| 327 | 327 | */ |
| 328 | -do_action( 'wl_admin_dashboard_widgets' ); |
|
| 328 | +do_action('wl_admin_dashboard_widgets'); |
|
@@ -17,49 +17,49 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Wordlift_Install_All_Entity_Types extends Wordlift_Install { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * The option name for the version of the Schema.org taxonomy. |
|
| 22 | - * |
|
| 23 | - * @since 3.20.0 |
|
| 24 | - */ |
|
| 25 | - const OPTION_NAME = 'wl_schemaorg_version'; |
|
| 20 | + /** |
|
| 21 | + * The option name for the version of the Schema.org taxonomy. |
|
| 22 | + * |
|
| 23 | + * @since 3.20.0 |
|
| 24 | + */ |
|
| 25 | + const OPTION_NAME = 'wl_schemaorg_version'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * {@inheritdoc} |
|
| 29 | - */ |
|
| 30 | - protected static $version = '3.20.0'; |
|
| 27 | + /** |
|
| 28 | + * {@inheritdoc} |
|
| 29 | + */ |
|
| 30 | + protected static $version = '3.20.0'; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Perform the installation. |
|
| 34 | - * |
|
| 35 | - * @since 3.20.0 |
|
| 36 | - */ |
|
| 37 | - public function install() { |
|
| 32 | + /** |
|
| 33 | + * Perform the installation. |
|
| 34 | + * |
|
| 35 | + * @since 3.20.0 |
|
| 36 | + */ |
|
| 37 | + public function install() { |
|
| 38 | 38 | |
| 39 | - $this->log->info( 'Installing `All Entity Types` configuration...' ); |
|
| 39 | + $this->log->info( 'Installing `All Entity Types` configuration...' ); |
|
| 40 | 40 | |
| 41 | - // Get the Schema.org sync service instance. |
|
| 42 | - $schema_sync_service = Wordlift_Schemaorg_Sync_Service::get_instance(); |
|
| 41 | + // Get the Schema.org sync service instance. |
|
| 42 | + $schema_sync_service = Wordlift_Schemaorg_Sync_Service::get_instance(); |
|
| 43 | 43 | |
| 44 | - // Try to load the Schema.org taxonomy and, if successful, update the local Schema.org version. |
|
| 45 | - if ( $schema_sync_service->load_from_file() ) { |
|
| 46 | - $this->log->debug( 'Updating `All Entity Types` configuration to 1.0.0.' ); |
|
| 44 | + // Try to load the Schema.org taxonomy and, if successful, update the local Schema.org version. |
|
| 45 | + if ( $schema_sync_service->load_from_file() ) { |
|
| 46 | + $this->log->debug( 'Updating `All Entity Types` configuration to 1.0.0.' ); |
|
| 47 | 47 | |
| 48 | - update_option( self::OPTION_NAME, '1.0.0', true ); |
|
| 49 | - } |
|
| 48 | + update_option( self::OPTION_NAME, '1.0.0', true ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Whether the installation procedure must run. |
|
| 55 | - * |
|
| 56 | - * @since 3.20.0 |
|
| 57 | - * |
|
| 58 | - * @return bool True if the installation procedure must run otherwise false. |
|
| 59 | - */ |
|
| 60 | - public function must_install() { |
|
| 53 | + /** |
|
| 54 | + * Whether the installation procedure must run. |
|
| 55 | + * |
|
| 56 | + * @since 3.20.0 |
|
| 57 | + * |
|
| 58 | + * @return bool True if the installation procedure must run otherwise false. |
|
| 59 | + */ |
|
| 60 | + public function must_install() { |
|
| 61 | 61 | |
| 62 | - return apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) && version_compare( '1.0.0', get_option( self::OPTION_NAME, '0.0.0' ), '>' ); |
|
| 63 | - } |
|
| 62 | + return apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) && version_compare( '1.0.0', get_option( self::OPTION_NAME, '0.0.0' ), '>' ); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | } |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function install() { |
| 38 | 38 | |
| 39 | - $this->log->info( 'Installing `All Entity Types` configuration...' ); |
|
| 39 | + $this->log->info('Installing `All Entity Types` configuration...'); |
|
| 40 | 40 | |
| 41 | 41 | // Get the Schema.org sync service instance. |
| 42 | 42 | $schema_sync_service = Wordlift_Schemaorg_Sync_Service::get_instance(); |
| 43 | 43 | |
| 44 | 44 | // Try to load the Schema.org taxonomy and, if successful, update the local Schema.org version. |
| 45 | - if ( $schema_sync_service->load_from_file() ) { |
|
| 46 | - $this->log->debug( 'Updating `All Entity Types` configuration to 1.0.0.' ); |
|
| 45 | + if ($schema_sync_service->load_from_file()) { |
|
| 46 | + $this->log->debug('Updating `All Entity Types` configuration to 1.0.0.'); |
|
| 47 | 47 | |
| 48 | - update_option( self::OPTION_NAME, '1.0.0', true ); |
|
| 48 | + update_option(self::OPTION_NAME, '1.0.0', true); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function must_install() { |
| 61 | 61 | |
| 62 | - return apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) && version_compare( '1.0.0', get_option( self::OPTION_NAME, '0.0.0' ), '>' ); |
|
| 62 | + return apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES) && version_compare('1.0.0', get_option(self::OPTION_NAME, '0.0.0'), '>'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | } |
@@ -30,390 +30,390 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | class Wordlift_Admin { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * The singleton instance. |
|
| 35 | - * |
|
| 36 | - * @since 3.19.4 |
|
| 37 | - * @access private |
|
| 38 | - * @var Wordlift_Admin $instance The singleton instance. |
|
| 39 | - */ |
|
| 40 | - private static $instance; |
|
| 41 | - /** |
|
| 42 | - * The ID of this plugin. |
|
| 43 | - * |
|
| 44 | - * @since 1.0.0 |
|
| 45 | - * @access private |
|
| 46 | - * @var string $plugin_name The ID of this plugin. |
|
| 47 | - */ |
|
| 48 | - private $plugin_name; |
|
| 49 | - /** |
|
| 50 | - * The version of this plugin. |
|
| 51 | - * |
|
| 52 | - * @since 1.0.0 |
|
| 53 | - * @access private |
|
| 54 | - * @var string $version The current version of this plugin. |
|
| 55 | - */ |
|
| 56 | - private $version; |
|
| 57 | - /** |
|
| 58 | - * The {@link Wordlift_User_Service} instance. |
|
| 59 | - * |
|
| 60 | - * @since 3.14.0 |
|
| 61 | - * @access private |
|
| 62 | - * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 63 | - */ |
|
| 64 | - private $user_service; |
|
| 65 | - /** |
|
| 66 | - * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 67 | - * |
|
| 68 | - * @since 3.20.0 |
|
| 69 | - * @access private |
|
| 70 | - * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 71 | - */ |
|
| 72 | - private $sync_batch_operation_ajax_adapter; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Initialize the class and set its properties. |
|
| 76 | - * |
|
| 77 | - * @param string $plugin_name The name of this plugin. |
|
| 78 | - * @param string $version The version of this plugin. |
|
| 79 | - * @param Wordlift_Notice_Service $notice_service The notice service. |
|
| 80 | - * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 81 | - * |
|
| 82 | - * @since 1.0.0 |
|
| 83 | - * |
|
| 84 | - */ |
|
| 85 | - public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
| 86 | - |
|
| 87 | - $this->plugin_name = $plugin_name; |
|
| 88 | - $this->version = $version; |
|
| 89 | - |
|
| 90 | - $this->user_service = $user_service; |
|
| 91 | - |
|
| 92 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 93 | - $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 94 | - $key = $configuration_service->get_key(); |
|
| 95 | - $features_registry = Features_Registry::get_instance(); |
|
| 96 | - if ( empty( $dataset_uri ) ) { |
|
| 97 | - $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 98 | - if ( empty( $key ) ) { |
|
| 99 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 100 | - } else { |
|
| 101 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 102 | - } |
|
| 103 | - $notice_service->add_error( $error ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // Load additional code if we're in the admin UI. |
|
| 107 | - if ( is_admin() ) { |
|
| 108 | - |
|
| 109 | - // Require the PHP files for the next code fragment. |
|
| 110 | - self::require_files(); |
|
| 111 | - |
|
| 112 | - /* |
|
| 33 | + /** |
|
| 34 | + * The singleton instance. |
|
| 35 | + * |
|
| 36 | + * @since 3.19.4 |
|
| 37 | + * @access private |
|
| 38 | + * @var Wordlift_Admin $instance The singleton instance. |
|
| 39 | + */ |
|
| 40 | + private static $instance; |
|
| 41 | + /** |
|
| 42 | + * The ID of this plugin. |
|
| 43 | + * |
|
| 44 | + * @since 1.0.0 |
|
| 45 | + * @access private |
|
| 46 | + * @var string $plugin_name The ID of this plugin. |
|
| 47 | + */ |
|
| 48 | + private $plugin_name; |
|
| 49 | + /** |
|
| 50 | + * The version of this plugin. |
|
| 51 | + * |
|
| 52 | + * @since 1.0.0 |
|
| 53 | + * @access private |
|
| 54 | + * @var string $version The current version of this plugin. |
|
| 55 | + */ |
|
| 56 | + private $version; |
|
| 57 | + /** |
|
| 58 | + * The {@link Wordlift_User_Service} instance. |
|
| 59 | + * |
|
| 60 | + * @since 3.14.0 |
|
| 61 | + * @access private |
|
| 62 | + * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 63 | + */ |
|
| 64 | + private $user_service; |
|
| 65 | + /** |
|
| 66 | + * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 67 | + * |
|
| 68 | + * @since 3.20.0 |
|
| 69 | + * @access private |
|
| 70 | + * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
| 71 | + */ |
|
| 72 | + private $sync_batch_operation_ajax_adapter; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Initialize the class and set its properties. |
|
| 76 | + * |
|
| 77 | + * @param string $plugin_name The name of this plugin. |
|
| 78 | + * @param string $version The version of this plugin. |
|
| 79 | + * @param Wordlift_Notice_Service $notice_service The notice service. |
|
| 80 | + * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 81 | + * |
|
| 82 | + * @since 1.0.0 |
|
| 83 | + * |
|
| 84 | + */ |
|
| 85 | + public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
| 86 | + |
|
| 87 | + $this->plugin_name = $plugin_name; |
|
| 88 | + $this->version = $version; |
|
| 89 | + |
|
| 90 | + $this->user_service = $user_service; |
|
| 91 | + |
|
| 92 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 93 | + $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 94 | + $key = $configuration_service->get_key(); |
|
| 95 | + $features_registry = Features_Registry::get_instance(); |
|
| 96 | + if ( empty( $dataset_uri ) ) { |
|
| 97 | + $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 98 | + if ( empty( $key ) ) { |
|
| 99 | + $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 100 | + } else { |
|
| 101 | + $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 102 | + } |
|
| 103 | + $notice_service->add_error( $error ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // Load additional code if we're in the admin UI. |
|
| 107 | + if ( is_admin() ) { |
|
| 108 | + |
|
| 109 | + // Require the PHP files for the next code fragment. |
|
| 110 | + self::require_files(); |
|
| 111 | + |
|
| 112 | + /* |
|
| 113 | 113 | * @since 3.24.2 This function isn't called anymore because it was causing the Block Category to |
| 114 | 114 | * multiply in Block Editor. |
| 115 | 115 | * |
| 116 | 116 | * @see https://github.com/insideout10/wordlift-plugin/issues/1004 |
| 117 | 117 | */ |
| 118 | - // Add Wordlift custom block category. |
|
| 119 | - // self::add_block_category(); |
|
| 118 | + // Add Wordlift custom block category. |
|
| 119 | + // self::add_block_category(); |
|
| 120 | 120 | |
| 121 | - new Wordlift_Dashboard_Latest_News(); |
|
| 121 | + new Wordlift_Dashboard_Latest_News(); |
|
| 122 | 122 | |
| 123 | - /* |
|
| 123 | + /* |
|
| 124 | 124 | * Add support for `All Entity Types`. |
| 125 | 125 | * |
| 126 | 126 | * @since 3.20.0 |
| 127 | 127 | * |
| 128 | 128 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 129 | 129 | */ |
| 130 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 130 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 131 | 131 | |
| 132 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 133 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 132 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 133 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 134 | 134 | |
| 135 | - // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() ); |
|
| 135 | + // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() ); |
|
| 136 | 136 | |
| 137 | - /* |
|
| 137 | + /* |
|
| 138 | 138 | * The `Mappings` admin page. |
| 139 | 139 | */ |
| 140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
| 140 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
| 141 | 141 | |
| 142 | - new Wordlift_Admin_Mappings_Page(); |
|
| 142 | + new Wordlift_Admin_Mappings_Page(); |
|
| 143 | 143 | |
| 144 | - /* |
|
| 144 | + /* |
|
| 145 | 145 | * Allow sync'ing the schema.org taxonomy with the schema.org json file. |
| 146 | 146 | * |
| 147 | 147 | * @since 3.20.0 |
| 148 | 148 | */ |
| 149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 150 | 150 | |
| 151 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
| 151 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
| 152 | 152 | |
| 153 | - } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | |
| 157 | - /* |
|
| 157 | + /* |
|
| 158 | 158 | * Add the {@link Wordlift_Admin_Term_Adapter}. |
| 159 | 159 | * |
| 160 | 160 | * @since 3.20.0 |
| 161 | 161 | */ |
| 162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
| 163 | - new Wordlift_Admin_Term_Adapter(); |
|
| 162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
| 163 | + new Wordlift_Admin_Term_Adapter(); |
|
| 164 | 164 | |
| 165 | - /* |
|
| 165 | + /* |
|
| 166 | 166 | * The new dashboard. |
| 167 | 167 | * |
| 168 | 168 | * @since 3.20.0 |
| 169 | 169 | * |
| 170 | 170 | * @see https://github.com/insideout10/wordlift-plugin/issues/879 |
| 171 | 171 | */ |
| 172 | - new Wordlift_Admin_Dashboard_V2( |
|
| 173 | - Wordlift_Entity_Service::get_instance() |
|
| 174 | - ); |
|
| 175 | - new Wordlift_Admin_Not_Enriched_Filter(); |
|
| 176 | - |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - // @@todo only load this class if ACF is available. |
|
| 180 | - // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available. |
|
| 181 | - new Acf_Mappings(); |
|
| 182 | - |
|
| 183 | - // Add the Mappings' REST Controller. |
|
| 184 | - new Mappings_REST_Controller(); |
|
| 185 | - |
|
| 186 | - |
|
| 187 | - $features_registry->register_feature_from_slug( |
|
| 188 | - 'mappings', |
|
| 189 | - ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
| 190 | - array( $this, 'init_mappings' ) ); |
|
| 191 | - |
|
| 192 | - |
|
| 193 | - // Set the singleton instance. |
|
| 194 | - self::$instance = $this; |
|
| 195 | - |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - /** |
|
| 199 | - * Require files needed for the Admin UI. |
|
| 200 | - * |
|
| 201 | - * @since 3.20.0 |
|
| 202 | - */ |
|
| 203 | - private static function require_files() { |
|
| 204 | - |
|
| 205 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 206 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 207 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 208 | - |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * Get the singleton instance. |
|
| 213 | - * |
|
| 214 | - * @return Wordlift_Admin The singleton instance. |
|
| 215 | - * @since 3.19.4 |
|
| 216 | - * |
|
| 217 | - */ |
|
| 218 | - public static function get_instance() { |
|
| 219 | - |
|
| 220 | - return self::$instance; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - public static function is_gutenberg() { |
|
| 224 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
| 225 | - is_gutenberg_page() |
|
| 226 | - ) { |
|
| 227 | - // The Gutenberg plugin is on. |
|
| 228 | - return true; |
|
| 229 | - } |
|
| 230 | - $current_screen = get_current_screen(); |
|
| 231 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
| 232 | - $current_screen->is_block_editor() |
|
| 233 | - ) { |
|
| 234 | - // Gutenberg page on 5+. |
|
| 235 | - return true; |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - return false; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * Register the stylesheets for the admin area. |
|
| 243 | - * |
|
| 244 | - * @since 1.0.0 |
|
| 245 | - */ |
|
| 246 | - public function enqueue_styles() { |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * This function is provided for demonstration purposes only. |
|
| 250 | - * |
|
| 251 | - * An instance of this class should be passed to the run() function |
|
| 252 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 253 | - * in that particular class. |
|
| 254 | - * |
|
| 255 | - * The Wordlift_Loader will then create the relationship |
|
| 256 | - * between the defined hooks and the functions defined in this |
|
| 257 | - * class. |
|
| 258 | - */ |
|
| 259 | - |
|
| 260 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 261 | - |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Register the JavaScript for the admin area. |
|
| 266 | - * |
|
| 267 | - * @since 1.0.0 |
|
| 268 | - */ |
|
| 269 | - public function enqueue_scripts() { |
|
| 270 | - |
|
| 271 | - /* |
|
| 172 | + new Wordlift_Admin_Dashboard_V2( |
|
| 173 | + Wordlift_Entity_Service::get_instance() |
|
| 174 | + ); |
|
| 175 | + new Wordlift_Admin_Not_Enriched_Filter(); |
|
| 176 | + |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + // @@todo only load this class if ACF is available. |
|
| 180 | + // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available. |
|
| 181 | + new Acf_Mappings(); |
|
| 182 | + |
|
| 183 | + // Add the Mappings' REST Controller. |
|
| 184 | + new Mappings_REST_Controller(); |
|
| 185 | + |
|
| 186 | + |
|
| 187 | + $features_registry->register_feature_from_slug( |
|
| 188 | + 'mappings', |
|
| 189 | + ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
| 190 | + array( $this, 'init_mappings' ) ); |
|
| 191 | + |
|
| 192 | + |
|
| 193 | + // Set the singleton instance. |
|
| 194 | + self::$instance = $this; |
|
| 195 | + |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + /** |
|
| 199 | + * Require files needed for the Admin UI. |
|
| 200 | + * |
|
| 201 | + * @since 3.20.0 |
|
| 202 | + */ |
|
| 203 | + private static function require_files() { |
|
| 204 | + |
|
| 205 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 206 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 207 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 208 | + |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * Get the singleton instance. |
|
| 213 | + * |
|
| 214 | + * @return Wordlift_Admin The singleton instance. |
|
| 215 | + * @since 3.19.4 |
|
| 216 | + * |
|
| 217 | + */ |
|
| 218 | + public static function get_instance() { |
|
| 219 | + |
|
| 220 | + return self::$instance; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + public static function is_gutenberg() { |
|
| 224 | + if ( function_exists( 'is_gutenberg_page' ) && |
|
| 225 | + is_gutenberg_page() |
|
| 226 | + ) { |
|
| 227 | + // The Gutenberg plugin is on. |
|
| 228 | + return true; |
|
| 229 | + } |
|
| 230 | + $current_screen = get_current_screen(); |
|
| 231 | + if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
| 232 | + $current_screen->is_block_editor() |
|
| 233 | + ) { |
|
| 234 | + // Gutenberg page on 5+. |
|
| 235 | + return true; |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + return false; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * Register the stylesheets for the admin area. |
|
| 243 | + * |
|
| 244 | + * @since 1.0.0 |
|
| 245 | + */ |
|
| 246 | + public function enqueue_styles() { |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * This function is provided for demonstration purposes only. |
|
| 250 | + * |
|
| 251 | + * An instance of this class should be passed to the run() function |
|
| 252 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 253 | + * in that particular class. |
|
| 254 | + * |
|
| 255 | + * The Wordlift_Loader will then create the relationship |
|
| 256 | + * between the defined hooks and the functions defined in this |
|
| 257 | + * class. |
|
| 258 | + */ |
|
| 259 | + |
|
| 260 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 261 | + |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Register the JavaScript for the admin area. |
|
| 266 | + * |
|
| 267 | + * @since 1.0.0 |
|
| 268 | + */ |
|
| 269 | + public function enqueue_scripts() { |
|
| 270 | + |
|
| 271 | + /* |
|
| 272 | 272 | * Do not load our scripts on the Filter Urls plugin admin pages. |
| 273 | 273 | * |
| 274 | 274 | * @see https://github.com/insideout10/wordlift-plugin/issues/901 |
| 275 | 275 | * @since 3.20.0 |
| 276 | 276 | */ |
| 277 | - $screen = get_current_screen(); |
|
| 278 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
| 279 | - return; |
|
| 280 | - } |
|
| 277 | + $screen = get_current_screen(); |
|
| 278 | + if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
| 279 | + return; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - // Enqueue the admin scripts. |
|
| 283 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array( |
|
| 284 | - 'jquery', |
|
| 285 | - 'underscore', |
|
| 286 | - 'backbone', |
|
| 287 | - ), $this->version, false ); |
|
| 282 | + // Enqueue the admin scripts. |
|
| 283 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array( |
|
| 284 | + 'jquery', |
|
| 285 | + 'underscore', |
|
| 286 | + 'backbone', |
|
| 287 | + ), $this->version, false ); |
|
| 288 | 288 | |
| 289 | 289 | |
| 290 | - $params = $this->get_params(); |
|
| 290 | + $params = $this->get_params(); |
|
| 291 | 291 | |
| 292 | - // Finally output the params as `wlSettings` for JavaScript code. |
|
| 293 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
| 292 | + // Finally output the params as `wlSettings` for JavaScript code. |
|
| 293 | + wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
| 294 | 294 | |
| 295 | - } |
|
| 295 | + } |
|
| 296 | 296 | |
| 297 | - /** |
|
| 298 | - * Return the settings array by applying filters. |
|
| 299 | - * @return array |
|
| 300 | - */ |
|
| 301 | - public function get_params() { |
|
| 302 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
| 303 | - /* |
|
| 297 | + /** |
|
| 298 | + * Return the settings array by applying filters. |
|
| 299 | + * @return array |
|
| 300 | + */ |
|
| 301 | + public function get_params() { |
|
| 302 | + $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
| 303 | + /* |
|
| 304 | 304 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
| 305 | 305 | * that cannot edit create entities will always see the local entities. |
| 306 | 306 | * |
| 307 | 307 | * @see https://github.com/insideout10/wordlift-plugin/issues/839 |
| 308 | 308 | */ |
| 309 | - $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : "local"; |
|
| 310 | - |
|
| 311 | - // Set the basic params. |
|
| 312 | - $params = array( |
|
| 313 | - // @todo scripts in admin should use wp.post. |
|
| 314 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 315 | - // @todo remove specific actions from settings. |
|
| 316 | - 'action' => 'entity_by_title', |
|
| 317 | - 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
|
| 318 | - 'language' => Wordlift_Configuration_Service::get_instance()->get_language_code(), |
|
| 319 | - 'link_by_default' => Wordlift_Configuration_Service::get_instance()->is_link_by_default(), |
|
| 320 | - // Whether the current user is allowed to create new entities. |
|
| 321 | - // |
|
| 322 | - // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
| 323 | - // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
|
| 324 | - 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
| 325 | - 'l10n' => array( |
|
| 326 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 327 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 328 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 329 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
| 330 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
| 331 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
| 332 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
| 333 | - ), |
|
| 334 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
| 335 | - 'autocomplete_scope' => $autocomplete_scope, |
|
| 336 | - /** |
|
| 337 | - * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
| 338 | - * or change the TinyMCE id. |
|
| 339 | - * |
|
| 340 | - * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
| 341 | - * |
|
| 342 | - * @param string $editor The default editor id, by default `content`. |
|
| 343 | - * |
|
| 344 | - * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
| 345 | - * |
|
| 346 | - * @since 3.19.4 |
|
| 347 | - * |
|
| 348 | - */ |
|
| 349 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
| 350 | - |
|
| 351 | - 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
| 352 | - /** |
|
| 353 | - * Faceted search default limit |
|
| 354 | - * |
|
| 355 | - * @since 3.26.1 |
|
| 356 | - */ |
|
| 357 | - 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
| 358 | - /** |
|
| 359 | - * WL Root path, to access in JS |
|
| 360 | - * |
|
| 361 | - * @since 3.27.3 |
|
| 362 | - */ |
|
| 363 | - 'wl_root' => plugin_dir_url( __DIR__ ), |
|
| 364 | - /** |
|
| 365 | - * Enable synonyms, to access in JS |
|
| 366 | - * Show classification sidebar, to access in JS |
|
| 367 | - * |
|
| 368 | - * @since 3.30.0 |
|
| 369 | - */ |
|
| 370 | - 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
| 371 | - 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
| 372 | - // By default the videoobject should not show. |
|
| 373 | - 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ) |
|
| 374 | - ); |
|
| 375 | - |
|
| 376 | - // Set post-related values if there's a current post. |
|
| 377 | - if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 378 | - |
|
| 379 | - $params['post_id'] = $entity_being_edited->ID; |
|
| 380 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 381 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
| 382 | - // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
| 383 | - // from the results, since we don't want the current entity to be discovered by the analysis. |
|
| 384 | - // |
|
| 385 | - // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
| 386 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
| 387 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
| 388 | - |
|
| 389 | - /* |
|
| 309 | + $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : "local"; |
|
| 310 | + |
|
| 311 | + // Set the basic params. |
|
| 312 | + $params = array( |
|
| 313 | + // @todo scripts in admin should use wp.post. |
|
| 314 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 315 | + // @todo remove specific actions from settings. |
|
| 316 | + 'action' => 'entity_by_title', |
|
| 317 | + 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
|
| 318 | + 'language' => Wordlift_Configuration_Service::get_instance()->get_language_code(), |
|
| 319 | + 'link_by_default' => Wordlift_Configuration_Service::get_instance()->is_link_by_default(), |
|
| 320 | + // Whether the current user is allowed to create new entities. |
|
| 321 | + // |
|
| 322 | + // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
| 323 | + // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
|
| 324 | + 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
| 325 | + 'l10n' => array( |
|
| 326 | + 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 327 | + 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 328 | + 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 329 | + 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
| 330 | + 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
| 331 | + 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
| 332 | + 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
| 333 | + ), |
|
| 334 | + 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
| 335 | + 'autocomplete_scope' => $autocomplete_scope, |
|
| 336 | + /** |
|
| 337 | + * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
| 338 | + * or change the TinyMCE id. |
|
| 339 | + * |
|
| 340 | + * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
| 341 | + * |
|
| 342 | + * @param string $editor The default editor id, by default `content`. |
|
| 343 | + * |
|
| 344 | + * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
| 345 | + * |
|
| 346 | + * @since 3.19.4 |
|
| 347 | + * |
|
| 348 | + */ |
|
| 349 | + 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
| 350 | + |
|
| 351 | + 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
| 352 | + /** |
|
| 353 | + * Faceted search default limit |
|
| 354 | + * |
|
| 355 | + * @since 3.26.1 |
|
| 356 | + */ |
|
| 357 | + 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
| 358 | + /** |
|
| 359 | + * WL Root path, to access in JS |
|
| 360 | + * |
|
| 361 | + * @since 3.27.3 |
|
| 362 | + */ |
|
| 363 | + 'wl_root' => plugin_dir_url( __DIR__ ), |
|
| 364 | + /** |
|
| 365 | + * Enable synonyms, to access in JS |
|
| 366 | + * Show classification sidebar, to access in JS |
|
| 367 | + * |
|
| 368 | + * @since 3.30.0 |
|
| 369 | + */ |
|
| 370 | + 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
| 371 | + 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
| 372 | + // By default the videoobject should not show. |
|
| 373 | + 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ) |
|
| 374 | + ); |
|
| 375 | + |
|
| 376 | + // Set post-related values if there's a current post. |
|
| 377 | + if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 378 | + |
|
| 379 | + $params['post_id'] = $entity_being_edited->ID; |
|
| 380 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 381 | + $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
| 382 | + // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
| 383 | + // from the results, since we don't want the current entity to be discovered by the analysis. |
|
| 384 | + // |
|
| 385 | + // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
| 386 | + $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
| 387 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
| 388 | + |
|
| 389 | + /* |
|
| 390 | 390 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
| 391 | 391 | * |
| 392 | 392 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 393 | 393 | */ |
| 394 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 395 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - return $params; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - /** |
|
| 404 | - * Initialize the mappings. |
|
| 405 | - * @return void |
|
| 406 | - */ |
|
| 407 | - public function init_mappings() { |
|
| 408 | - new Admin_Mappings_Page(); |
|
| 409 | - /** |
|
| 410 | - * @since 3.27.0 |
|
| 411 | - * Hooks in to ui of edit mapping screen, add taxonomy as a option. |
|
| 412 | - */ |
|
| 413 | - $taxonomy_option = new Taxonomy_Option(); |
|
| 414 | - $taxonomy_option->add_taxonomy_option(); |
|
| 415 | - new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
| 416 | - } |
|
| 394 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 395 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + return $params; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + /** |
|
| 404 | + * Initialize the mappings. |
|
| 405 | + * @return void |
|
| 406 | + */ |
|
| 407 | + public function init_mappings() { |
|
| 408 | + new Admin_Mappings_Page(); |
|
| 409 | + /** |
|
| 410 | + * @since 3.27.0 |
|
| 411 | + * Hooks in to ui of edit mapping screen, add taxonomy as a option. |
|
| 412 | + */ |
|
| 413 | + $taxonomy_option = new Taxonomy_Option(); |
|
| 414 | + $taxonomy_option->add_taxonomy_option(); |
|
| 415 | + new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
| 416 | + } |
|
| 417 | 417 | |
| 418 | 418 | |
| 419 | 419 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @since 1.0.0 |
| 83 | 83 | * |
| 84 | 84 | */ |
| 85 | - public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
| 85 | + public function __construct($plugin_name, $version, $notice_service, $user_service) { |
|
| 86 | 86 | |
| 87 | 87 | $this->plugin_name = $plugin_name; |
| 88 | 88 | $this->version = $version; |
@@ -93,18 +93,18 @@ discard block |
||
| 93 | 93 | $dataset_uri = $configuration_service->get_dataset_uri(); |
| 94 | 94 | $key = $configuration_service->get_key(); |
| 95 | 95 | $features_registry = Features_Registry::get_instance(); |
| 96 | - if ( empty( $dataset_uri ) ) { |
|
| 96 | + if (empty($dataset_uri)) { |
|
| 97 | 97 | $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
| 98 | - if ( empty( $key ) ) { |
|
| 99 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 98 | + if (empty($key)) { |
|
| 99 | + $error = sprintf(esc_html__("WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
| 100 | 100 | } else { |
| 101 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
| 101 | + $error = sprintf(esc_html__("WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
| 102 | 102 | } |
| 103 | - $notice_service->add_error( $error ); |
|
| 103 | + $notice_service->add_error($error); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Load additional code if we're in the admin UI. |
| 107 | - if ( is_admin() ) { |
|
| 107 | + if (is_admin()) { |
|
| 108 | 108 | |
| 109 | 109 | // Require the PHP files for the next code fragment. |
| 110 | 110 | self::require_files(); |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 129 | 129 | */ |
| 130 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 130 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 131 | 131 | |
| 132 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 133 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 132 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
| 133 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-schemaorg-property-metabox.php'; |
|
| 134 | 134 | |
| 135 | 135 | // new Wordlift_Admin_Schemaorg_Property_Metabox( Wordlift_Schemaorg_Property_Service::get_instance() ); |
| 136 | 136 | |
| 137 | 137 | /* |
| 138 | 138 | * The `Mappings` admin page. |
| 139 | 139 | */ |
| 140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
| 140 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-mappings-page.php'; |
|
| 141 | 141 | |
| 142 | 142 | new Wordlift_Admin_Mappings_Page(); |
| 143 | 143 | |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @since 3.20.0 |
| 148 | 148 | */ |
| 149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 149 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
| 150 | 150 | |
| 151 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
| 151 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter(new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync'); |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @since 3.20.0 |
| 161 | 161 | */ |
| 162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
| 162 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-term-adapter.php'; |
|
| 163 | 163 | new Wordlift_Admin_Term_Adapter(); |
| 164 | 164 | |
| 165 | 165 | /* |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $features_registry->register_feature_from_slug( |
| 188 | 188 | 'mappings', |
| 189 | - ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
| 190 | - array( $this, 'init_mappings' ) ); |
|
| 189 | + (defined('WL_ENABLE_MAPPINGS') && WL_ENABLE_MAPPINGS), |
|
| 190 | + array($this, 'init_mappings') ); |
|
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | // Set the singleton instance. |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | private static function require_files() { |
| 204 | 204 | |
| 205 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 206 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 207 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 205 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard-latest-news.php'; |
|
| 206 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard-v2.php'; |
|
| 207 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public static function is_gutenberg() { |
| 224 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
| 224 | + if (function_exists('is_gutenberg_page') && |
|
| 225 | 225 | is_gutenberg_page() |
| 226 | 226 | ) { |
| 227 | 227 | // The Gutenberg plugin is on. |
| 228 | 228 | return true; |
| 229 | 229 | } |
| 230 | 230 | $current_screen = get_current_screen(); |
| 231 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
| 231 | + if (method_exists($current_screen, 'is_block_editor') && |
|
| 232 | 232 | $current_screen->is_block_editor() |
| 233 | 233 | ) { |
| 234 | 234 | // Gutenberg page on 5+. |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * class. |
| 258 | 258 | */ |
| 259 | 259 | |
| 260 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 260 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all'); |
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
@@ -275,22 +275,22 @@ discard block |
||
| 275 | 275 | * @since 3.20.0 |
| 276 | 276 | */ |
| 277 | 277 | $screen = get_current_screen(); |
| 278 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
| 278 | + if (is_a($screen, 'WP_Screen') && 'filter-urls_page_filter_urls_form' === $screen->id) { |
|
| 279 | 279 | return; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | // Enqueue the admin scripts. |
| 283 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/1/admin.js', array( |
|
| 283 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/1/admin.js', array( |
|
| 284 | 284 | 'jquery', |
| 285 | 285 | 'underscore', |
| 286 | 286 | 'backbone', |
| 287 | - ), $this->version, false ); |
|
| 287 | + ), $this->version, false); |
|
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | $params = $this->get_params(); |
| 291 | 291 | |
| 292 | 292 | // Finally output the params as `wlSettings` for JavaScript code. |
| 293 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
| 293 | + wp_localize_script($this->plugin_name, 'wlSettings', apply_filters('wl_admin_settings', $params)); |
|
| 294 | 294 | |
| 295 | 295 | } |
| 296 | 296 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @return array |
| 300 | 300 | */ |
| 301 | 301 | public function get_params() { |
| 302 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
| 302 | + $can_edit_wordlift_entities = current_user_can('edit_wordlift_entities'); |
|
| 303 | 303 | /* |
| 304 | 304 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
| 305 | 305 | * that cannot edit create entities will always see the local entities. |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | // Set the basic params. |
| 312 | 312 | $params = array( |
| 313 | 313 | // @todo scripts in admin should use wp.post. |
| 314 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 314 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 315 | 315 | // @todo remove specific actions from settings. |
| 316 | 316 | 'action' => 'entity_by_title', |
| 317 | 317 | 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
@@ -321,17 +321,17 @@ discard block |
||
| 321 | 321 | // |
| 322 | 322 | // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
| 323 | 323 | // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
| 324 | - 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
| 324 | + 'can_create_entities' => apply_filters('wl_feature__enable__dataset', true) ? ($can_edit_wordlift_entities ? 'yes' : 'no') : 'no', |
|
| 325 | 325 | 'l10n' => array( |
| 326 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 327 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 328 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 329 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
| 330 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
| 331 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
| 332 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
| 326 | + 'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'), |
|
| 327 | + 'logo_selection_title' => __('WordLift Choose Logo', 'wordlift'), |
|
| 328 | + 'logo_selection_button' => array('text' => __('Choose Logo', 'wordlift')), |
|
| 329 | + 'Type at least 3 characters to search...' => _x('Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift'), |
|
| 330 | + 'No results found for your search.' => _x('No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift'), |
|
| 331 | + 'Please wait while we look for entities in the linked data cloud...' => _x('Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift'), |
|
| 332 | + 'Add keywords to track' => __('Add Keywords to track', 'wordlift'), |
|
| 333 | 333 | ), |
| 334 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
| 334 | + 'wl_autocomplete_nonce' => wp_create_nonce('wl_autocomplete'), |
|
| 335 | 335 | 'autocomplete_scope' => $autocomplete_scope, |
| 336 | 336 | /** |
| 337 | 337 | * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
@@ -346,53 +346,53 @@ discard block |
||
| 346 | 346 | * @since 3.19.4 |
| 347 | 347 | * |
| 348 | 348 | */ |
| 349 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
| 349 | + 'default_editor_id' => apply_filters('wl_default_editor_id', 'content'), |
|
| 350 | 350 | |
| 351 | - 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
| 351 | + 'analysis' => array('_wpnonce' => wp_create_nonce('wl_analyze')), |
|
| 352 | 352 | /** |
| 353 | 353 | * Faceted search default limit |
| 354 | 354 | * |
| 355 | 355 | * @since 3.26.1 |
| 356 | 356 | */ |
| 357 | - 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
| 357 | + 'faceted_search_default_limit' => apply_filters('wl_faceted_search_default_limit', 10), |
|
| 358 | 358 | /** |
| 359 | 359 | * WL Root path, to access in JS |
| 360 | 360 | * |
| 361 | 361 | * @since 3.27.3 |
| 362 | 362 | */ |
| 363 | - 'wl_root' => plugin_dir_url( __DIR__ ), |
|
| 363 | + 'wl_root' => plugin_dir_url(__DIR__), |
|
| 364 | 364 | /** |
| 365 | 365 | * Enable synonyms, to access in JS |
| 366 | 366 | * Show classification sidebar, to access in JS |
| 367 | 367 | * |
| 368 | 368 | * @since 3.30.0 |
| 369 | 369 | */ |
| 370 | - 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
| 371 | - 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
| 370 | + 'can_add_synonyms' => apply_filters('wl_feature__enable__add-synonyms', true), |
|
| 371 | + 'show_classification_sidebar' => apply_filters('wl_feature__enable__classification-sidebar', true), |
|
| 372 | 372 | // By default the videoobject should not show. |
| 373 | - 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ) |
|
| 373 | + 'show_videoobject' => apply_filters('wl_feature__enable__videoobject', false) |
|
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | 376 | // Set post-related values if there's a current post. |
| 377 | - if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 377 | + if (null !== $post = $entity_being_edited = get_post()) { |
|
| 378 | 378 | |
| 379 | 379 | $params['post_id'] = $entity_being_edited->ID; |
| 380 | 380 | $entity_service = Wordlift_Entity_Service::get_instance(); |
| 381 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
| 381 | + $params['entityBeingEdited'] = isset($entity_being_edited->post_type) && $entity_service->is_entity($post->ID) && is_numeric(get_the_ID()); |
|
| 382 | 382 | // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
| 383 | 383 | // from the results, since we don't want the current entity to be discovered by the analysis. |
| 384 | 384 | // |
| 385 | 385 | // See https://github.com/insideout10/wordlift-plugin/issues/345 |
| 386 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
| 387 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
| 386 | + $params['itemId'] = $entity_service->get_uri($entity_being_edited->ID); |
|
| 387 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce('wl_schemaorg_property'); |
|
| 388 | 388 | |
| 389 | 389 | /* |
| 390 | 390 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
| 391 | 391 | * |
| 392 | 392 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 393 | 393 | */ |
| 394 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 395 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
| 394 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 395 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all($post->ID); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | $taxonomy_option = new Taxonomy_Option(); |
| 414 | 414 | $taxonomy_option->add_taxonomy_option(); |
| 415 | - new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
| 415 | + new Edit_Mappings_Page(new Mappings_Transform_Functions_Registry()); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | |
@@ -14,89 +14,89 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class Wordlift_Entity_Type_Taxonomy_Service { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The WordPress taxonomy name. |
|
| 19 | - * |
|
| 20 | - * @since 1.0.0 |
|
| 21 | - */ |
|
| 22 | - const TAXONOMY_NAME = 'wl_entity_type'; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Register the taxonomies. |
|
| 26 | - * |
|
| 27 | - * @since 3.23.6 we hook to `wp_get_object_terms` to ensure that a term is returned when a post is queries for the |
|
| 28 | - * `wl_entity_type` taxonomy. |
|
| 29 | - * @since 3.18.0 |
|
| 30 | - */ |
|
| 31 | - public function init() { |
|
| 32 | - |
|
| 33 | - $labels = array( |
|
| 34 | - 'name' => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ), |
|
| 35 | - 'singular_name' => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ), |
|
| 36 | - 'search_items' => __( 'Search Entity Types', 'wordlift' ), |
|
| 37 | - 'all_items' => __( 'All Entity Types', 'wordlift' ), |
|
| 38 | - 'parent_item' => __( 'Parent Entity Type', 'wordlift' ), |
|
| 39 | - 'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ), |
|
| 40 | - 'edit_item' => __( 'Edit Entity Type', 'wordlift' ), |
|
| 41 | - 'update_item' => __( 'Update Entity Type', 'wordlift' ), |
|
| 42 | - 'add_new_item' => __( 'Add New Entity Type', 'wordlift' ), |
|
| 43 | - 'new_item_name' => __( 'New Entity Type', 'wordlift' ), |
|
| 44 | - 'menu_name' => __( 'Entity Types', 'wordlift' ), |
|
| 45 | - ); |
|
| 46 | - |
|
| 47 | - // Take away GUI for taxonomy editing. |
|
| 48 | - // TODO: read capabilities when editing of the WL <-> schema.org mapping is possible. |
|
| 49 | - $capabilities = array( |
|
| 50 | - // We enable editors to change the title/description of terms: |
|
| 51 | - // |
|
| 52 | - // @see https://github.com/insideout10/wordlift-plugin/issues/398. |
|
| 53 | - 'manage_terms' => 'manage_options', |
|
| 54 | - 'edit_terms' => 'wl_entity_type_edit_term', |
|
| 55 | - 'delete_terms' => 'wl_entity_type_delete_term', |
|
| 56 | - 'assign_terms' => 'edit_posts', |
|
| 57 | - ); |
|
| 58 | - |
|
| 59 | - $args = array( |
|
| 60 | - 'labels' => $labels, |
|
| 61 | - 'capabilities' => $capabilities, |
|
| 62 | - 'hierarchical' => true, |
|
| 63 | - 'show_admin_column' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 64 | - 'show_in_rest' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 65 | - 'show_in_quick_edit' => false, |
|
| 66 | - 'publicly_queryable' => false |
|
| 67 | - ); |
|
| 68 | - |
|
| 69 | - /* |
|
| 17 | + /** |
|
| 18 | + * The WordPress taxonomy name. |
|
| 19 | + * |
|
| 20 | + * @since 1.0.0 |
|
| 21 | + */ |
|
| 22 | + const TAXONOMY_NAME = 'wl_entity_type'; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Register the taxonomies. |
|
| 26 | + * |
|
| 27 | + * @since 3.23.6 we hook to `wp_get_object_terms` to ensure that a term is returned when a post is queries for the |
|
| 28 | + * `wl_entity_type` taxonomy. |
|
| 29 | + * @since 3.18.0 |
|
| 30 | + */ |
|
| 31 | + public function init() { |
|
| 32 | + |
|
| 33 | + $labels = array( |
|
| 34 | + 'name' => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ), |
|
| 35 | + 'singular_name' => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ), |
|
| 36 | + 'search_items' => __( 'Search Entity Types', 'wordlift' ), |
|
| 37 | + 'all_items' => __( 'All Entity Types', 'wordlift' ), |
|
| 38 | + 'parent_item' => __( 'Parent Entity Type', 'wordlift' ), |
|
| 39 | + 'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ), |
|
| 40 | + 'edit_item' => __( 'Edit Entity Type', 'wordlift' ), |
|
| 41 | + 'update_item' => __( 'Update Entity Type', 'wordlift' ), |
|
| 42 | + 'add_new_item' => __( 'Add New Entity Type', 'wordlift' ), |
|
| 43 | + 'new_item_name' => __( 'New Entity Type', 'wordlift' ), |
|
| 44 | + 'menu_name' => __( 'Entity Types', 'wordlift' ), |
|
| 45 | + ); |
|
| 46 | + |
|
| 47 | + // Take away GUI for taxonomy editing. |
|
| 48 | + // TODO: read capabilities when editing of the WL <-> schema.org mapping is possible. |
|
| 49 | + $capabilities = array( |
|
| 50 | + // We enable editors to change the title/description of terms: |
|
| 51 | + // |
|
| 52 | + // @see https://github.com/insideout10/wordlift-plugin/issues/398. |
|
| 53 | + 'manage_terms' => 'manage_options', |
|
| 54 | + 'edit_terms' => 'wl_entity_type_edit_term', |
|
| 55 | + 'delete_terms' => 'wl_entity_type_delete_term', |
|
| 56 | + 'assign_terms' => 'edit_posts', |
|
| 57 | + ); |
|
| 58 | + |
|
| 59 | + $args = array( |
|
| 60 | + 'labels' => $labels, |
|
| 61 | + 'capabilities' => $capabilities, |
|
| 62 | + 'hierarchical' => true, |
|
| 63 | + 'show_admin_column' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 64 | + 'show_in_rest' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 65 | + 'show_in_quick_edit' => false, |
|
| 66 | + 'publicly_queryable' => false |
|
| 67 | + ); |
|
| 68 | + |
|
| 69 | + /* |
|
| 70 | 70 | * If `All Entity Types` is enabled, use the new metabox. |
| 71 | 71 | * |
| 72 | 72 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 73 | 73 | * @since 3.20.0 |
| 74 | 74 | */ |
| 75 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 76 | - $args['meta_box_cb'] = apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ) ? array( |
|
| 77 | - 'Wordlift_Admin_Schemaorg_Taxonomy_Metabox', |
|
| 78 | - 'render' |
|
| 79 | - ) : false; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - register_taxonomy( |
|
| 83 | - self::TAXONOMY_NAME, // Taxonomy name. |
|
| 84 | - Wordlift_Entity_Service::valid_entity_post_types(), // Taxonomy post types. |
|
| 85 | - $args // Taxonomy args. |
|
| 86 | - ); |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Register meta wl_entities_gutenberg for use in Gutenberg |
|
| 90 | - */ |
|
| 91 | - register_meta( 'post', 'wl_entities_gutenberg', array( |
|
| 92 | - 'show_in_rest' => true, |
|
| 93 | - 'single' => true, |
|
| 94 | - 'type' => 'string', |
|
| 95 | - ) ); |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Register meta _wl_alt_label for use in Gutenberg |
|
| 99 | - */ |
|
| 75 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 76 | + $args['meta_box_cb'] = apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ) ? array( |
|
| 77 | + 'Wordlift_Admin_Schemaorg_Taxonomy_Metabox', |
|
| 78 | + 'render' |
|
| 79 | + ) : false; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + register_taxonomy( |
|
| 83 | + self::TAXONOMY_NAME, // Taxonomy name. |
|
| 84 | + Wordlift_Entity_Service::valid_entity_post_types(), // Taxonomy post types. |
|
| 85 | + $args // Taxonomy args. |
|
| 86 | + ); |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Register meta wl_entities_gutenberg for use in Gutenberg |
|
| 90 | + */ |
|
| 91 | + register_meta( 'post', 'wl_entities_gutenberg', array( |
|
| 92 | + 'show_in_rest' => true, |
|
| 93 | + 'single' => true, |
|
| 94 | + 'type' => 'string', |
|
| 95 | + ) ); |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Register meta _wl_alt_label for use in Gutenberg |
|
| 99 | + */ |
|
| 100 | 100 | // register_meta( 'post', Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, array( |
| 101 | 101 | // 'object_subtype' => '', |
| 102 | 102 | // 'show_in_rest' => true, |
@@ -107,104 +107,104 @@ discard block |
||
| 107 | 107 | // } |
| 108 | 108 | // ) ); |
| 109 | 109 | |
| 110 | - // see #1364: add custom fields support for CPTs that are valid entity post types in order to be able to |
|
| 111 | - // query for synonyms in Block Editor. |
|
| 112 | - add_filter( 'register_post_type_args', function ( $args, $post_type ) { |
|
| 113 | - if ( in_array( $post_type, Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 114 | - if ( ! isset( $args['supports'] ) ) { |
|
| 115 | - $args['supports'] = array(); |
|
| 116 | - } |
|
| 117 | - $args['supports'][] = 'custom-fields'; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - return $args; |
|
| 121 | - }, 10, 2 ); |
|
| 122 | - |
|
| 123 | - // Add filter to change the metabox CSS class. |
|
| 124 | - add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' ); |
|
| 125 | - |
|
| 126 | - // Add a filter to preset the object term if none is set. |
|
| 127 | - // |
|
| 128 | - // DO NOT hook to `wp_get_object_terms`, because `wp_get_object_terms` returns imploded values for SQL queries. |
|
| 129 | - // |
|
| 130 | - // @see https://github.com/insideout10/wordlift-plugin/issues/995 |
|
| 131 | - // @since 3.23.6 |
|
| 132 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * Exclude sitemap creation for wl_entity_type taxonomy in Yoast |
|
| 136 | - * @since 3.30.1 |
|
| 137 | - */ |
|
| 138 | - add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'wpseo_sitemap_exclude_taxonomy' ), 10, 2 ); |
|
| 139 | - |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Hook to the `get_object_terms` filter. |
|
| 144 | - * |
|
| 145 | - * We check if our taxonomy is requested and whether a term has been returned. If no term has been returned we |
|
| 146 | - * preset `Article` for posts/pages and 'Thing' for everything else and we query the terms again. |
|
| 147 | - * |
|
| 148 | - * @param array $terms Array of terms for the given object or objects. |
|
| 149 | - * @param int[] $object_ids Array of object IDs for which terms were retrieved. |
|
| 150 | - * @param string[] $taxonomies Array of taxonomy names from which terms were retrieved. |
|
| 151 | - * @param array $args Array of arguments for retrieving terms for the given |
|
| 152 | - * object(s). See get_object_terms() for details. |
|
| 153 | - * |
|
| 154 | - * @return array|WP_Error |
|
| 155 | - * @since 3.23.6 |
|
| 156 | - */ |
|
| 157 | - public function get_object_terms( $terms, $object_ids, $taxonomies, $args ) { |
|
| 158 | - // Get our entity type. |
|
| 159 | - $entity_type = self::TAXONOMY_NAME; |
|
| 160 | - |
|
| 161 | - // Check if this is a query for our entity type, that no terms have been found and that we have an article |
|
| 162 | - // term to preset in case. |
|
| 163 | - if ( ! taxonomy_exists( $entity_type ) |
|
| 164 | - || array( $entity_type ) !== (array) $taxonomies |
|
| 165 | - || ! empty( $terms ) |
|
| 166 | - || ! term_exists( 'article', $entity_type ) |
|
| 167 | - || ! term_exists( 'thing', $entity_type ) ) { |
|
| 168 | - |
|
| 169 | - // Return the input value. |
|
| 170 | - return $terms; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // Avoid nested calls in case of issues. |
|
| 174 | - remove_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10 ); |
|
| 175 | - |
|
| 176 | - // Set the default term for all the queried object. |
|
| 177 | - foreach ( (array) $object_ids as $object_id ) { |
|
| 178 | - $post_type = get_post_type( $object_id ); |
|
| 179 | - if ( Wordlift_Entity_Type_Service::is_valid_entity_post_type( $post_type ) ) { |
|
| 180 | - // Set the term to article for posts and pages, or to thing for everything else. |
|
| 181 | - $uris = Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ); |
|
| 182 | - foreach ( $uris as $uri ) { |
|
| 183 | - // set the uri based on post type. |
|
| 184 | - if ( $uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing' ) { |
|
| 185 | - $uri = Wordlift_Entity_Service::TYPE_NAME === $post_type ? |
|
| 186 | - 'http://schema.org/Thing' : 'http://schema.org/Article'; |
|
| 187 | - } |
|
| 188 | - Wordlift_Entity_Type_Service::get_instance()->set( $object_id, $uri ); |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - // Finally return the object terms. |
|
| 194 | - $terms = wp_get_object_terms( $object_ids, $taxonomies, $args ); |
|
| 195 | - |
|
| 196 | - // Re-enable nested calls in case of issues. |
|
| 197 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 198 | - |
|
| 199 | - return $terms; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - public function wpseo_sitemap_exclude_taxonomy( $exclude, $tax ) { |
|
| 203 | - if ( $tax === self::TAXONOMY_NAME ) { |
|
| 204 | - return true; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - return $exclude; |
|
| 208 | - } |
|
| 110 | + // see #1364: add custom fields support for CPTs that are valid entity post types in order to be able to |
|
| 111 | + // query for synonyms in Block Editor. |
|
| 112 | + add_filter( 'register_post_type_args', function ( $args, $post_type ) { |
|
| 113 | + if ( in_array( $post_type, Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 114 | + if ( ! isset( $args['supports'] ) ) { |
|
| 115 | + $args['supports'] = array(); |
|
| 116 | + } |
|
| 117 | + $args['supports'][] = 'custom-fields'; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + return $args; |
|
| 121 | + }, 10, 2 ); |
|
| 122 | + |
|
| 123 | + // Add filter to change the metabox CSS class. |
|
| 124 | + add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' ); |
|
| 125 | + |
|
| 126 | + // Add a filter to preset the object term if none is set. |
|
| 127 | + // |
|
| 128 | + // DO NOT hook to `wp_get_object_terms`, because `wp_get_object_terms` returns imploded values for SQL queries. |
|
| 129 | + // |
|
| 130 | + // @see https://github.com/insideout10/wordlift-plugin/issues/995 |
|
| 131 | + // @since 3.23.6 |
|
| 132 | + add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * Exclude sitemap creation for wl_entity_type taxonomy in Yoast |
|
| 136 | + * @since 3.30.1 |
|
| 137 | + */ |
|
| 138 | + add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'wpseo_sitemap_exclude_taxonomy' ), 10, 2 ); |
|
| 139 | + |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Hook to the `get_object_terms` filter. |
|
| 144 | + * |
|
| 145 | + * We check if our taxonomy is requested and whether a term has been returned. If no term has been returned we |
|
| 146 | + * preset `Article` for posts/pages and 'Thing' for everything else and we query the terms again. |
|
| 147 | + * |
|
| 148 | + * @param array $terms Array of terms for the given object or objects. |
|
| 149 | + * @param int[] $object_ids Array of object IDs for which terms were retrieved. |
|
| 150 | + * @param string[] $taxonomies Array of taxonomy names from which terms were retrieved. |
|
| 151 | + * @param array $args Array of arguments for retrieving terms for the given |
|
| 152 | + * object(s). See get_object_terms() for details. |
|
| 153 | + * |
|
| 154 | + * @return array|WP_Error |
|
| 155 | + * @since 3.23.6 |
|
| 156 | + */ |
|
| 157 | + public function get_object_terms( $terms, $object_ids, $taxonomies, $args ) { |
|
| 158 | + // Get our entity type. |
|
| 159 | + $entity_type = self::TAXONOMY_NAME; |
|
| 160 | + |
|
| 161 | + // Check if this is a query for our entity type, that no terms have been found and that we have an article |
|
| 162 | + // term to preset in case. |
|
| 163 | + if ( ! taxonomy_exists( $entity_type ) |
|
| 164 | + || array( $entity_type ) !== (array) $taxonomies |
|
| 165 | + || ! empty( $terms ) |
|
| 166 | + || ! term_exists( 'article', $entity_type ) |
|
| 167 | + || ! term_exists( 'thing', $entity_type ) ) { |
|
| 168 | + |
|
| 169 | + // Return the input value. |
|
| 170 | + return $terms; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // Avoid nested calls in case of issues. |
|
| 174 | + remove_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10 ); |
|
| 175 | + |
|
| 176 | + // Set the default term for all the queried object. |
|
| 177 | + foreach ( (array) $object_ids as $object_id ) { |
|
| 178 | + $post_type = get_post_type( $object_id ); |
|
| 179 | + if ( Wordlift_Entity_Type_Service::is_valid_entity_post_type( $post_type ) ) { |
|
| 180 | + // Set the term to article for posts and pages, or to thing for everything else. |
|
| 181 | + $uris = Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ); |
|
| 182 | + foreach ( $uris as $uri ) { |
|
| 183 | + // set the uri based on post type. |
|
| 184 | + if ( $uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing' ) { |
|
| 185 | + $uri = Wordlift_Entity_Service::TYPE_NAME === $post_type ? |
|
| 186 | + 'http://schema.org/Thing' : 'http://schema.org/Article'; |
|
| 187 | + } |
|
| 188 | + Wordlift_Entity_Type_Service::get_instance()->set( $object_id, $uri ); |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + // Finally return the object terms. |
|
| 194 | + $terms = wp_get_object_terms( $object_ids, $taxonomies, $args ); |
|
| 195 | + |
|
| 196 | + // Re-enable nested calls in case of issues. |
|
| 197 | + add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 198 | + |
|
| 199 | + return $terms; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + public function wpseo_sitemap_exclude_taxonomy( $exclude, $tax ) { |
|
| 203 | + if ( $tax === self::TAXONOMY_NAME ) { |
|
| 204 | + return true; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + return $exclude; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | 210 | } |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | public function init() { |
| 32 | 32 | |
| 33 | 33 | $labels = array( |
| 34 | - 'name' => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ), |
|
| 35 | - 'singular_name' => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ), |
|
| 36 | - 'search_items' => __( 'Search Entity Types', 'wordlift' ), |
|
| 37 | - 'all_items' => __( 'All Entity Types', 'wordlift' ), |
|
| 38 | - 'parent_item' => __( 'Parent Entity Type', 'wordlift' ), |
|
| 39 | - 'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ), |
|
| 40 | - 'edit_item' => __( 'Edit Entity Type', 'wordlift' ), |
|
| 41 | - 'update_item' => __( 'Update Entity Type', 'wordlift' ), |
|
| 42 | - 'add_new_item' => __( 'Add New Entity Type', 'wordlift' ), |
|
| 43 | - 'new_item_name' => __( 'New Entity Type', 'wordlift' ), |
|
| 44 | - 'menu_name' => __( 'Entity Types', 'wordlift' ), |
|
| 34 | + 'name' => _x('Entity Types', 'taxonomy general name', 'wordlift'), |
|
| 35 | + 'singular_name' => _x('Entity Type', 'taxonomy singular name', 'wordlift'), |
|
| 36 | + 'search_items' => __('Search Entity Types', 'wordlift'), |
|
| 37 | + 'all_items' => __('All Entity Types', 'wordlift'), |
|
| 38 | + 'parent_item' => __('Parent Entity Type', 'wordlift'), |
|
| 39 | + 'parent_item_colon' => __('Parent Entity Type:', 'wordlift'), |
|
| 40 | + 'edit_item' => __('Edit Entity Type', 'wordlift'), |
|
| 41 | + 'update_item' => __('Update Entity Type', 'wordlift'), |
|
| 42 | + 'add_new_item' => __('Add New Entity Type', 'wordlift'), |
|
| 43 | + 'new_item_name' => __('New Entity Type', 'wordlift'), |
|
| 44 | + 'menu_name' => __('Entity Types', 'wordlift'), |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | // Take away GUI for taxonomy editing. |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | 'labels' => $labels, |
| 61 | 61 | 'capabilities' => $capabilities, |
| 62 | 62 | 'hierarchical' => true, |
| 63 | - 'show_admin_column' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 64 | - 'show_in_rest' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 63 | + 'show_admin_column' => apply_filters('wl_feature__enable__entity-types-taxonomy', true), |
|
| 64 | + 'show_in_rest' => apply_filters('wl_feature__enable__entity-types-taxonomy', true), |
|
| 65 | 65 | 'show_in_quick_edit' => false, |
| 66 | 66 | 'publicly_queryable' => false |
| 67 | 67 | ); |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 73 | 73 | * @since 3.20.0 |
| 74 | 74 | */ |
| 75 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 76 | - $args['meta_box_cb'] = apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ) ? array( |
|
| 75 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 76 | + $args['meta_box_cb'] = apply_filters('wl_feature__enable__entity-types-taxonomy', true) ? array( |
|
| 77 | 77 | 'Wordlift_Admin_Schemaorg_Taxonomy_Metabox', |
| 78 | 78 | 'render' |
| 79 | 79 | ) : false; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Register meta wl_entities_gutenberg for use in Gutenberg |
| 90 | 90 | */ |
| 91 | - register_meta( 'post', 'wl_entities_gutenberg', array( |
|
| 91 | + register_meta('post', 'wl_entities_gutenberg', array( |
|
| 92 | 92 | 'show_in_rest' => true, |
| 93 | 93 | 'single' => true, |
| 94 | 94 | 'type' => 'string', |
| 95 | - ) ); |
|
| 95 | + )); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Register meta _wl_alt_label for use in Gutenberg |
@@ -109,19 +109,19 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // see #1364: add custom fields support for CPTs that are valid entity post types in order to be able to |
| 111 | 111 | // query for synonyms in Block Editor. |
| 112 | - add_filter( 'register_post_type_args', function ( $args, $post_type ) { |
|
| 113 | - if ( in_array( $post_type, Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 114 | - if ( ! isset( $args['supports'] ) ) { |
|
| 112 | + add_filter('register_post_type_args', function($args, $post_type) { |
|
| 113 | + if (in_array($post_type, Wordlift_Entity_Service::valid_entity_post_types())) { |
|
| 114 | + if ( ! isset($args['supports'])) { |
|
| 115 | 115 | $args['supports'] = array(); |
| 116 | 116 | } |
| 117 | 117 | $args['supports'][] = 'custom-fields'; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return $args; |
| 121 | - }, 10, 2 ); |
|
| 121 | + }, 10, 2); |
|
| 122 | 122 | |
| 123 | 123 | // Add filter to change the metabox CSS class. |
| 124 | - add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' ); |
|
| 124 | + add_filter('postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class'); |
|
| 125 | 125 | |
| 126 | 126 | // Add a filter to preset the object term if none is set. |
| 127 | 127 | // |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | // |
| 130 | 130 | // @see https://github.com/insideout10/wordlift-plugin/issues/995 |
| 131 | 131 | // @since 3.23.6 |
| 132 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 132 | + add_filter('get_object_terms', array($this, 'get_object_terms'), 10, 4); |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Exclude sitemap creation for wl_entity_type taxonomy in Yoast |
| 136 | 136 | * @since 3.30.1 |
| 137 | 137 | */ |
| 138 | - add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'wpseo_sitemap_exclude_taxonomy' ), 10, 2 ); |
|
| 138 | + add_filter('wpseo_sitemap_exclude_taxonomy', array($this, 'wpseo_sitemap_exclude_taxonomy'), 10, 2); |
|
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
@@ -154,53 +154,53 @@ discard block |
||
| 154 | 154 | * @return array|WP_Error |
| 155 | 155 | * @since 3.23.6 |
| 156 | 156 | */ |
| 157 | - public function get_object_terms( $terms, $object_ids, $taxonomies, $args ) { |
|
| 157 | + public function get_object_terms($terms, $object_ids, $taxonomies, $args) { |
|
| 158 | 158 | // Get our entity type. |
| 159 | 159 | $entity_type = self::TAXONOMY_NAME; |
| 160 | 160 | |
| 161 | 161 | // Check if this is a query for our entity type, that no terms have been found and that we have an article |
| 162 | 162 | // term to preset in case. |
| 163 | - if ( ! taxonomy_exists( $entity_type ) |
|
| 164 | - || array( $entity_type ) !== (array) $taxonomies |
|
| 165 | - || ! empty( $terms ) |
|
| 166 | - || ! term_exists( 'article', $entity_type ) |
|
| 167 | - || ! term_exists( 'thing', $entity_type ) ) { |
|
| 163 | + if ( ! taxonomy_exists($entity_type) |
|
| 164 | + || array($entity_type) !== (array) $taxonomies |
|
| 165 | + || ! empty($terms) |
|
| 166 | + || ! term_exists('article', $entity_type) |
|
| 167 | + || ! term_exists('thing', $entity_type)) { |
|
| 168 | 168 | |
| 169 | 169 | // Return the input value. |
| 170 | 170 | return $terms; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Avoid nested calls in case of issues. |
| 174 | - remove_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10 ); |
|
| 174 | + remove_filter('get_object_terms', array($this, 'get_object_terms'), 10); |
|
| 175 | 175 | |
| 176 | 176 | // Set the default term for all the queried object. |
| 177 | - foreach ( (array) $object_ids as $object_id ) { |
|
| 178 | - $post_type = get_post_type( $object_id ); |
|
| 179 | - if ( Wordlift_Entity_Type_Service::is_valid_entity_post_type( $post_type ) ) { |
|
| 177 | + foreach ((array) $object_ids as $object_id) { |
|
| 178 | + $post_type = get_post_type($object_id); |
|
| 179 | + if (Wordlift_Entity_Type_Service::is_valid_entity_post_type($post_type)) { |
|
| 180 | 180 | // Set the term to article for posts and pages, or to thing for everything else. |
| 181 | - $uris = Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ); |
|
| 182 | - foreach ( $uris as $uri ) { |
|
| 181 | + $uris = Wordlift_Entity_Type_Adapter::get_entity_types($post_type); |
|
| 182 | + foreach ($uris as $uri) { |
|
| 183 | 183 | // set the uri based on post type. |
| 184 | - if ( $uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing' ) { |
|
| 184 | + if ($uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing') { |
|
| 185 | 185 | $uri = Wordlift_Entity_Service::TYPE_NAME === $post_type ? |
| 186 | 186 | 'http://schema.org/Thing' : 'http://schema.org/Article'; |
| 187 | 187 | } |
| 188 | - Wordlift_Entity_Type_Service::get_instance()->set( $object_id, $uri ); |
|
| 188 | + Wordlift_Entity_Type_Service::get_instance()->set($object_id, $uri); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Finally return the object terms. |
| 194 | - $terms = wp_get_object_terms( $object_ids, $taxonomies, $args ); |
|
| 194 | + $terms = wp_get_object_terms($object_ids, $taxonomies, $args); |
|
| 195 | 195 | |
| 196 | 196 | // Re-enable nested calls in case of issues. |
| 197 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 197 | + add_filter('get_object_terms', array($this, 'get_object_terms'), 10, 4); |
|
| 198 | 198 | |
| 199 | 199 | return $terms; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function wpseo_sitemap_exclude_taxonomy( $exclude, $tax ) { |
|
| 203 | - if ( $tax === self::TAXONOMY_NAME ) { |
|
| 202 | + public function wpseo_sitemap_exclude_taxonomy($exclude, $tax) { |
|
| 203 | + if ($tax === self::TAXONOMY_NAME) { |
|
| 204 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -15,277 +15,277 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Wordlift_Entity_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * A {@link Wordlift_Property_Getter} instance. |
|
| 20 | - * |
|
| 21 | - * @since 3.8.0 |
|
| 22 | - * @access private |
|
| 23 | - * @var \Wordlift_Property_Getter $property_getter A {@link Wordlift_Property_Getter} instance. |
|
| 24 | - */ |
|
| 25 | - private $property_getter; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
| 29 | - * |
|
| 30 | - * @since 3.20.0 |
|
| 31 | - * @access private |
|
| 32 | - * @var null|Wordlift_Schemaorg_Property_Service The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
| 33 | - */ |
|
| 34 | - private $schemaorg_property_service; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * The {@link Wordlift_Post_To_Jsonld_Converter} is used to convert entities that also have the `article` term. |
|
| 38 | - * |
|
| 39 | - * @since 3.25.2 |
|
| 40 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 41 | - */ |
|
| 42 | - private $post_to_jsonld_converter; |
|
| 43 | - |
|
| 44 | - private $references_infos; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Wordlift_Entity_To_Jsonld_Converter constructor. |
|
| 48 | - * |
|
| 49 | - * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 50 | - * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 51 | - * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 52 | - * @param \Wordlift_Property_Getter $property_getter A {@link Wordlift_Property_Getter} instance. |
|
| 53 | - * @param \Wordlift_Schemaorg_Property_Service $schemaorg_property_service A {@link Wordlift_Schemaorg_Property_Service} instance. |
|
| 54 | - * @param \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 55 | - * |
|
| 56 | - * @since 3.8.0 |
|
| 57 | - */ |
|
| 58 | - public function __construct( $entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter ) { |
|
| 59 | - parent::__construct( $entity_type_service, $user_service, $attachment_service ); |
|
| 60 | - |
|
| 61 | - $this->property_getter = $property_getter; |
|
| 62 | - $this->schemaorg_property_service = $schemaorg_property_service; |
|
| 63 | - $this->post_to_jsonld_converter = $post_to_jsonld_converter; |
|
| 64 | - |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 69 | - * found while processing the post is set in the $references array. |
|
| 70 | - * |
|
| 71 | - * @param int $post_id The {@link WP_Post} id. |
|
| 72 | - * @param array $references An array of entity references. |
|
| 73 | - * @param array $references_infos |
|
| 74 | - * |
|
| 75 | - * @return array A JSON-LD array. |
|
| 76 | - * @since 3.8.0 |
|
| 77 | - */ |
|
| 78 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
| 79 | - |
|
| 80 | - // Get the post instance. |
|
| 81 | - $post = get_post( $post_id ); |
|
| 82 | - if ( null === $post ) { |
|
| 83 | - // Post not found. |
|
| 84 | - return null; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 88 | - if ( has_term( 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id ) ) { |
|
| 89 | - $jsonld = $this->post_to_jsonld_converter->convert( $post_id, $references, $references_infos ); |
|
| 90 | - } else { |
|
| 91 | - $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - // Get the entity name. |
|
| 95 | - $jsonld['name'] = html_entity_decode( $post->post_title ); |
|
| 96 | - |
|
| 97 | - // 3.13.0, add alternate names. |
|
| 98 | - $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id ); |
|
| 99 | - if ( 0 < count( $alternative_labels ) ) { |
|
| 100 | - $jsonld['alternateName'] = $alternative_labels; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - // Get the entity `@type` with custom fields set by the Wordlift_Schema_Service. |
|
| 104 | - // |
|
| 105 | - // This allows us to gather the basic properties as defined by the `Thing` entity type. |
|
| 106 | - // Get the configured type custom fields. |
|
| 107 | - $custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id ); |
|
| 108 | - |
|
| 109 | - if ( isset( $custom_fields ) ) { |
|
| 110 | - $this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /* |
|
| 18 | + /** |
|
| 19 | + * A {@link Wordlift_Property_Getter} instance. |
|
| 20 | + * |
|
| 21 | + * @since 3.8.0 |
|
| 22 | + * @access private |
|
| 23 | + * @var \Wordlift_Property_Getter $property_getter A {@link Wordlift_Property_Getter} instance. |
|
| 24 | + */ |
|
| 25 | + private $property_getter; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
| 29 | + * |
|
| 30 | + * @since 3.20.0 |
|
| 31 | + * @access private |
|
| 32 | + * @var null|Wordlift_Schemaorg_Property_Service The {@link Wordlift_Schemaorg_Property_Service} or null if not provided. |
|
| 33 | + */ |
|
| 34 | + private $schemaorg_property_service; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * The {@link Wordlift_Post_To_Jsonld_Converter} is used to convert entities that also have the `article` term. |
|
| 38 | + * |
|
| 39 | + * @since 3.25.2 |
|
| 40 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 41 | + */ |
|
| 42 | + private $post_to_jsonld_converter; |
|
| 43 | + |
|
| 44 | + private $references_infos; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Wordlift_Entity_To_Jsonld_Converter constructor. |
|
| 48 | + * |
|
| 49 | + * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 50 | + * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 51 | + * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 52 | + * @param \Wordlift_Property_Getter $property_getter A {@link Wordlift_Property_Getter} instance. |
|
| 53 | + * @param \Wordlift_Schemaorg_Property_Service $schemaorg_property_service A {@link Wordlift_Schemaorg_Property_Service} instance. |
|
| 54 | + * @param \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter The {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 55 | + * |
|
| 56 | + * @since 3.8.0 |
|
| 57 | + */ |
|
| 58 | + public function __construct( $entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter ) { |
|
| 59 | + parent::__construct( $entity_type_service, $user_service, $attachment_service ); |
|
| 60 | + |
|
| 61 | + $this->property_getter = $property_getter; |
|
| 62 | + $this->schemaorg_property_service = $schemaorg_property_service; |
|
| 63 | + $this->post_to_jsonld_converter = $post_to_jsonld_converter; |
|
| 64 | + |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 69 | + * found while processing the post is set in the $references array. |
|
| 70 | + * |
|
| 71 | + * @param int $post_id The {@link WP_Post} id. |
|
| 72 | + * @param array $references An array of entity references. |
|
| 73 | + * @param array $references_infos |
|
| 74 | + * |
|
| 75 | + * @return array A JSON-LD array. |
|
| 76 | + * @since 3.8.0 |
|
| 77 | + */ |
|
| 78 | + public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
| 79 | + |
|
| 80 | + // Get the post instance. |
|
| 81 | + $post = get_post( $post_id ); |
|
| 82 | + if ( null === $post ) { |
|
| 83 | + // Post not found. |
|
| 84 | + return null; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 88 | + if ( has_term( 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id ) ) { |
|
| 89 | + $jsonld = $this->post_to_jsonld_converter->convert( $post_id, $references, $references_infos ); |
|
| 90 | + } else { |
|
| 91 | + $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + // Get the entity name. |
|
| 95 | + $jsonld['name'] = html_entity_decode( $post->post_title ); |
|
| 96 | + |
|
| 97 | + // 3.13.0, add alternate names. |
|
| 98 | + $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id ); |
|
| 99 | + if ( 0 < count( $alternative_labels ) ) { |
|
| 100 | + $jsonld['alternateName'] = $alternative_labels; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + // Get the entity `@type` with custom fields set by the Wordlift_Schema_Service. |
|
| 104 | + // |
|
| 105 | + // This allows us to gather the basic properties as defined by the `Thing` entity type. |
|
| 106 | + // Get the configured type custom fields. |
|
| 107 | + $custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id ); |
|
| 108 | + |
|
| 109 | + if ( isset( $custom_fields ) ) { |
|
| 110 | + $this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /* |
|
| 114 | 114 | * Get the properties attached to the post. |
| 115 | 115 | * |
| 116 | 116 | * @since 3.20.0 We attach properties directly to the posts. |
| 117 | 117 | * |
| 118 | 118 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 119 | 119 | */ |
| 120 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 121 | - $this->process_post_properties( $jsonld, $post_id ); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
|
| 126 | - * |
|
| 127 | - * @param array $value { |
|
| 128 | - * |
|
| 129 | - * @type array $jsonld The JSON-LD structure. |
|
| 130 | - * @type int[] $references An array of post IDs. |
|
| 131 | - * } |
|
| 132 | - * @since 3.25.0 |
|
| 133 | - * |
|
| 134 | - * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/ |
|
| 135 | - * |
|
| 136 | - * @api |
|
| 137 | - */ |
|
| 138 | - $ret_val = apply_filters( 'wl_entity_jsonld_array', array( |
|
| 139 | - 'jsonld' => $jsonld, |
|
| 140 | - 'references' => $references, |
|
| 141 | - ), $post_id ); |
|
| 142 | - $jsonld = $ret_val['jsonld']; |
|
| 143 | - $references = $ret_val['references']; |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Call the `wl_entity_jsonld` filter. |
|
| 147 | - * |
|
| 148 | - * @param array $jsonld The JSON-LD structure. |
|
| 149 | - * @param int $post_id The {@link WP_Post} `id`. |
|
| 150 | - * @param array $references The array of referenced entities. |
|
| 151 | - * |
|
| 152 | - * @since 3.20.0 |
|
| 153 | - * |
|
| 154 | - * @api |
|
| 155 | - */ |
|
| 156 | - return apply_filters( 'wl_entity_jsonld', $this->post_process( $jsonld ), $post_id, $references ); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Add data to the JSON-LD using the `custom_fields` array which contains the definitions of property |
|
| 161 | - * for the post entity type. |
|
| 162 | - * |
|
| 163 | - * @param array $jsonld The JSON-LD array. |
|
| 164 | - * @param array $fields The entity types field array. |
|
| 165 | - * @param WP_Post $post The target {@link WP_Post} instance. |
|
| 166 | - * @param array $references The references array. |
|
| 167 | - * |
|
| 168 | - * @since 3.20.0 This code moved from the above function `convert`, used for entity types defined in |
|
| 169 | - * the {@link Wordlift_Schema_Service} class. |
|
| 170 | - * |
|
| 171 | - */ |
|
| 172 | - private function process_type_custom_fields( &$jsonld, $fields, $post, &$references, &$references_infos ) { |
|
| 173 | - |
|
| 174 | - // Set a reference to use in closures. |
|
| 175 | - $converter = $this; |
|
| 176 | - |
|
| 177 | - // Try each field on the entity. |
|
| 178 | - foreach ( $fields as $key => $value ) { |
|
| 179 | - |
|
| 180 | - // Get the predicate. |
|
| 181 | - $name = $this->relative_to_context( $value['predicate'] ); |
|
| 182 | - |
|
| 183 | - // Get the value, the property service will get the right extractor |
|
| 184 | - // for that property. |
|
| 185 | - $value = $this->property_getter->get( $post->ID, $key, Object_Type_Enum::POST ); |
|
| 186 | - |
|
| 187 | - if ( empty( $value ) ) { |
|
| 188 | - continue; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - // Map the value to the property name. |
|
| 192 | - // If we got an array with just one value, we return that one value. |
|
| 193 | - // If we got a Wordlift_Property_Entity_Reference we get the URL. |
|
| 194 | - $jsonld[ $name ] = self::make_one( array_map( function ( $item ) use ( $converter, &$references, &$references_infos ) { |
|
| 195 | - |
|
| 196 | - if ( $item instanceof Wordlift_Property_Entity_Reference ) { |
|
| 197 | - |
|
| 198 | - $url = $item->get_url(); |
|
| 199 | - |
|
| 200 | - // The refactored converters require the entity id. |
|
| 201 | - $references[] = $item->get_id(); |
|
| 202 | - |
|
| 203 | - $references_infos[] = array( 'reference' => $item ); |
|
| 204 | - |
|
| 205 | - return array( |
|
| 206 | - '@id' => $url, |
|
| 207 | - ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - return $converter->relative_to_context( $item ); |
|
| 211 | - }, $value ) ); |
|
| 212 | - |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * Process the properties attached to the {@link WP_Post}. |
|
| 219 | - * |
|
| 220 | - * @param array $jsonld The JSON-LD array. |
|
| 221 | - * @param int $post_id The target {@link WP_Post} id. |
|
| 222 | - * |
|
| 223 | - * @since 3.20.0 |
|
| 224 | - * |
|
| 225 | - */ |
|
| 226 | - private function process_post_properties( &$jsonld, $post_id ) { |
|
| 227 | - |
|
| 228 | - // Get all the props. |
|
| 229 | - $props = $this->schemaorg_property_service->get_all( $post_id ); |
|
| 230 | - |
|
| 231 | - // Process all the props. |
|
| 232 | - foreach ( $props as $name => $instances ) { |
|
| 233 | - |
|
| 234 | - // Get the values. |
|
| 235 | - $values = array_map( function ( $instance ) { |
|
| 236 | - return $instance['value']; |
|
| 237 | - }, $instances ); |
|
| 238 | - |
|
| 239 | - // We might receive empty values, remove them. |
|
| 240 | - $non_empty_values = array_filter( $values, function ( $value ) { |
|
| 241 | - return ! empty( $value ); |
|
| 242 | - } ); |
|
| 243 | - |
|
| 244 | - // Skip empty properties. |
|
| 245 | - if ( empty( $non_empty_values ) ) { |
|
| 246 | - continue; |
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - // @@todo: need to handle maybe Numbers and URLs differently. |
|
| 250 | - // Make an array a single value when possible. |
|
| 251 | - $jsonld[ $name ] = self::make_one( $non_empty_values ); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * Post process the generated JSON to reorganize values which are stored as 1st |
|
| 258 | - * level in WP but are really 2nd level. |
|
| 259 | - * |
|
| 260 | - * @param array $jsonld An array of JSON-LD properties and values. |
|
| 261 | - * |
|
| 262 | - * @return array The array remapped. |
|
| 263 | - * @since 3.8.0 |
|
| 264 | - * |
|
| 265 | - */ |
|
| 266 | - private function post_process( $jsonld ) { |
|
| 267 | - |
|
| 268 | - foreach ( $jsonld as $key => $value ) { |
|
| 269 | - if ( 'streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key ) { |
|
| 270 | - $jsonld['address']['@type'] = 'PostalAddress'; |
|
| 271 | - $jsonld['address'][ $key ] = $value; |
|
| 272 | - unset( $jsonld[ $key ] ); |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - if ( 'latitude' === $key || 'longitude' === $key ) { |
|
| 276 | - $jsonld['geo']['@type'] = 'GeoCoordinates'; |
|
| 277 | - $jsonld['geo'][ $key ] = $value; |
|
| 278 | - unset( $jsonld[ $key ] ); |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - if ( 'calories' === $key ) { |
|
| 282 | - $jsonld['nutrition']['@type'] = 'NutritionInformation'; |
|
| 283 | - $jsonld['nutrition'][ $key ] = $value; |
|
| 284 | - unset( $jsonld[ $key ] ); |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - return $jsonld; |
|
| 289 | - } |
|
| 120 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 121 | + $this->process_post_properties( $jsonld, $post_id ); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Call the `wl_post_jsonld_array` filter. This filter allows 3rd parties to also modify the references. |
|
| 126 | + * |
|
| 127 | + * @param array $value { |
|
| 128 | + * |
|
| 129 | + * @type array $jsonld The JSON-LD structure. |
|
| 130 | + * @type int[] $references An array of post IDs. |
|
| 131 | + * } |
|
| 132 | + * @since 3.25.0 |
|
| 133 | + * |
|
| 134 | + * @see https://www.geeklab.info/2010/04/wordpress-pass-variables-by-reference-with-apply_filter/ |
|
| 135 | + * |
|
| 136 | + * @api |
|
| 137 | + */ |
|
| 138 | + $ret_val = apply_filters( 'wl_entity_jsonld_array', array( |
|
| 139 | + 'jsonld' => $jsonld, |
|
| 140 | + 'references' => $references, |
|
| 141 | + ), $post_id ); |
|
| 142 | + $jsonld = $ret_val['jsonld']; |
|
| 143 | + $references = $ret_val['references']; |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Call the `wl_entity_jsonld` filter. |
|
| 147 | + * |
|
| 148 | + * @param array $jsonld The JSON-LD structure. |
|
| 149 | + * @param int $post_id The {@link WP_Post} `id`. |
|
| 150 | + * @param array $references The array of referenced entities. |
|
| 151 | + * |
|
| 152 | + * @since 3.20.0 |
|
| 153 | + * |
|
| 154 | + * @api |
|
| 155 | + */ |
|
| 156 | + return apply_filters( 'wl_entity_jsonld', $this->post_process( $jsonld ), $post_id, $references ); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Add data to the JSON-LD using the `custom_fields` array which contains the definitions of property |
|
| 161 | + * for the post entity type. |
|
| 162 | + * |
|
| 163 | + * @param array $jsonld The JSON-LD array. |
|
| 164 | + * @param array $fields The entity types field array. |
|
| 165 | + * @param WP_Post $post The target {@link WP_Post} instance. |
|
| 166 | + * @param array $references The references array. |
|
| 167 | + * |
|
| 168 | + * @since 3.20.0 This code moved from the above function `convert`, used for entity types defined in |
|
| 169 | + * the {@link Wordlift_Schema_Service} class. |
|
| 170 | + * |
|
| 171 | + */ |
|
| 172 | + private function process_type_custom_fields( &$jsonld, $fields, $post, &$references, &$references_infos ) { |
|
| 173 | + |
|
| 174 | + // Set a reference to use in closures. |
|
| 175 | + $converter = $this; |
|
| 176 | + |
|
| 177 | + // Try each field on the entity. |
|
| 178 | + foreach ( $fields as $key => $value ) { |
|
| 179 | + |
|
| 180 | + // Get the predicate. |
|
| 181 | + $name = $this->relative_to_context( $value['predicate'] ); |
|
| 182 | + |
|
| 183 | + // Get the value, the property service will get the right extractor |
|
| 184 | + // for that property. |
|
| 185 | + $value = $this->property_getter->get( $post->ID, $key, Object_Type_Enum::POST ); |
|
| 186 | + |
|
| 187 | + if ( empty( $value ) ) { |
|
| 188 | + continue; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + // Map the value to the property name. |
|
| 192 | + // If we got an array with just one value, we return that one value. |
|
| 193 | + // If we got a Wordlift_Property_Entity_Reference we get the URL. |
|
| 194 | + $jsonld[ $name ] = self::make_one( array_map( function ( $item ) use ( $converter, &$references, &$references_infos ) { |
|
| 195 | + |
|
| 196 | + if ( $item instanceof Wordlift_Property_Entity_Reference ) { |
|
| 197 | + |
|
| 198 | + $url = $item->get_url(); |
|
| 199 | + |
|
| 200 | + // The refactored converters require the entity id. |
|
| 201 | + $references[] = $item->get_id(); |
|
| 202 | + |
|
| 203 | + $references_infos[] = array( 'reference' => $item ); |
|
| 204 | + |
|
| 205 | + return array( |
|
| 206 | + '@id' => $url, |
|
| 207 | + ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + return $converter->relative_to_context( $item ); |
|
| 211 | + }, $value ) ); |
|
| 212 | + |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * Process the properties attached to the {@link WP_Post}. |
|
| 219 | + * |
|
| 220 | + * @param array $jsonld The JSON-LD array. |
|
| 221 | + * @param int $post_id The target {@link WP_Post} id. |
|
| 222 | + * |
|
| 223 | + * @since 3.20.0 |
|
| 224 | + * |
|
| 225 | + */ |
|
| 226 | + private function process_post_properties( &$jsonld, $post_id ) { |
|
| 227 | + |
|
| 228 | + // Get all the props. |
|
| 229 | + $props = $this->schemaorg_property_service->get_all( $post_id ); |
|
| 230 | + |
|
| 231 | + // Process all the props. |
|
| 232 | + foreach ( $props as $name => $instances ) { |
|
| 233 | + |
|
| 234 | + // Get the values. |
|
| 235 | + $values = array_map( function ( $instance ) { |
|
| 236 | + return $instance['value']; |
|
| 237 | + }, $instances ); |
|
| 238 | + |
|
| 239 | + // We might receive empty values, remove them. |
|
| 240 | + $non_empty_values = array_filter( $values, function ( $value ) { |
|
| 241 | + return ! empty( $value ); |
|
| 242 | + } ); |
|
| 243 | + |
|
| 244 | + // Skip empty properties. |
|
| 245 | + if ( empty( $non_empty_values ) ) { |
|
| 246 | + continue; |
|
| 247 | + } |
|
| 248 | + |
|
| 249 | + // @@todo: need to handle maybe Numbers and URLs differently. |
|
| 250 | + // Make an array a single value when possible. |
|
| 251 | + $jsonld[ $name ] = self::make_one( $non_empty_values ); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * Post process the generated JSON to reorganize values which are stored as 1st |
|
| 258 | + * level in WP but are really 2nd level. |
|
| 259 | + * |
|
| 260 | + * @param array $jsonld An array of JSON-LD properties and values. |
|
| 261 | + * |
|
| 262 | + * @return array The array remapped. |
|
| 263 | + * @since 3.8.0 |
|
| 264 | + * |
|
| 265 | + */ |
|
| 266 | + private function post_process( $jsonld ) { |
|
| 267 | + |
|
| 268 | + foreach ( $jsonld as $key => $value ) { |
|
| 269 | + if ( 'streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key ) { |
|
| 270 | + $jsonld['address']['@type'] = 'PostalAddress'; |
|
| 271 | + $jsonld['address'][ $key ] = $value; |
|
| 272 | + unset( $jsonld[ $key ] ); |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + if ( 'latitude' === $key || 'longitude' === $key ) { |
|
| 276 | + $jsonld['geo']['@type'] = 'GeoCoordinates'; |
|
| 277 | + $jsonld['geo'][ $key ] = $value; |
|
| 278 | + unset( $jsonld[ $key ] ); |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + if ( 'calories' === $key ) { |
|
| 282 | + $jsonld['nutrition']['@type'] = 'NutritionInformation'; |
|
| 283 | + $jsonld['nutrition'][ $key ] = $value; |
|
| 284 | + unset( $jsonld[ $key ] ); |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + return $jsonld; |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | 291 | } |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @since 3.8.0 |
| 57 | 57 | */ |
| 58 | - public function __construct( $entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter ) { |
|
| 59 | - parent::__construct( $entity_type_service, $user_service, $attachment_service ); |
|
| 58 | + public function __construct($entity_type_service, $user_service, $attachment_service, $property_getter, $schemaorg_property_service, $post_to_jsonld_converter) { |
|
| 59 | + parent::__construct($entity_type_service, $user_service, $attachment_service); |
|
| 60 | 60 | |
| 61 | 61 | $this->property_getter = $property_getter; |
| 62 | 62 | $this->schemaorg_property_service = $schemaorg_property_service; |
@@ -75,28 +75,28 @@ discard block |
||
| 75 | 75 | * @return array A JSON-LD array. |
| 76 | 76 | * @since 3.8.0 |
| 77 | 77 | */ |
| 78 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ) { |
|
| 78 | + public function convert($post_id, &$references = array(), &$references_infos = array()) { |
|
| 79 | 79 | |
| 80 | 80 | // Get the post instance. |
| 81 | - $post = get_post( $post_id ); |
|
| 82 | - if ( null === $post ) { |
|
| 81 | + $post = get_post($post_id); |
|
| 82 | + if (null === $post) { |
|
| 83 | 83 | // Post not found. |
| 84 | 84 | return null; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Get the base JSON-LD and the list of entities referenced by this entity. |
| 88 | - if ( has_term( 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id ) ) { |
|
| 89 | - $jsonld = $this->post_to_jsonld_converter->convert( $post_id, $references, $references_infos ); |
|
| 88 | + if (has_term('article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, $post_id)) { |
|
| 89 | + $jsonld = $this->post_to_jsonld_converter->convert($post_id, $references, $references_infos); |
|
| 90 | 90 | } else { |
| 91 | - $jsonld = parent::convert( $post_id, $references, $references_infos ); |
|
| 91 | + $jsonld = parent::convert($post_id, $references, $references_infos); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Get the entity name. |
| 95 | - $jsonld['name'] = html_entity_decode( $post->post_title ); |
|
| 95 | + $jsonld['name'] = html_entity_decode($post->post_title); |
|
| 96 | 96 | |
| 97 | 97 | // 3.13.0, add alternate names. |
| 98 | - $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id ); |
|
| 99 | - if ( 0 < count( $alternative_labels ) ) { |
|
| 98 | + $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels($post_id); |
|
| 99 | + if (0 < count($alternative_labels)) { |
|
| 100 | 100 | $jsonld['alternateName'] = $alternative_labels; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | // |
| 105 | 105 | // This allows us to gather the basic properties as defined by the `Thing` entity type. |
| 106 | 106 | // Get the configured type custom fields. |
| 107 | - $custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id ); |
|
| 107 | + $custom_fields = $this->entity_type_service->get_custom_fields_for_post($post_id); |
|
| 108 | 108 | |
| 109 | - if ( isset( $custom_fields ) ) { |
|
| 110 | - $this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos ); |
|
| 109 | + if (isset($custom_fields)) { |
|
| 110 | + $this->process_type_custom_fields($jsonld, $custom_fields, $post, $references, $references_infos); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /* |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 119 | 119 | */ |
| 120 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 121 | - $this->process_post_properties( $jsonld, $post_id ); |
|
| 120 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 121 | + $this->process_post_properties($jsonld, $post_id); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @api |
| 137 | 137 | */ |
| 138 | - $ret_val = apply_filters( 'wl_entity_jsonld_array', array( |
|
| 138 | + $ret_val = apply_filters('wl_entity_jsonld_array', array( |
|
| 139 | 139 | 'jsonld' => $jsonld, |
| 140 | 140 | 'references' => $references, |
| 141 | - ), $post_id ); |
|
| 141 | + ), $post_id); |
|
| 142 | 142 | $jsonld = $ret_val['jsonld']; |
| 143 | 143 | $references = $ret_val['references']; |
| 144 | 144 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @api |
| 155 | 155 | */ |
| 156 | - return apply_filters( 'wl_entity_jsonld', $this->post_process( $jsonld ), $post_id, $references ); |
|
| 156 | + return apply_filters('wl_entity_jsonld', $this->post_process($jsonld), $post_id, $references); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -169,46 +169,46 @@ discard block |
||
| 169 | 169 | * the {@link Wordlift_Schema_Service} class. |
| 170 | 170 | * |
| 171 | 171 | */ |
| 172 | - private function process_type_custom_fields( &$jsonld, $fields, $post, &$references, &$references_infos ) { |
|
| 172 | + private function process_type_custom_fields(&$jsonld, $fields, $post, &$references, &$references_infos) { |
|
| 173 | 173 | |
| 174 | 174 | // Set a reference to use in closures. |
| 175 | 175 | $converter = $this; |
| 176 | 176 | |
| 177 | 177 | // Try each field on the entity. |
| 178 | - foreach ( $fields as $key => $value ) { |
|
| 178 | + foreach ($fields as $key => $value) { |
|
| 179 | 179 | |
| 180 | 180 | // Get the predicate. |
| 181 | - $name = $this->relative_to_context( $value['predicate'] ); |
|
| 181 | + $name = $this->relative_to_context($value['predicate']); |
|
| 182 | 182 | |
| 183 | 183 | // Get the value, the property service will get the right extractor |
| 184 | 184 | // for that property. |
| 185 | - $value = $this->property_getter->get( $post->ID, $key, Object_Type_Enum::POST ); |
|
| 185 | + $value = $this->property_getter->get($post->ID, $key, Object_Type_Enum::POST); |
|
| 186 | 186 | |
| 187 | - if ( empty( $value ) ) { |
|
| 187 | + if (empty($value)) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Map the value to the property name. |
| 192 | 192 | // If we got an array with just one value, we return that one value. |
| 193 | 193 | // If we got a Wordlift_Property_Entity_Reference we get the URL. |
| 194 | - $jsonld[ $name ] = self::make_one( array_map( function ( $item ) use ( $converter, &$references, &$references_infos ) { |
|
| 194 | + $jsonld[$name] = self::make_one(array_map(function($item) use ($converter, &$references, &$references_infos) { |
|
| 195 | 195 | |
| 196 | - if ( $item instanceof Wordlift_Property_Entity_Reference ) { |
|
| 196 | + if ($item instanceof Wordlift_Property_Entity_Reference) { |
|
| 197 | 197 | |
| 198 | 198 | $url = $item->get_url(); |
| 199 | 199 | |
| 200 | 200 | // The refactored converters require the entity id. |
| 201 | 201 | $references[] = $item->get_id(); |
| 202 | 202 | |
| 203 | - $references_infos[] = array( 'reference' => $item ); |
|
| 203 | + $references_infos[] = array('reference' => $item); |
|
| 204 | 204 | |
| 205 | 205 | return array( |
| 206 | 206 | '@id' => $url, |
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - return $converter->relative_to_context( $item ); |
|
| 211 | - }, $value ) ); |
|
| 210 | + return $converter->relative_to_context($item); |
|
| 211 | + }, $value)); |
|
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | |
@@ -223,32 +223,32 @@ discard block |
||
| 223 | 223 | * @since 3.20.0 |
| 224 | 224 | * |
| 225 | 225 | */ |
| 226 | - private function process_post_properties( &$jsonld, $post_id ) { |
|
| 226 | + private function process_post_properties(&$jsonld, $post_id) { |
|
| 227 | 227 | |
| 228 | 228 | // Get all the props. |
| 229 | - $props = $this->schemaorg_property_service->get_all( $post_id ); |
|
| 229 | + $props = $this->schemaorg_property_service->get_all($post_id); |
|
| 230 | 230 | |
| 231 | 231 | // Process all the props. |
| 232 | - foreach ( $props as $name => $instances ) { |
|
| 232 | + foreach ($props as $name => $instances) { |
|
| 233 | 233 | |
| 234 | 234 | // Get the values. |
| 235 | - $values = array_map( function ( $instance ) { |
|
| 235 | + $values = array_map(function($instance) { |
|
| 236 | 236 | return $instance['value']; |
| 237 | - }, $instances ); |
|
| 237 | + }, $instances); |
|
| 238 | 238 | |
| 239 | 239 | // We might receive empty values, remove them. |
| 240 | - $non_empty_values = array_filter( $values, function ( $value ) { |
|
| 241 | - return ! empty( $value ); |
|
| 240 | + $non_empty_values = array_filter($values, function($value) { |
|
| 241 | + return ! empty($value); |
|
| 242 | 242 | } ); |
| 243 | 243 | |
| 244 | 244 | // Skip empty properties. |
| 245 | - if ( empty( $non_empty_values ) ) { |
|
| 245 | + if (empty($non_empty_values)) { |
|
| 246 | 246 | continue; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // @@todo: need to handle maybe Numbers and URLs differently. |
| 250 | 250 | // Make an array a single value when possible. |
| 251 | - $jsonld[ $name ] = self::make_one( $non_empty_values ); |
|
| 251 | + $jsonld[$name] = self::make_one($non_empty_values); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | } |
@@ -263,25 +263,25 @@ discard block |
||
| 263 | 263 | * @since 3.8.0 |
| 264 | 264 | * |
| 265 | 265 | */ |
| 266 | - private function post_process( $jsonld ) { |
|
| 266 | + private function post_process($jsonld) { |
|
| 267 | 267 | |
| 268 | - foreach ( $jsonld as $key => $value ) { |
|
| 269 | - if ( 'streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key ) { |
|
| 268 | + foreach ($jsonld as $key => $value) { |
|
| 269 | + if ('streetAddress' === $key || 'postalCode' === $key || 'addressLocality' === $key || 'addressRegion' === $key || 'addressCountry' === $key || 'postOfficeBoxNumber' === $key) { |
|
| 270 | 270 | $jsonld['address']['@type'] = 'PostalAddress'; |
| 271 | - $jsonld['address'][ $key ] = $value; |
|
| 272 | - unset( $jsonld[ $key ] ); |
|
| 271 | + $jsonld['address'][$key] = $value; |
|
| 272 | + unset($jsonld[$key]); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if ( 'latitude' === $key || 'longitude' === $key ) { |
|
| 275 | + if ('latitude' === $key || 'longitude' === $key) { |
|
| 276 | 276 | $jsonld['geo']['@type'] = 'GeoCoordinates'; |
| 277 | - $jsonld['geo'][ $key ] = $value; |
|
| 278 | - unset( $jsonld[ $key ] ); |
|
| 277 | + $jsonld['geo'][$key] = $value; |
|
| 278 | + unset($jsonld[$key]); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if ( 'calories' === $key ) { |
|
| 281 | + if ('calories' === $key) { |
|
| 282 | 282 | $jsonld['nutrition']['@type'] = 'NutritionInformation'; |
| 283 | - $jsonld['nutrition'][ $key ] = $value; |
|
| 284 | - unset( $jsonld[ $key ] ); |
|
| 283 | + $jsonld['nutrition'][$key] = $value; |
|
| 284 | + unset($jsonld[$key]); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -639,13 +639,13 @@ discard block |
||
| 639 | 639 | $this->set_locale(); |
| 640 | 640 | |
| 641 | 641 | $that = $this; |
| 642 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 643 | - $that->define_admin_hooks( $that ); |
|
| 644 | - $that->define_public_hooks( $that ); |
|
| 645 | - }, 4 ); |
|
| 642 | + add_action('plugins_loaded', function() use ($that) { |
|
| 643 | + $that->define_admin_hooks($that); |
|
| 644 | + $that->define_public_hooks($that); |
|
| 645 | + }, 4); |
|
| 646 | 646 | |
| 647 | 647 | // If we're in `WP_CLI` load the related files. |
| 648 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 648 | + if (class_exists('WP_CLI')) { |
|
| 649 | 649 | $this->load_cli_dependencies(); |
| 650 | 650 | } |
| 651 | 651 | |
@@ -686,328 +686,328 @@ discard block |
||
| 686 | 686 | * The class responsible for orchestrating the actions and filters of the |
| 687 | 687 | * core plugin. |
| 688 | 688 | */ |
| 689 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 689 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 690 | 690 | |
| 691 | 691 | // The class responsible for plugin uninstall. |
| 692 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 692 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 693 | 693 | |
| 694 | 694 | /** |
| 695 | 695 | * The class responsible for defining internationalization functionality |
| 696 | 696 | * of the plugin. |
| 697 | 697 | */ |
| 698 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 698 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 699 | 699 | |
| 700 | 700 | /** |
| 701 | 701 | * WordLift's supported languages. |
| 702 | 702 | */ |
| 703 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 703 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 704 | 704 | |
| 705 | 705 | /** |
| 706 | 706 | * WordLift's supported countries. |
| 707 | 707 | */ |
| 708 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 708 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 709 | 709 | |
| 710 | 710 | /** |
| 711 | 711 | * Provide support functions to sanitize data. |
| 712 | 712 | */ |
| 713 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 713 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 714 | 714 | |
| 715 | 715 | /** Services. */ |
| 716 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 717 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 718 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 719 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 720 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 721 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 722 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 723 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 724 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 716 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 717 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 718 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 719 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 720 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 721 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 722 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 723 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 724 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 725 | 725 | |
| 726 | 726 | /** |
| 727 | 727 | * The Schema service. |
| 728 | 728 | */ |
| 729 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 729 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 730 | 730 | |
| 731 | 731 | /** |
| 732 | 732 | * The schema:url property service. |
| 733 | 733 | */ |
| 734 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 735 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 734 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 735 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 736 | 736 | |
| 737 | 737 | /** |
| 738 | 738 | * The UI service. |
| 739 | 739 | */ |
| 740 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 740 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 741 | 741 | |
| 742 | 742 | /** |
| 743 | 743 | * The Entity Types Taxonomy service. |
| 744 | 744 | */ |
| 745 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 745 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 746 | 746 | |
| 747 | 747 | /** |
| 748 | 748 | * The Entity service. |
| 749 | 749 | */ |
| 750 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 751 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 750 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 751 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 752 | 752 | |
| 753 | 753 | // Add the entity rating service. |
| 754 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 754 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 755 | 755 | |
| 756 | 756 | /** |
| 757 | 757 | * The User service. |
| 758 | 758 | */ |
| 759 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 759 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 760 | 760 | |
| 761 | 761 | /** |
| 762 | 762 | * The Timeline service. |
| 763 | 763 | */ |
| 764 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 764 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 765 | 765 | |
| 766 | 766 | /** |
| 767 | 767 | * The Topic Taxonomy service. |
| 768 | 768 | */ |
| 769 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 769 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 770 | 770 | |
| 771 | 771 | /** |
| 772 | 772 | * The WordLift URI service. |
| 773 | 773 | */ |
| 774 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 775 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 776 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 774 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 775 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 776 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 777 | 777 | |
| 778 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 779 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 778 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 779 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | 782 | * Load the converters. |
| 783 | 783 | */ |
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 785 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 787 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 788 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 784 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 785 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 786 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 787 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 788 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 789 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 790 | 790 | |
| 791 | 791 | /** |
| 792 | 792 | * Load cache-related files. |
| 793 | 793 | */ |
| 794 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 794 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 795 | 795 | |
| 796 | 796 | /** |
| 797 | 797 | * Load the content filter. |
| 798 | 798 | */ |
| 799 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 799 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 800 | 800 | |
| 801 | 801 | /* |
| 802 | 802 | * Load the excerpt helper. |
| 803 | 803 | */ |
| 804 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 804 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 805 | 805 | |
| 806 | 806 | /** |
| 807 | 807 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 808 | 808 | * |
| 809 | 809 | * @since 3.8.0 |
| 810 | 810 | */ |
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 811 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 812 | 812 | |
| 813 | 813 | // The Publisher Service and the AJAX adapter. |
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 815 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 814 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 815 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 816 | 816 | |
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 817 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 818 | 818 | |
| 819 | 819 | /** |
| 820 | 820 | * Load the WordLift key validation service. |
| 821 | 821 | */ |
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 823 | 823 | |
| 824 | 824 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 825 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 826 | 826 | |
| 827 | 827 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 829 | 829 | |
| 830 | 830 | /** Linked Data. */ |
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 836 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 840 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 841 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 831 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 832 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 834 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 835 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 836 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 837 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 839 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 840 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 841 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 842 | 842 | |
| 843 | 843 | /** Services. */ |
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 845 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 846 | 846 | |
| 847 | 847 | /** Adapters. */ |
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 848 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 850 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 851 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 852 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 853 | 853 | |
| 854 | 854 | /** Autocomplete. */ |
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 855 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 856 | 856 | |
| 857 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 857 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 858 | 858 | |
| 859 | 859 | /** Analytics */ |
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 860 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * The class responsible for defining all actions that occur in the admin area. |
| 864 | 864 | */ |
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 866 | 866 | |
| 867 | 867 | /** |
| 868 | 868 | * The class to customize the entity list admin page. |
| 869 | 869 | */ |
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 870 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 871 | 871 | |
| 872 | 872 | /** |
| 873 | 873 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 874 | 874 | */ |
| 875 | 875 | global $wp_version; |
| 876 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 877 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 876 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 877 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 878 | 878 | } else { |
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 879 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | /** |
| 883 | 883 | * The Notice service. |
| 884 | 884 | */ |
| 885 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 885 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | 888 | * The PrimaShop adapter. |
| 889 | 889 | */ |
| 890 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 890 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * The WordLift Dashboard service. |
| 894 | 894 | */ |
| 895 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 895 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 896 | 896 | |
| 897 | 897 | /** |
| 898 | 898 | * The admin 'Install wizard' page. |
| 899 | 899 | */ |
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * The WordLift entity type list admin page controller. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 906 | 906 | |
| 907 | 907 | /** |
| 908 | 908 | * The WordLift entity type settings admin page controller. |
| 909 | 909 | */ |
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 910 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 911 | 911 | |
| 912 | 912 | /** |
| 913 | 913 | * The admin 'Download Your Data' page. |
| 914 | 914 | */ |
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 915 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 916 | 916 | |
| 917 | 917 | /** |
| 918 | 918 | * The admin 'WordLift Settings' page. |
| 919 | 919 | */ |
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 923 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 931 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 935 | 935 | |
| 936 | 936 | /** Admin Pages */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 937 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | 941 | * The class responsible for defining all actions that occur in the public-facing |
| 942 | 942 | * side of the site. |
| 943 | 943 | */ |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 945 | 945 | |
| 946 | 946 | /** |
| 947 | 947 | * The shortcode abstract class. |
| 948 | 948 | */ |
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 949 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 950 | 950 | |
| 951 | 951 | /** |
| 952 | 952 | * The Timeline shortcode. |
| 953 | 953 | */ |
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 954 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 955 | 955 | |
| 956 | 956 | /** |
| 957 | 957 | * The Navigator shortcode. |
| 958 | 958 | */ |
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 959 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 960 | 960 | |
| 961 | 961 | /** |
| 962 | 962 | * The Products Navigator shortcode. |
| 963 | 963 | */ |
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 964 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 965 | 965 | |
| 966 | 966 | /** |
| 967 | 967 | * The chord shortcode. |
| 968 | 968 | */ |
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 969 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 970 | 970 | |
| 971 | 971 | /** |
| 972 | 972 | * The geomap shortcode. |
| 973 | 973 | */ |
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 975 | 975 | |
| 976 | 976 | /** |
| 977 | 977 | * The entity cloud shortcode. |
| 978 | 978 | */ |
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 979 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 980 | 980 | |
| 981 | 981 | /** |
| 982 | 982 | * The entity glossary shortcode. |
| 983 | 983 | */ |
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 984 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 986 | 986 | |
| 987 | 987 | /** |
| 988 | 988 | * Faceted Search shortcode. |
| 989 | 989 | */ |
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 991 | 991 | |
| 992 | 992 | /** |
| 993 | 993 | * The ShareThis service. |
| 994 | 994 | */ |
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** |
| 998 | 998 | * The SEO service. |
| 999 | 999 | */ |
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1001 | 1001 | |
| 1002 | 1002 | /** |
| 1003 | 1003 | * The AMP service. |
| 1004 | 1004 | */ |
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1006 | 1006 | |
| 1007 | 1007 | /** Widgets */ |
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1009 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1008 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1009 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php'; |
|
| 1011 | 1011 | |
| 1012 | 1012 | /* |
| 1013 | 1013 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1016,18 +1016,18 @@ discard block |
||
| 1016 | 1016 | * |
| 1017 | 1017 | * @since 3.20.0 |
| 1018 | 1018 | */ |
| 1019 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1019 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1021 | 1021 | |
| 1022 | 1022 | /* |
| 1023 | 1023 | * Schema.org Services. |
| 1024 | 1024 | * |
| 1025 | 1025 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1026 | 1026 | */ |
| 1027 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1029 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1030 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1027 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 1028 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1029 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1030 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1031 | 1031 | new Wordlift_Schemaorg_Sync_Service(); |
| 1032 | 1032 | $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
| 1033 | 1033 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1043,13 +1043,13 @@ discard block |
||
| 1043 | 1043 | |
| 1044 | 1044 | // Instantiate a global logger. |
| 1045 | 1045 | global $wl_logger; |
| 1046 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1046 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1047 | 1047 | |
| 1048 | 1048 | // Load the `wl-api` end-point. |
| 1049 | 1049 | new Wordlift_Http_Api(); |
| 1050 | 1050 | |
| 1051 | 1051 | // Load the Install Service. |
| 1052 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1052 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 1053 | 1053 | $this->install_service = new Wordlift_Install_Service(); |
| 1054 | 1054 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1055 | 1055 | $this->user_service = Wordlift_User_Service::get_instance(); |
@@ -1067,21 +1067,21 @@ discard block |
||
| 1067 | 1067 | |
| 1068 | 1068 | |
| 1069 | 1069 | $that = $this; |
| 1070 | - add_action( 'plugins_loaded', function () use ( &$that, $schemaorg_property_service ) { |
|
| 1070 | + add_action('plugins_loaded', function() use (&$that, $schemaorg_property_service) { |
|
| 1071 | 1071 | |
| 1072 | 1072 | /** Services. */ |
| 1073 | 1073 | // Create the configuration service. |
| 1074 | 1074 | $api_service = new Wordlift_Api_Service(); |
| 1075 | 1075 | |
| 1076 | 1076 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1077 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1077 | + $that->entity_link_service = new Wordlift_Entity_Link_Service($that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path()); |
|
| 1078 | 1078 | |
| 1079 | 1079 | $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
| 1080 | 1080 | |
| 1081 | 1081 | $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
| 1082 | 1082 | |
| 1083 | 1083 | // Create a new instance of the Redirect service. |
| 1084 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
| 1084 | + $that->redirect_service = new Wordlift_Redirect_Service($that->entity_uri_service); |
|
| 1085 | 1085 | |
| 1086 | 1086 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1087 | 1087 | $that->timeline_service = new Wordlift_Timeline_Service(); |
@@ -1094,30 +1094,30 @@ discard block |
||
| 1094 | 1094 | // Create an instance of the PrimaShop adapter. |
| 1095 | 1095 | $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1096 | 1096 | |
| 1097 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1097 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1098 | 1098 | |
| 1099 | 1099 | // Create the entity rating service. |
| 1100 | 1100 | $that->rating_service = Wordlift_Rating_Service::get_instance(); |
| 1101 | 1101 | |
| 1102 | 1102 | // Create entity list customization (wp-admin/edit.php). |
| 1103 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
| 1103 | + $that->entity_list_service = new Wordlift_Entity_List_Service($that->rating_service); |
|
| 1104 | 1104 | |
| 1105 | 1105 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1106 | 1106 | $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
| 1107 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1108 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1107 | + $that->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1108 | + $that->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1109 | 1109 | |
| 1110 | 1110 | $attachment_service = Wordlift_Attachment_Service::get_instance(); |
| 1111 | 1111 | |
| 1112 | 1112 | // Instantiate the JSON-LD service. |
| 1113 | 1113 | $property_getter = Wordlift_Property_Getter_Factory::create(); |
| 1114 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1115 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
| 1116 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
| 1117 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1114 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service); |
|
| 1115 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter); |
|
| 1116 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter($that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter); |
|
| 1117 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service); |
|
| 1118 | 1118 | |
| 1119 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1120 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
| 1119 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1120 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($that->postid_to_jsonld_converter, $jsonld_cache); |
|
| 1121 | 1121 | /* |
| 1122 | 1122 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1123 | 1123 | * |
@@ -1125,31 +1125,31 @@ discard block |
||
| 1125 | 1125 | * |
| 1126 | 1126 | * @since 3.20.0 |
| 1127 | 1127 | */ |
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1128 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1129 | 1129 | |
| 1130 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
| 1131 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
| 1130 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($that->entity_uri_service, $that->cached_postid_to_jsonld_converter); |
|
| 1131 | + $that->jsonld_service = new Wordlift_Jsonld_Service(Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter); |
|
| 1132 | 1132 | |
| 1133 | 1133 | $jsonld_service = new Jsonld_Service( |
| 1134 | 1134 | $that->jsonld_service, |
| 1135 | 1135 | $term_jsonld_adapter, |
| 1136 | - new Jsonld_User_Service( $that->user_service ) ); |
|
| 1137 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
| 1136 | + new Jsonld_User_Service($that->user_service) ); |
|
| 1137 | + new Jsonld_Endpoint($jsonld_service, $that->entity_uri_service); |
|
| 1138 | 1138 | |
| 1139 | 1139 | // Prints the JSON-LD in the head. |
| 1140 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
| 1140 | + new Jsonld_Adapter($that->jsonld_service); |
|
| 1141 | 1141 | |
| 1142 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
| 1142 | + new Jsonld_By_Id_Endpoint($that->jsonld_service, $that->entity_uri_service); |
|
| 1143 | 1143 | |
| 1144 | 1144 | $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
| 1145 | 1145 | $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
| 1146 | 1146 | // Creating Faq Content filter service. |
| 1147 | 1147 | $that->faq_content_filter_service = new Faq_Content_Filter(); |
| 1148 | 1148 | $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
| 1149 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
| 1149 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($that->sample_data_service); |
|
| 1150 | 1150 | |
| 1151 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
| 1152 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
| 1151 | + $that->loader->add_action('enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks'); |
|
| 1152 | + $that->loader->add_action('admin_enqueue_scripts', $that, 'add_wl_enabled_blocks'); |
|
| 1153 | 1153 | |
| 1154 | 1154 | /** |
| 1155 | 1155 | * Filter: wl_feature__enable__blocks. |
@@ -1159,15 +1159,15 @@ discard block |
||
| 1159 | 1159 | * @return bool |
| 1160 | 1160 | * @since 3.27.6 |
| 1161 | 1161 | */ |
| 1162 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1162 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1163 | 1163 | // Initialize the short-codes. |
| 1164 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1164 | + new Async_Template_Decorator(new Wordlift_Navigator_Shortcode()); |
|
| 1165 | 1165 | new Wordlift_Chord_Shortcode(); |
| 1166 | 1166 | new Wordlift_Geomap_Shortcode(); |
| 1167 | 1167 | new Wordlift_Timeline_Shortcode(); |
| 1168 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
| 1168 | + new Wordlift_Related_Entities_Cloud_Shortcode(Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance()); |
|
| 1169 | 1169 | new Wordlift_Vocabulary_Shortcode(); |
| 1170 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1170 | + new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode()); |
|
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | new Wordlift_Products_Navigator_Shortcode(); |
@@ -1180,16 +1180,16 @@ discard block |
||
| 1180 | 1180 | new Wordlift_Seo_Service(); |
| 1181 | 1181 | |
| 1182 | 1182 | // Initialize the AMP service. |
| 1183 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
| 1183 | + new Wordlift_AMP_Service($that->jsonld_service); |
|
| 1184 | 1184 | |
| 1185 | 1185 | /** Services. */ |
| 1186 | 1186 | $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1187 | 1187 | new Wordlift_Image_Service(); |
| 1188 | 1188 | |
| 1189 | 1189 | /** Adapters. */ |
| 1190 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1191 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
| 1192 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
| 1190 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter(Wordlift_Entity_Type_Service::get_instance()); |
|
| 1191 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($that->publisher_service); |
|
| 1192 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter($that); |
|
| 1193 | 1193 | |
| 1194 | 1194 | /* |
| 1195 | 1195 | * Exclude our public js from WP-Rocket. |
@@ -1209,14 +1209,14 @@ discard block |
||
| 1209 | 1209 | $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1210 | 1210 | $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1211 | 1211 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1212 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
| 1213 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
| 1212 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element($that->publisher_service, $tabs_element, $that->select2_element); |
|
| 1213 | + $that->author_element = new Wordlift_Admin_Author_Element($that->publisher_service, $that->select2_element); |
|
| 1214 | 1214 | |
| 1215 | 1215 | $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
| 1216 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
| 1216 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($that->settings_page); |
|
| 1217 | 1217 | |
| 1218 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
| 1219 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
| 1218 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($that->input_element, $that->radio_input_element); |
|
| 1219 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($that->analytics_settings_page); |
|
| 1220 | 1220 | $that->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1221 | 1221 | |
| 1222 | 1222 | // Pages. |
@@ -1227,9 +1227,9 @@ discard block |
||
| 1227 | 1227 | * |
| 1228 | 1228 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1229 | 1229 | */ |
| 1230 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1231 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1232 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
| 1230 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1231 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1232 | + new Wordlift_Admin_Post_Edit_Page($that); |
|
| 1233 | 1233 | } |
| 1234 | 1234 | new Wordlift_Entity_Type_Admin_Service(); |
| 1235 | 1235 | |
@@ -1237,19 +1237,19 @@ discard block |
||
| 1237 | 1237 | $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1238 | 1238 | |
| 1239 | 1239 | // Create an instance of the install wizard. |
| 1240 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
| 1240 | + $that->admin_setup = new Wordlift_Admin_Setup($that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element); |
|
| 1241 | 1241 | |
| 1242 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
| 1242 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($that->entity_post_type_service); |
|
| 1243 | 1243 | |
| 1244 | 1244 | // User Profile. |
| 1245 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
| 1245 | + new Wordlift_Admin_User_Profile_Page($that->author_element, $that->user_service); |
|
| 1246 | 1246 | |
| 1247 | 1247 | $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1248 | 1248 | |
| 1249 | 1249 | // Load the debug service if WP is in debug mode. |
| 1250 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1251 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1252 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
| 1250 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1251 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1252 | + new Wordlift_Debug_Service(Wordlift_Entity_Service::get_instance(), $uri_service); |
|
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | 1255 | // Remote Image Service. |
@@ -1262,12 +1262,12 @@ discard block |
||
| 1262 | 1262 | * |
| 1263 | 1263 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1264 | 1264 | */ |
| 1265 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1266 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1267 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1265 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1266 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1267 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1268 | 1268 | |
| 1269 | 1269 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1270 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1270 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1271 | 1271 | |
| 1272 | 1272 | /* |
| 1273 | 1273 | * Load the Mappings JSON-LD post processing. |
@@ -1281,11 +1281,11 @@ discard block |
||
| 1281 | 1281 | // Taxonomy term rule validator for validating rules for term pages. |
| 1282 | 1282 | new Taxonomy_Term_Rule_Validator(); |
| 1283 | 1283 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1284 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1285 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1286 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1284 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1285 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1286 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1287 | 1287 | |
| 1288 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
| 1288 | + new Url_To_Entity_Transform_Function($that->entity_uri_service); |
|
| 1289 | 1289 | new Taxonomy_To_Terms_Transform_Function(); |
| 1290 | 1290 | new Post_Id_To_Entity_Transform_Function(); |
| 1291 | 1291 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | * Intiailize the acf group data formatter. |
| 1296 | 1296 | */ |
| 1297 | 1297 | new Acf_Group_Formatter(); |
| 1298 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1298 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1299 | 1299 | |
| 1300 | 1300 | /** |
| 1301 | 1301 | * @since 3.26.0 |
@@ -1313,14 +1313,14 @@ discard block |
||
| 1313 | 1313 | // Call this static method to register FAQ routes to rest api - disabled |
| 1314 | 1314 | //Faq_Rest_Controller::register_routes(); |
| 1315 | 1315 | |
| 1316 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
| 1316 | + $that->storage_factory = new Wordlift_Storage_Factory(Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter); |
|
| 1317 | 1317 | |
| 1318 | 1318 | /** WL Autocomplete. */ |
| 1319 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1319 | + $autocomplete_service = new All_Autocomplete_Service(array( |
|
| 1320 | 1320 | new Local_Autocomplete_Service(), |
| 1321 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
| 1322 | - ) ); |
|
| 1323 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1321 | + new Linked_Data_Autocomplete_Service(Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance()), |
|
| 1322 | + )); |
|
| 1323 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1324 | 1324 | |
| 1325 | 1325 | /** |
| 1326 | 1326 | * @since 3.27.2 |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | */ |
| 1330 | 1330 | new Recipe_Maker_Post_Type_Hook(); |
| 1331 | 1331 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
| 1332 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1333 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1334 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
| 1335 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1332 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
| 1333 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
| 1334 | + new Recipe_Maker_Jsonld_Swap($recipe_maker_validation_service, $that->jsonld_service); |
|
| 1335 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
| 1336 | 1336 | |
| 1337 | 1337 | |
| 1338 | 1338 | /** |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | * @since 3.27.8 |
| 1351 | 1351 | * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
| 1352 | 1352 | */ |
| 1353 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
| 1353 | + new Key_Validation_Notice($that->key_validation_service, Wordlift_Configuration_Service::get_instance()); |
|
| 1354 | 1354 | /** |
| 1355 | 1355 | * @since 3.28.0 |
| 1356 | 1356 | * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | * @since 3.29.0 |
| 1362 | 1362 | * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
| 1363 | 1363 | */ |
| 1364 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1364 | + new Entity_Rest_Service(Wordlift_Entity_Type_Service::get_instance()); |
|
| 1365 | 1365 | |
| 1366 | 1366 | /** |
| 1367 | 1367 | * Expand author in to references. |
@@ -1370,12 +1370,12 @@ discard block |
||
| 1370 | 1370 | */ |
| 1371 | 1371 | |
| 1372 | 1372 | |
| 1373 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1374 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1373 | + if (apply_filters('wl_feature__enable__article-wrapper', false)) { |
|
| 1374 | + new Jsonld_Article_Wrapper(Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter); |
|
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | 1377 | |
| 1378 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1378 | + if (apply_filters('wl_feature__enable__match-terms', false)) { |
|
| 1379 | 1379 | $vocabulary_loader = new Vocabulary_Loader(); |
| 1380 | 1380 | $vocabulary_loader->init_vocabulary(); |
| 1381 | 1381 | } |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | /** |
| 1384 | 1384 | *Added for feature request 1496 (Webhooks) |
| 1385 | 1385 | */ |
| 1386 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
| 1386 | + if (apply_filters('wl_feature__enable__webhooks', false)) { |
|
| 1387 | 1387 | $that->webhook_loader = new Webhooks_Loader(); |
| 1388 | 1388 | $that->webhook_loader->init(); |
| 1389 | 1389 | } |
@@ -1412,7 +1412,7 @@ discard block |
||
| 1412 | 1412 | * @since 3.31.5 |
| 1413 | 1413 | * Create configuration endpoint for webapp to configure. |
| 1414 | 1414 | */ |
| 1415 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
| 1415 | + new Config($that->admin_setup, $that->key_validation_service); |
|
| 1416 | 1416 | /** |
| 1417 | 1417 | * @since 3.31.7 |
| 1418 | 1418 | * Remove duplicate videoobject. |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | * @since 3.32.0 |
| 1425 | 1425 | * Create loader for vocabulary terms. |
| 1426 | 1426 | */ |
| 1427 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
| 1427 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader(Wordlift_Entity_Type_Service::get_instance(), $property_getter); |
|
| 1428 | 1428 | $vocabulary_terms_loader->init_feature(); |
| 1429 | 1429 | |
| 1430 | 1430 | new Entity_Type_Change_Handler( |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | Wordlift_Entity_Type_Service::get_instance() |
| 1433 | 1433 | ); |
| 1434 | 1434 | |
| 1435 | - }, 3 ); |
|
| 1435 | + }, 3); |
|
| 1436 | 1436 | |
| 1437 | 1437 | |
| 1438 | 1438 | new Entity_Type_Setter(); |
@@ -1452,9 +1452,9 @@ discard block |
||
| 1452 | 1452 | private function set_locale() { |
| 1453 | 1453 | |
| 1454 | 1454 | $plugin_i18n = new Wordlift_i18n(); |
| 1455 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1455 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1456 | 1456 | |
| 1457 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1457 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1458 | 1458 | |
| 1459 | 1459 | } |
| 1460 | 1460 | |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | * @since 1.0.0 |
| 1466 | 1466 | * @access private |
| 1467 | 1467 | */ |
| 1468 | - private function define_admin_hooks( $that ) { |
|
| 1468 | + private function define_admin_hooks($that) { |
|
| 1469 | 1469 | $plugin_admin = new |
| 1470 | 1470 | Wordlift_Admin( |
| 1471 | 1471 | $that->get_plugin_name(), |
@@ -1474,64 +1474,64 @@ discard block |
||
| 1474 | 1474 | $that->user_service |
| 1475 | 1475 | ); |
| 1476 | 1476 | |
| 1477 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1478 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1477 | + $that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1478 | + $that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1479 | 1479 | |
| 1480 | 1480 | // Hook the `admin_init` function to the Admin Setup. |
| 1481 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
| 1482 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
| 1481 | + Assertions::is_set($that->admin_setup, '`admin_setup` must be set'); |
|
| 1482 | + $that->loader->add_action('admin_init', $that->admin_setup, 'admin_init'); |
|
| 1483 | 1483 | |
| 1484 | 1484 | // Hook the admin_init to the settings page. |
| 1485 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
| 1486 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
| 1485 | + Assertions::is_set($that->settings_page, '`setting_page` must be set'); |
|
| 1486 | + $that->loader->add_action('admin_init', $that->settings_page, 'admin_init'); |
|
| 1487 | 1487 | |
| 1488 | 1488 | // Hook the admin_init to the analytics settings page. |
| 1489 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
| 1490 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
| 1489 | + Assertions::is_set($that->analytics_settings_page, '`analytics_setting_page` must be set'); |
|
| 1490 | + $that->loader->add_action('admin_init', $that->analytics_settings_page, 'admin_init'); |
|
| 1491 | 1491 | |
| 1492 | 1492 | // Hook the init action to taxonomy services. |
| 1493 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
| 1494 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1493 | + $that->loader->add_action('init', $that->topic_taxonomy_service, 'init', 0); |
|
| 1494 | + $that->loader->add_action('init', $that->entity_types_taxonomy_service, 'init', 0); |
|
| 1495 | 1495 | |
| 1496 | 1496 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1497 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1497 | + $that->loader->add_action('wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline'); |
|
| 1498 | 1498 | |
| 1499 | 1499 | // Register custom allowed redirect hosts. |
| 1500 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1500 | + $that->loader->add_filter('allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts'); |
|
| 1501 | 1501 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1502 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
| 1502 | + $that->loader->add_action('wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect'); |
|
| 1503 | 1503 | |
| 1504 | 1504 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1505 | 1505 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1506 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3 ); |
|
| 1507 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1506 | + $that->loader->add_action('save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3); |
|
| 1507 | + $that->loader->add_action('save_post', $that->rating_service, 'set_rating_for', 20, 1); |
|
| 1508 | 1508 | |
| 1509 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
| 1510 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
| 1509 | + $that->loader->add_action('edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1); |
|
| 1510 | + $that->loader->add_action('in_admin_header', $that->rating_service, 'in_admin_header'); |
|
| 1511 | 1511 | |
| 1512 | 1512 | // Entity listing customization (wp-admin/edit.php) |
| 1513 | 1513 | // Add custom columns. |
| 1514 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
| 1514 | + $that->loader->add_filter('manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns'); |
|
| 1515 | 1515 | // no explicit entity as it prevents handling of other post types. |
| 1516 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1516 | + $that->loader->add_filter('manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1517 | 1517 | // Add 4W selection. |
| 1518 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1519 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1520 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
| 1521 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
| 1518 | + $that->loader->add_action('restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1519 | + $that->loader->add_filter('posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1520 | + $that->loader->add_action('pre_get_posts', $that->entity_list_service, 'pre_get_posts'); |
|
| 1521 | + $that->loader->add_action('load-edit.php', $that->entity_list_service, 'load_edit'); |
|
| 1522 | 1522 | |
| 1523 | 1523 | /* |
| 1524 | 1524 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1525 | 1525 | * |
| 1526 | 1526 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1527 | 1527 | */ |
| 1528 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1529 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1528 | + if ( ! apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 1529 | + $that->loader->add_filter('wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1533 | 1533 | // entities. |
| 1534 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1534 | + $that->loader->add_filter('prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1535 | 1535 | |
| 1536 | 1536 | /** |
| 1537 | 1537 | * Filter: wl_feature__enable__settings-download. |
@@ -1541,27 +1541,27 @@ discard block |
||
| 1541 | 1541 | * @return bool |
| 1542 | 1542 | * @since 3.27.6 |
| 1543 | 1543 | */ |
| 1544 | - $that->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1544 | + $that->features_registry->register_feature_from_slug('settings-download', true, array( |
|
| 1545 | 1545 | $that, |
| 1546 | 1546 | 'register_screens' |
| 1547 | - ) ); |
|
| 1547 | + )); |
|
| 1548 | 1548 | |
| 1549 | 1549 | |
| 1550 | 1550 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1551 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
| 1551 | + $that->loader->add_action('wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10); |
|
| 1552 | 1552 | |
| 1553 | 1553 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1554 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1555 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1556 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1554 | + $that->loader->add_action('wp_ajax_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1555 | + $that->loader->add_action('admin_post_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1556 | + $that->loader->add_action('admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1557 | 1557 | |
| 1558 | 1558 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1559 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
| 1559 | + $that->loader->add_action('wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key'); |
|
| 1560 | 1560 | |
| 1561 | 1561 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1562 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
| 1562 | + $that->loader->add_action('wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html'); |
|
| 1563 | 1563 | |
| 1564 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
| 1564 | + $that->loader->add_filter('admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction'); |
|
| 1565 | 1565 | |
| 1566 | 1566 | // Hook the menu creation on the general wordlift menu creation. |
| 1567 | 1567 | /** |
@@ -1574,16 +1574,16 @@ discard block |
||
| 1574 | 1574 | * |
| 1575 | 1575 | * Since 3.30.0 this feature is registered using registry. |
| 1576 | 1576 | */ |
| 1577 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1578 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1577 | + if (apply_filters('wl_feature__enable__settings-screen', true) || Admin_User_Option::is_wordlift_admin()) { |
|
| 1578 | + add_action('wl_admin_menu', array($that->settings_page, 'admin_menu'), 10, 2); |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | // Hook key update. |
| 1582 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1583 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
| 1582 | + $that->loader->add_action('pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2); |
|
| 1583 | + $that->loader->add_action('update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2); |
|
| 1584 | 1584 | |
| 1585 | 1585 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1586 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1586 | + $that->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1); |
|
| 1587 | 1587 | |
| 1588 | 1588 | /* |
| 1589 | 1589 | * Remove the Analytics Settings link from the plugin page. |
@@ -1594,23 +1594,23 @@ discard block |
||
| 1594 | 1594 | // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1595 | 1595 | |
| 1596 | 1596 | // Hook the AJAX `wl_publisher` action name. |
| 1597 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
| 1597 | + $that->loader->add_action('wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher'); |
|
| 1598 | 1598 | |
| 1599 | 1599 | // Hook row actions for the entity type list admin. |
| 1600 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1600 | + $that->loader->add_filter('wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1601 | 1601 | |
| 1602 | 1602 | /** Ajax actions. */ |
| 1603 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
| 1603 | + $that->loader->add_action('wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export'); |
|
| 1604 | 1604 | |
| 1605 | 1605 | // Hook capabilities manipulation to allow access to entity type admin |
| 1606 | 1606 | // page on WordPress versions before 4.7. |
| 1607 | 1607 | global $wp_version; |
| 1608 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1609 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1608 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1609 | + $that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | /** Adapters. */ |
| 1613 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1613 | + $that->loader->add_filter('mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1614 | 1614 | /** |
| 1615 | 1615 | * Disabling Faq temporarily. |
| 1616 | 1616 | * Load the tinymce editor button on the tool bar. |
@@ -1621,54 +1621,54 @@ discard block |
||
| 1621 | 1621 | //$that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
| 1622 | 1622 | |
| 1623 | 1623 | |
| 1624 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
| 1625 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
| 1624 | + $that->loader->add_action('wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create'); |
|
| 1625 | + $that->loader->add_action('wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete'); |
|
| 1626 | 1626 | |
| 1627 | 1627 | /** |
| 1628 | 1628 | * @since 3.26.0 |
| 1629 | 1629 | */ |
| 1630 | 1630 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
| 1631 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1631 | + $that->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
| 1632 | 1632 | // Adding Rest route for the post excerpt |
| 1633 | 1633 | Post_Excerpt_Rest_Controller::register_routes(); |
| 1634 | 1634 | |
| 1635 | 1635 | // Handle the autocomplete request. |
| 1636 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1636 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1637 | 1637 | $that->autocomplete_adapter, |
| 1638 | 1638 | 'wl_autocomplete', |
| 1639 | - ) ); |
|
| 1640 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1639 | + )); |
|
| 1640 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1641 | 1641 | $that->autocomplete_adapter, |
| 1642 | 1642 | 'wl_autocomplete', |
| 1643 | - ) ); |
|
| 1643 | + )); |
|
| 1644 | 1644 | |
| 1645 | 1645 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1646 | - if ( is_multisite() ) { |
|
| 1647 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1646 | + if (is_multisite()) { |
|
| 1647 | + $that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
| 1651 | 1651 | |
| 1652 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1653 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1654 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( |
|
| 1652 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1653 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1654 | + add_action('wp_ajax_wl_deactivation_feedback', array( |
|
| 1655 | 1655 | $deactivator_feedback, |
| 1656 | 1656 | 'wl_deactivation_feedback' |
| 1657 | - ) ); |
|
| 1657 | + )); |
|
| 1658 | 1658 | |
| 1659 | 1659 | /** |
| 1660 | 1660 | * Always allow the `wordlift/classification` block. |
| 1661 | 1661 | * |
| 1662 | 1662 | * @since 3.23.0 |
| 1663 | 1663 | */ |
| 1664 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1664 | + add_filter('allowed_block_types', function($value) { |
|
| 1665 | 1665 | |
| 1666 | - if ( true === $value ) { |
|
| 1666 | + if (true === $value) { |
|
| 1667 | 1667 | return $value; |
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1671 | - }, PHP_INT_MAX ); |
|
| 1670 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1671 | + }, PHP_INT_MAX); |
|
| 1672 | 1672 | |
| 1673 | 1673 | /** |
| 1674 | 1674 | * @since 3.27.7 |
@@ -1685,59 +1685,59 @@ discard block |
||
| 1685 | 1685 | * @since 1.0.0 |
| 1686 | 1686 | * @access private |
| 1687 | 1687 | */ |
| 1688 | - private function define_public_hooks( $that ) { |
|
| 1688 | + private function define_public_hooks($that) { |
|
| 1689 | 1689 | |
| 1690 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
| 1690 | + $plugin_public = new Wordlift_Public($that->get_plugin_name(), $that->get_version()); |
|
| 1691 | 1691 | |
| 1692 | 1692 | // Register the entity post type. |
| 1693 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
| 1693 | + $that->loader->add_action('init', $that->entity_post_type_service, 'register'); |
|
| 1694 | 1694 | |
| 1695 | 1695 | // Bind the link generation and handling hooks to the entity link service. |
| 1696 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1697 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1696 | + $that->loader->add_filter('post_type_link', $that->entity_link_service, 'post_type_link', 10, 4); |
|
| 1697 | + $that->loader->add_action('pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1698 | 1698 | // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
| 1699 | 1699 | // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
| 1700 | 1700 | |
| 1701 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1702 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1703 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
| 1701 | + $that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1702 | + $that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1703 | + $that->loader->add_action('wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts'); |
|
| 1704 | 1704 | |
| 1705 | 1705 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
| 1706 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1706 | + $that->loader->add_filter('the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
| 1707 | 1707 | // Hook the content filter service to add entity links. |
| 1708 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1708 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1709 | 1709 | // We run before other filters. |
| 1710 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
| 1710 | + $that->loader->add_filter('the_content', $that->content_filter_service, 'the_content', 9); |
|
| 1711 | 1711 | } |
| 1712 | 1712 | |
| 1713 | 1713 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1714 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1714 | + $that->loader->add_action('wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline'); |
|
| 1715 | 1715 | |
| 1716 | 1716 | // Hook the ShareThis service. |
| 1717 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
| 1718 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
| 1717 | + $that->loader->add_filter('the_content', $that->sharethis_service, 'the_content', 99); |
|
| 1718 | + $that->loader->add_filter('the_excerpt', $that->sharethis_service, 'the_excerpt', 99); |
|
| 1719 | 1719 | |
| 1720 | 1720 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1721 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1721 | + $that->loader->add_action('wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1722 | 1722 | |
| 1723 | 1723 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1724 | 1724 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1725 | 1725 | // to categories. |
| 1726 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1726 | + $that->loader->add_action('pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1727 | 1727 | |
| 1728 | 1728 | /* |
| 1729 | 1729 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1730 | 1730 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1731 | 1731 | * order of start time. |
| 1732 | 1732 | */ |
| 1733 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1733 | + $that->loader->add_action('pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1734 | 1734 | |
| 1735 | 1735 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1736 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1736 | + $that->loader->add_action('save_post', $that->entity_type_adapter, 'save_post', 9, 3); |
|
| 1737 | 1737 | |
| 1738 | 1738 | // Analytics Script Frontend. |
| 1739 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
| 1740 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1739 | + if (apply_filters('wl_feature__enable__analytics', true) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable()) { |
|
| 1740 | + $that->loader->add_action('wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10); |
|
| 1741 | 1741 | } |
| 1742 | 1742 | |
| 1743 | 1743 | } |
@@ -1802,7 +1802,7 @@ discard block |
||
| 1802 | 1802 | * @since 3.27.6 |
| 1803 | 1803 | */ |
| 1804 | 1804 | |
| 1805 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1805 | + wp_register_script('wl_enabled_blocks', false); |
|
| 1806 | 1806 | |
| 1807 | 1807 | $enabled_blocks = array(); |
| 1808 | 1808 | |
@@ -1810,13 +1810,13 @@ discard block |
||
| 1810 | 1810 | * Filter name: wl_feature__enable__product-navigator |
| 1811 | 1811 | * @since 3.32.3 |
| 1812 | 1812 | */ |
| 1813 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
| 1813 | + if (apply_filters('wl_feature__enable__product-navigator', true)) { |
|
| 1814 | 1814 | $enabled_blocks[] = 'wordlift/products-navigator'; |
| 1815 | 1815 | } |
| 1816 | 1816 | |
| 1817 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1817 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1818 | 1818 | // To intimate JS |
| 1819 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 1819 | + $enabled_blocks = array_merge($enabled_blocks, array( |
|
| 1820 | 1820 | 'wordlift/navigator', |
| 1821 | 1821 | 'wordlift/chord', |
| 1822 | 1822 | 'wordlift/geomap', |
@@ -1824,11 +1824,11 @@ discard block |
||
| 1824 | 1824 | 'wordlift/cloud', |
| 1825 | 1825 | 'wordlift/vocabulary', |
| 1826 | 1826 | 'wordlift/faceted-search' |
| 1827 | - ) ); |
|
| 1827 | + )); |
|
| 1828 | 1828 | } |
| 1829 | 1829 | |
| 1830 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1831 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1830 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
| 1831 | + wp_enqueue_script('wl_enabled_blocks'); |
|
| 1832 | 1832 | } |
| 1833 | 1833 | |
| 1834 | 1834 | /** |
@@ -1836,13 +1836,13 @@ discard block |
||
| 1836 | 1836 | */ |
| 1837 | 1837 | public function register_screens() { |
| 1838 | 1838 | // Hook the menu to the Download Your Data page. |
| 1839 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 1840 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
| 1841 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 1839 | + if (apply_filters('wl_feature__enable__settings-download', true)) { |
|
| 1840 | + Assertions::is_set($this->download_your_data_page, "`download_your_data_page` can't be null"); |
|
| 1841 | + add_action('admin_menu', array($this->download_your_data_page, 'admin_menu'), 100, 0); |
|
| 1842 | 1842 | } |
| 1843 | 1843 | |
| 1844 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
| 1845 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 1844 | + Assertions::is_set($this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null"); |
|
| 1845 | + add_action('admin_menu', array($this->entity_type_settings_admin_page, 'admin_menu'), 100, 0); |
|
| 1846 | 1846 | |
| 1847 | 1847 | } |
| 1848 | 1848 | |
@@ -82,1768 +82,1768 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | class Wordlift { |
| 84 | 84 | |
| 85 | - //<editor-fold desc="## FIELDS"> |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 89 | - * the plugin. |
|
| 90 | - * |
|
| 91 | - * @since 1.0.0 |
|
| 92 | - * @access protected |
|
| 93 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 94 | - */ |
|
| 95 | - protected $loader; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * The unique identifier of this plugin. |
|
| 99 | - * |
|
| 100 | - * @since 1.0.0 |
|
| 101 | - * @access protected |
|
| 102 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 103 | - */ |
|
| 104 | - protected $plugin_name; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * The current version of the plugin. |
|
| 108 | - * |
|
| 109 | - * @since 1.0.0 |
|
| 110 | - * @access protected |
|
| 111 | - * @var string $version The current version of the plugin. |
|
| 112 | - */ |
|
| 113 | - protected $version; |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 117 | - * |
|
| 118 | - * @since 3.12.0 |
|
| 119 | - * @access protected |
|
| 120 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 121 | - */ |
|
| 122 | - protected $tinymce_adapter; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * The Schema service. |
|
| 126 | - * |
|
| 127 | - * @since 3.3.0 |
|
| 128 | - * @access protected |
|
| 129 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 130 | - */ |
|
| 131 | - protected $schema_service; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * The Topic Taxonomy service. |
|
| 135 | - * |
|
| 136 | - * @since 3.5.0 |
|
| 137 | - * @access private |
|
| 138 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 139 | - */ |
|
| 140 | - private $topic_taxonomy_service; |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * The Entity Types Taxonomy service. |
|
| 144 | - * |
|
| 145 | - * @since 3.18.0 |
|
| 146 | - * @access private |
|
| 147 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 148 | - */ |
|
| 149 | - private $entity_types_taxonomy_service; |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * The User service. |
|
| 153 | - * |
|
| 154 | - * @since 3.1.7 |
|
| 155 | - * @access protected |
|
| 156 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 157 | - */ |
|
| 158 | - protected $user_service; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The Timeline service. |
|
| 162 | - * |
|
| 163 | - * @since 3.1.0 |
|
| 164 | - * @access private |
|
| 165 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 166 | - */ |
|
| 167 | - private $timeline_service; |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * The Redirect service. |
|
| 171 | - * |
|
| 172 | - * @since 3.2.0 |
|
| 173 | - * @access private |
|
| 174 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 175 | - */ |
|
| 176 | - private $redirect_service; |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * The Notice service. |
|
| 180 | - * |
|
| 181 | - * @since 3.3.0 |
|
| 182 | - * @access private |
|
| 183 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 184 | - */ |
|
| 185 | - private $notice_service; |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * The Entity list customization. |
|
| 189 | - * |
|
| 190 | - * @since 3.3.0 |
|
| 191 | - * @access protected |
|
| 192 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 193 | - */ |
|
| 194 | - protected $entity_list_service; |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * The Entity Types Taxonomy Walker. |
|
| 198 | - * |
|
| 199 | - * @since 3.1.0 |
|
| 200 | - * @access private |
|
| 201 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 202 | - */ |
|
| 203 | - private $entity_types_taxonomy_walker; |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * The ShareThis service. |
|
| 207 | - * |
|
| 208 | - * @since 3.2.0 |
|
| 209 | - * @access private |
|
| 210 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 211 | - */ |
|
| 212 | - private $sharethis_service; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * The PrimaShop adapter. |
|
| 216 | - * |
|
| 217 | - * @since 3.2.3 |
|
| 218 | - * @access private |
|
| 219 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 220 | - */ |
|
| 221 | - private $primashop_adapter; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * The entity type service. |
|
| 225 | - * |
|
| 226 | - * @since 3.6.0 |
|
| 227 | - * @access private |
|
| 228 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 229 | - */ |
|
| 230 | - private $entity_post_type_service; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 234 | - * |
|
| 235 | - * @since 3.6.0 |
|
| 236 | - * @access private |
|
| 237 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 238 | - */ |
|
| 239 | - private $entity_link_service; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 243 | - * |
|
| 244 | - * @since 3.7.0 |
|
| 245 | - * @access protected |
|
| 246 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 247 | - */ |
|
| 248 | - protected $jsonld_service; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 252 | - * |
|
| 253 | - * @since 3.14.0 |
|
| 254 | - * @access protected |
|
| 255 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 256 | - */ |
|
| 257 | - protected $jsonld_website_converter; |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 261 | - * |
|
| 262 | - * @since 3.7.0 |
|
| 263 | - * @access private |
|
| 264 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 265 | - */ |
|
| 266 | - private $property_factory; |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * The 'Download Your Data' page. |
|
| 270 | - * |
|
| 271 | - * @since 3.6.0 |
|
| 272 | - * @access private |
|
| 273 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 274 | - */ |
|
| 275 | - private $download_your_data_page; |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * The 'WordLift Settings' page. |
|
| 279 | - * |
|
| 280 | - * @since 3.11.0 |
|
| 281 | - * @access protected |
|
| 282 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 283 | - */ |
|
| 284 | - protected $settings_page; |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * The install wizard page. |
|
| 288 | - * |
|
| 289 | - * @since 3.9.0 |
|
| 290 | - * @access private |
|
| 291 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 292 | - */ |
|
| 293 | - public $admin_setup; |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 297 | - * linking of entities to their pages. |
|
| 298 | - * |
|
| 299 | - * @since 3.8.0 |
|
| 300 | - * @access private |
|
| 301 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 302 | - */ |
|
| 303 | - private $content_filter_service; |
|
| 304 | - |
|
| 305 | - /** |
|
| 306 | - * The Faq Content filter service |
|
| 307 | - * @since 3.26.0 |
|
| 308 | - * @access private |
|
| 309 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 310 | - */ |
|
| 311 | - private $faq_content_filter_service; |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 315 | - * |
|
| 316 | - * @since 3.9.0 |
|
| 317 | - * @access private |
|
| 318 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 319 | - */ |
|
| 320 | - private $key_validation_service; |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 324 | - * |
|
| 325 | - * @since 3.10.0 |
|
| 326 | - * @access private |
|
| 327 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 328 | - */ |
|
| 329 | - private $rating_service; |
|
| 330 | - |
|
| 331 | - /** |
|
| 332 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 333 | - * |
|
| 334 | - * @since 3.10.0 |
|
| 335 | - * @access protected |
|
| 336 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 337 | - */ |
|
| 338 | - protected $post_to_jsonld_converter; |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * A {@link Wordlift_Install_Service} instance. |
|
| 342 | - * |
|
| 343 | - * @since 3.18.0 |
|
| 344 | - * @access protected |
|
| 345 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 346 | - */ |
|
| 347 | - protected $install_service; |
|
| 348 | - |
|
| 349 | - /** |
|
| 350 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 351 | - * |
|
| 352 | - * @since 3.10.0 |
|
| 353 | - * @access protected |
|
| 354 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 355 | - */ |
|
| 356 | - protected $entity_post_to_jsonld_converter; |
|
| 357 | - |
|
| 358 | - /** |
|
| 359 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 360 | - * |
|
| 361 | - * @since 3.10.0 |
|
| 362 | - * @access protected |
|
| 363 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 364 | - */ |
|
| 365 | - protected $postid_to_jsonld_converter; |
|
| 366 | - |
|
| 367 | - /** |
|
| 368 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 369 | - * |
|
| 370 | - * @since 3.11.0 |
|
| 371 | - * @access protected |
|
| 372 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 373 | - */ |
|
| 374 | - protected $category_taxonomy_service; |
|
| 375 | - |
|
| 376 | - /** |
|
| 377 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 378 | - * |
|
| 379 | - * @since 3.11.0 |
|
| 380 | - * @access protected |
|
| 381 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 382 | - */ |
|
| 383 | - protected $entity_page_service; |
|
| 384 | - |
|
| 385 | - /** |
|
| 386 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 387 | - * |
|
| 388 | - * @since 3.11.0 |
|
| 389 | - * @access protected |
|
| 390 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 391 | - */ |
|
| 392 | - protected $settings_page_action_link; |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 396 | - * |
|
| 397 | - * @since 3.11.0 |
|
| 398 | - * @access protected |
|
| 399 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 400 | - */ |
|
| 401 | - protected $analytics_settings_page_action_link; |
|
| 402 | - |
|
| 403 | - /** |
|
| 404 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 405 | - * |
|
| 406 | - * @since 3.11.0 |
|
| 407 | - * @access protected |
|
| 408 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 409 | - */ |
|
| 410 | - protected $analytics_connect; |
|
| 411 | - |
|
| 412 | - /** |
|
| 413 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 414 | - * |
|
| 415 | - * @since 3.11.0 |
|
| 416 | - * @access protected |
|
| 417 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 418 | - */ |
|
| 419 | - protected $publisher_ajax_adapter; |
|
| 420 | - |
|
| 421 | - /** |
|
| 422 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 423 | - * |
|
| 424 | - * @since 3.11.0 |
|
| 425 | - * @access protected |
|
| 426 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 427 | - */ |
|
| 428 | - protected $input_element; |
|
| 429 | - |
|
| 430 | - /** |
|
| 431 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 432 | - * |
|
| 433 | - * @since 3.13.0 |
|
| 434 | - * @access protected |
|
| 435 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 436 | - */ |
|
| 437 | - protected $radio_input_element; |
|
| 438 | - |
|
| 439 | - /** |
|
| 440 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 441 | - * |
|
| 442 | - * @since 3.11.0 |
|
| 443 | - * @access protected |
|
| 444 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 445 | - */ |
|
| 446 | - protected $language_select_element; |
|
| 447 | - |
|
| 448 | - /** |
|
| 449 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 450 | - * |
|
| 451 | - * @since 3.18.0 |
|
| 452 | - * @access protected |
|
| 453 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 454 | - */ |
|
| 455 | - protected $country_select_element; |
|
| 456 | - |
|
| 457 | - /** |
|
| 458 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 459 | - * |
|
| 460 | - * @since 3.11.0 |
|
| 461 | - * @access protected |
|
| 462 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 463 | - */ |
|
| 464 | - protected $publisher_element; |
|
| 465 | - |
|
| 466 | - /** |
|
| 467 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 468 | - * |
|
| 469 | - * @since 3.11.0 |
|
| 470 | - * @access protected |
|
| 471 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 472 | - */ |
|
| 473 | - protected $select2_element; |
|
| 474 | - |
|
| 475 | - /** |
|
| 476 | - * The controller for the entity type list admin page |
|
| 477 | - * |
|
| 478 | - * @since 3.11.0 |
|
| 479 | - * @access private |
|
| 480 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 481 | - */ |
|
| 482 | - private $entity_type_admin_page; |
|
| 483 | - |
|
| 484 | - /** |
|
| 485 | - * The controller for the entity type settings admin page |
|
| 486 | - * |
|
| 487 | - * @since 3.11.0 |
|
| 488 | - * @access private |
|
| 489 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 490 | - */ |
|
| 491 | - private $entity_type_settings_admin_page; |
|
| 492 | - |
|
| 493 | - /** |
|
| 494 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 495 | - * |
|
| 496 | - * @since 3.11.0 |
|
| 497 | - * @access protected |
|
| 498 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 499 | - */ |
|
| 500 | - protected $related_entities_cloud_widget; |
|
| 501 | - |
|
| 502 | - /** |
|
| 503 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 504 | - * |
|
| 505 | - * @since 3.14.0 |
|
| 506 | - * @access protected |
|
| 507 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 508 | - */ |
|
| 509 | - protected $author_element; |
|
| 510 | - |
|
| 511 | - /** |
|
| 512 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 513 | - * |
|
| 514 | - * @since 3.12.0 |
|
| 515 | - * @access protected |
|
| 516 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 517 | - */ |
|
| 518 | - protected $sample_data_service; |
|
| 519 | - |
|
| 520 | - /** |
|
| 521 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 522 | - * |
|
| 523 | - * @since 3.12.0 |
|
| 524 | - * @access protected |
|
| 525 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 526 | - */ |
|
| 527 | - protected $sample_data_ajax_adapter; |
|
| 528 | - |
|
| 529 | - /** |
|
| 530 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 531 | - * |
|
| 532 | - * @since 3.16.0 |
|
| 533 | - * @access protected |
|
| 534 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 535 | - */ |
|
| 536 | - protected $google_analytics_export_service; |
|
| 537 | - |
|
| 538 | - /** |
|
| 539 | - * {@link Wordlift}'s singleton instance. |
|
| 540 | - * |
|
| 541 | - * @since 3.15.0 |
|
| 542 | - * @access protected |
|
| 543 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 544 | - */ |
|
| 545 | - protected $entity_type_adapter; |
|
| 546 | - |
|
| 547 | - /** |
|
| 548 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 549 | - * |
|
| 550 | - * @since 3.15.0 |
|
| 551 | - * @access protected |
|
| 552 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 553 | - */ |
|
| 554 | - protected $storage_factory; |
|
| 555 | - |
|
| 556 | - /** |
|
| 557 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 558 | - * |
|
| 559 | - * @since 3.15.0 |
|
| 560 | - * @access private |
|
| 561 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 562 | - */ |
|
| 563 | - private $autocomplete_adapter; |
|
| 564 | - |
|
| 565 | - /** |
|
| 566 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 567 | - * |
|
| 568 | - * @since 3.16.0 |
|
| 569 | - * @access protected |
|
| 570 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 571 | - * |
|
| 572 | - */ |
|
| 573 | - protected $cached_postid_to_jsonld_converter; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.16.3 |
|
| 579 | - * @access protected |
|
| 580 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 581 | - */ |
|
| 582 | - protected $entity_uri_service; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.19.0 |
|
| 588 | - * @access protected |
|
| 589 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 590 | - */ |
|
| 591 | - protected $publisher_service; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 595 | - * |
|
| 596 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 597 | - */ |
|
| 598 | - protected $context_cards_service; |
|
| 599 | - |
|
| 600 | - /** |
|
| 601 | - * {@link Wordlift}'s singleton instance. |
|
| 602 | - * |
|
| 603 | - * @since 3.11.2 |
|
| 604 | - * @access private |
|
| 605 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 606 | - */ |
|
| 607 | - private static $instance; |
|
| 608 | - |
|
| 609 | - /** |
|
| 610 | - * A singleton instance of features registry. |
|
| 611 | - * @since 3.30.0 |
|
| 612 | - * @var Features_Registry |
|
| 613 | - */ |
|
| 614 | - private $features_registry; |
|
| 615 | - |
|
| 616 | - private $analytics_settings_page; |
|
| 617 | - //</editor-fold> |
|
| 618 | - |
|
| 619 | - // Experimental code added by Nishit for feature request 1496 |
|
| 620 | - private $webhook_loader; |
|
| 621 | - // Experimental code ents here |
|
| 622 | - |
|
| 623 | - /** |
|
| 624 | - * Define the core functionality of the plugin. |
|
| 625 | - * |
|
| 626 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 627 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 628 | - * the public-facing side of the site. |
|
| 629 | - * |
|
| 630 | - * @since 1.0.0 |
|
| 631 | - */ |
|
| 632 | - public function __construct() { |
|
| 633 | - |
|
| 634 | - self::$instance = $this; |
|
| 635 | - |
|
| 636 | - $this->plugin_name = 'wordlift'; |
|
| 637 | - $this->version = '3.35.10'; |
|
| 638 | - $this->load_dependencies(); |
|
| 639 | - $this->set_locale(); |
|
| 640 | - |
|
| 641 | - $that = $this; |
|
| 642 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 643 | - $that->define_admin_hooks( $that ); |
|
| 644 | - $that->define_public_hooks( $that ); |
|
| 645 | - }, 4 ); |
|
| 646 | - |
|
| 647 | - // If we're in `WP_CLI` load the related files. |
|
| 648 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 649 | - $this->load_cli_dependencies(); |
|
| 650 | - } |
|
| 651 | - |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - /** |
|
| 655 | - * Get the singleton instance. |
|
| 656 | - * |
|
| 657 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 658 | - * @since 3.11.2 |
|
| 659 | - * |
|
| 660 | - */ |
|
| 661 | - public static function get_instance() { |
|
| 662 | - |
|
| 663 | - return self::$instance; |
|
| 664 | - } |
|
| 665 | - |
|
| 666 | - /** |
|
| 667 | - * Load the required dependencies for this plugin. |
|
| 668 | - * |
|
| 669 | - * Include the following files that make up the plugin: |
|
| 670 | - * |
|
| 671 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 672 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 673 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 674 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 675 | - * |
|
| 676 | - * Create an instance of the loader which will be used to register the hooks |
|
| 677 | - * with WordPress. |
|
| 678 | - * |
|
| 679 | - * @throws Exception |
|
| 680 | - * @since 1.0.0 |
|
| 681 | - * @access private |
|
| 682 | - */ |
|
| 683 | - private function load_dependencies() { |
|
| 684 | - |
|
| 685 | - /** |
|
| 686 | - * The class responsible for orchestrating the actions and filters of the |
|
| 687 | - * core plugin. |
|
| 688 | - */ |
|
| 689 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 690 | - |
|
| 691 | - // The class responsible for plugin uninstall. |
|
| 692 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 693 | - |
|
| 694 | - /** |
|
| 695 | - * The class responsible for defining internationalization functionality |
|
| 696 | - * of the plugin. |
|
| 697 | - */ |
|
| 698 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 699 | - |
|
| 700 | - /** |
|
| 701 | - * WordLift's supported languages. |
|
| 702 | - */ |
|
| 703 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * WordLift's supported countries. |
|
| 707 | - */ |
|
| 708 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 709 | - |
|
| 710 | - /** |
|
| 711 | - * Provide support functions to sanitize data. |
|
| 712 | - */ |
|
| 713 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 714 | - |
|
| 715 | - /** Services. */ |
|
| 716 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 717 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 718 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 719 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 720 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 721 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 722 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 723 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 724 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 725 | - |
|
| 726 | - /** |
|
| 727 | - * The Schema service. |
|
| 728 | - */ |
|
| 729 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * The schema:url property service. |
|
| 733 | - */ |
|
| 734 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 735 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 736 | - |
|
| 737 | - /** |
|
| 738 | - * The UI service. |
|
| 739 | - */ |
|
| 740 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 741 | - |
|
| 742 | - /** |
|
| 743 | - * The Entity Types Taxonomy service. |
|
| 744 | - */ |
|
| 745 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 746 | - |
|
| 747 | - /** |
|
| 748 | - * The Entity service. |
|
| 749 | - */ |
|
| 750 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 751 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 752 | - |
|
| 753 | - // Add the entity rating service. |
|
| 754 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 755 | - |
|
| 756 | - /** |
|
| 757 | - * The User service. |
|
| 758 | - */ |
|
| 759 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 760 | - |
|
| 761 | - /** |
|
| 762 | - * The Timeline service. |
|
| 763 | - */ |
|
| 764 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 765 | - |
|
| 766 | - /** |
|
| 767 | - * The Topic Taxonomy service. |
|
| 768 | - */ |
|
| 769 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 770 | - |
|
| 771 | - /** |
|
| 772 | - * The WordLift URI service. |
|
| 773 | - */ |
|
| 774 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 775 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 776 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 777 | - |
|
| 778 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 779 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 780 | - |
|
| 781 | - /** |
|
| 782 | - * Load the converters. |
|
| 783 | - */ |
|
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 785 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 787 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 788 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 790 | - |
|
| 791 | - /** |
|
| 792 | - * Load cache-related files. |
|
| 793 | - */ |
|
| 794 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 795 | - |
|
| 796 | - /** |
|
| 797 | - * Load the content filter. |
|
| 798 | - */ |
|
| 799 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 800 | - |
|
| 801 | - /* |
|
| 85 | + //<editor-fold desc="## FIELDS"> |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 89 | + * the plugin. |
|
| 90 | + * |
|
| 91 | + * @since 1.0.0 |
|
| 92 | + * @access protected |
|
| 93 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 94 | + */ |
|
| 95 | + protected $loader; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * The unique identifier of this plugin. |
|
| 99 | + * |
|
| 100 | + * @since 1.0.0 |
|
| 101 | + * @access protected |
|
| 102 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 103 | + */ |
|
| 104 | + protected $plugin_name; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * The current version of the plugin. |
|
| 108 | + * |
|
| 109 | + * @since 1.0.0 |
|
| 110 | + * @access protected |
|
| 111 | + * @var string $version The current version of the plugin. |
|
| 112 | + */ |
|
| 113 | + protected $version; |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 117 | + * |
|
| 118 | + * @since 3.12.0 |
|
| 119 | + * @access protected |
|
| 120 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 121 | + */ |
|
| 122 | + protected $tinymce_adapter; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * The Schema service. |
|
| 126 | + * |
|
| 127 | + * @since 3.3.0 |
|
| 128 | + * @access protected |
|
| 129 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 130 | + */ |
|
| 131 | + protected $schema_service; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * The Topic Taxonomy service. |
|
| 135 | + * |
|
| 136 | + * @since 3.5.0 |
|
| 137 | + * @access private |
|
| 138 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 139 | + */ |
|
| 140 | + private $topic_taxonomy_service; |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * The Entity Types Taxonomy service. |
|
| 144 | + * |
|
| 145 | + * @since 3.18.0 |
|
| 146 | + * @access private |
|
| 147 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 148 | + */ |
|
| 149 | + private $entity_types_taxonomy_service; |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * The User service. |
|
| 153 | + * |
|
| 154 | + * @since 3.1.7 |
|
| 155 | + * @access protected |
|
| 156 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 157 | + */ |
|
| 158 | + protected $user_service; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The Timeline service. |
|
| 162 | + * |
|
| 163 | + * @since 3.1.0 |
|
| 164 | + * @access private |
|
| 165 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 166 | + */ |
|
| 167 | + private $timeline_service; |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * The Redirect service. |
|
| 171 | + * |
|
| 172 | + * @since 3.2.0 |
|
| 173 | + * @access private |
|
| 174 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 175 | + */ |
|
| 176 | + private $redirect_service; |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * The Notice service. |
|
| 180 | + * |
|
| 181 | + * @since 3.3.0 |
|
| 182 | + * @access private |
|
| 183 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 184 | + */ |
|
| 185 | + private $notice_service; |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * The Entity list customization. |
|
| 189 | + * |
|
| 190 | + * @since 3.3.0 |
|
| 191 | + * @access protected |
|
| 192 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 193 | + */ |
|
| 194 | + protected $entity_list_service; |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * The Entity Types Taxonomy Walker. |
|
| 198 | + * |
|
| 199 | + * @since 3.1.0 |
|
| 200 | + * @access private |
|
| 201 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 202 | + */ |
|
| 203 | + private $entity_types_taxonomy_walker; |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * The ShareThis service. |
|
| 207 | + * |
|
| 208 | + * @since 3.2.0 |
|
| 209 | + * @access private |
|
| 210 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 211 | + */ |
|
| 212 | + private $sharethis_service; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * The PrimaShop adapter. |
|
| 216 | + * |
|
| 217 | + * @since 3.2.3 |
|
| 218 | + * @access private |
|
| 219 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 220 | + */ |
|
| 221 | + private $primashop_adapter; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * The entity type service. |
|
| 225 | + * |
|
| 226 | + * @since 3.6.0 |
|
| 227 | + * @access private |
|
| 228 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 229 | + */ |
|
| 230 | + private $entity_post_type_service; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 234 | + * |
|
| 235 | + * @since 3.6.0 |
|
| 236 | + * @access private |
|
| 237 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 238 | + */ |
|
| 239 | + private $entity_link_service; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 243 | + * |
|
| 244 | + * @since 3.7.0 |
|
| 245 | + * @access protected |
|
| 246 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 247 | + */ |
|
| 248 | + protected $jsonld_service; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 252 | + * |
|
| 253 | + * @since 3.14.0 |
|
| 254 | + * @access protected |
|
| 255 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 256 | + */ |
|
| 257 | + protected $jsonld_website_converter; |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 261 | + * |
|
| 262 | + * @since 3.7.0 |
|
| 263 | + * @access private |
|
| 264 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 265 | + */ |
|
| 266 | + private $property_factory; |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * The 'Download Your Data' page. |
|
| 270 | + * |
|
| 271 | + * @since 3.6.0 |
|
| 272 | + * @access private |
|
| 273 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 274 | + */ |
|
| 275 | + private $download_your_data_page; |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * The 'WordLift Settings' page. |
|
| 279 | + * |
|
| 280 | + * @since 3.11.0 |
|
| 281 | + * @access protected |
|
| 282 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 283 | + */ |
|
| 284 | + protected $settings_page; |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * The install wizard page. |
|
| 288 | + * |
|
| 289 | + * @since 3.9.0 |
|
| 290 | + * @access private |
|
| 291 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 292 | + */ |
|
| 293 | + public $admin_setup; |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 297 | + * linking of entities to their pages. |
|
| 298 | + * |
|
| 299 | + * @since 3.8.0 |
|
| 300 | + * @access private |
|
| 301 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 302 | + */ |
|
| 303 | + private $content_filter_service; |
|
| 304 | + |
|
| 305 | + /** |
|
| 306 | + * The Faq Content filter service |
|
| 307 | + * @since 3.26.0 |
|
| 308 | + * @access private |
|
| 309 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 310 | + */ |
|
| 311 | + private $faq_content_filter_service; |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 315 | + * |
|
| 316 | + * @since 3.9.0 |
|
| 317 | + * @access private |
|
| 318 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 319 | + */ |
|
| 320 | + private $key_validation_service; |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 324 | + * |
|
| 325 | + * @since 3.10.0 |
|
| 326 | + * @access private |
|
| 327 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 328 | + */ |
|
| 329 | + private $rating_service; |
|
| 330 | + |
|
| 331 | + /** |
|
| 332 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 333 | + * |
|
| 334 | + * @since 3.10.0 |
|
| 335 | + * @access protected |
|
| 336 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 337 | + */ |
|
| 338 | + protected $post_to_jsonld_converter; |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * A {@link Wordlift_Install_Service} instance. |
|
| 342 | + * |
|
| 343 | + * @since 3.18.0 |
|
| 344 | + * @access protected |
|
| 345 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 346 | + */ |
|
| 347 | + protected $install_service; |
|
| 348 | + |
|
| 349 | + /** |
|
| 350 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 351 | + * |
|
| 352 | + * @since 3.10.0 |
|
| 353 | + * @access protected |
|
| 354 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 355 | + */ |
|
| 356 | + protected $entity_post_to_jsonld_converter; |
|
| 357 | + |
|
| 358 | + /** |
|
| 359 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 360 | + * |
|
| 361 | + * @since 3.10.0 |
|
| 362 | + * @access protected |
|
| 363 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 364 | + */ |
|
| 365 | + protected $postid_to_jsonld_converter; |
|
| 366 | + |
|
| 367 | + /** |
|
| 368 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 369 | + * |
|
| 370 | + * @since 3.11.0 |
|
| 371 | + * @access protected |
|
| 372 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 373 | + */ |
|
| 374 | + protected $category_taxonomy_service; |
|
| 375 | + |
|
| 376 | + /** |
|
| 377 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 378 | + * |
|
| 379 | + * @since 3.11.0 |
|
| 380 | + * @access protected |
|
| 381 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 382 | + */ |
|
| 383 | + protected $entity_page_service; |
|
| 384 | + |
|
| 385 | + /** |
|
| 386 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 387 | + * |
|
| 388 | + * @since 3.11.0 |
|
| 389 | + * @access protected |
|
| 390 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 391 | + */ |
|
| 392 | + protected $settings_page_action_link; |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 396 | + * |
|
| 397 | + * @since 3.11.0 |
|
| 398 | + * @access protected |
|
| 399 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 400 | + */ |
|
| 401 | + protected $analytics_settings_page_action_link; |
|
| 402 | + |
|
| 403 | + /** |
|
| 404 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 405 | + * |
|
| 406 | + * @since 3.11.0 |
|
| 407 | + * @access protected |
|
| 408 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 409 | + */ |
|
| 410 | + protected $analytics_connect; |
|
| 411 | + |
|
| 412 | + /** |
|
| 413 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 414 | + * |
|
| 415 | + * @since 3.11.0 |
|
| 416 | + * @access protected |
|
| 417 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 418 | + */ |
|
| 419 | + protected $publisher_ajax_adapter; |
|
| 420 | + |
|
| 421 | + /** |
|
| 422 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 423 | + * |
|
| 424 | + * @since 3.11.0 |
|
| 425 | + * @access protected |
|
| 426 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 427 | + */ |
|
| 428 | + protected $input_element; |
|
| 429 | + |
|
| 430 | + /** |
|
| 431 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 432 | + * |
|
| 433 | + * @since 3.13.0 |
|
| 434 | + * @access protected |
|
| 435 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 436 | + */ |
|
| 437 | + protected $radio_input_element; |
|
| 438 | + |
|
| 439 | + /** |
|
| 440 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 441 | + * |
|
| 442 | + * @since 3.11.0 |
|
| 443 | + * @access protected |
|
| 444 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 445 | + */ |
|
| 446 | + protected $language_select_element; |
|
| 447 | + |
|
| 448 | + /** |
|
| 449 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 450 | + * |
|
| 451 | + * @since 3.18.0 |
|
| 452 | + * @access protected |
|
| 453 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 454 | + */ |
|
| 455 | + protected $country_select_element; |
|
| 456 | + |
|
| 457 | + /** |
|
| 458 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 459 | + * |
|
| 460 | + * @since 3.11.0 |
|
| 461 | + * @access protected |
|
| 462 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 463 | + */ |
|
| 464 | + protected $publisher_element; |
|
| 465 | + |
|
| 466 | + /** |
|
| 467 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 468 | + * |
|
| 469 | + * @since 3.11.0 |
|
| 470 | + * @access protected |
|
| 471 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 472 | + */ |
|
| 473 | + protected $select2_element; |
|
| 474 | + |
|
| 475 | + /** |
|
| 476 | + * The controller for the entity type list admin page |
|
| 477 | + * |
|
| 478 | + * @since 3.11.0 |
|
| 479 | + * @access private |
|
| 480 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 481 | + */ |
|
| 482 | + private $entity_type_admin_page; |
|
| 483 | + |
|
| 484 | + /** |
|
| 485 | + * The controller for the entity type settings admin page |
|
| 486 | + * |
|
| 487 | + * @since 3.11.0 |
|
| 488 | + * @access private |
|
| 489 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 490 | + */ |
|
| 491 | + private $entity_type_settings_admin_page; |
|
| 492 | + |
|
| 493 | + /** |
|
| 494 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 495 | + * |
|
| 496 | + * @since 3.11.0 |
|
| 497 | + * @access protected |
|
| 498 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 499 | + */ |
|
| 500 | + protected $related_entities_cloud_widget; |
|
| 501 | + |
|
| 502 | + /** |
|
| 503 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 504 | + * |
|
| 505 | + * @since 3.14.0 |
|
| 506 | + * @access protected |
|
| 507 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 508 | + */ |
|
| 509 | + protected $author_element; |
|
| 510 | + |
|
| 511 | + /** |
|
| 512 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 513 | + * |
|
| 514 | + * @since 3.12.0 |
|
| 515 | + * @access protected |
|
| 516 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 517 | + */ |
|
| 518 | + protected $sample_data_service; |
|
| 519 | + |
|
| 520 | + /** |
|
| 521 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 522 | + * |
|
| 523 | + * @since 3.12.0 |
|
| 524 | + * @access protected |
|
| 525 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 526 | + */ |
|
| 527 | + protected $sample_data_ajax_adapter; |
|
| 528 | + |
|
| 529 | + /** |
|
| 530 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 531 | + * |
|
| 532 | + * @since 3.16.0 |
|
| 533 | + * @access protected |
|
| 534 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 535 | + */ |
|
| 536 | + protected $google_analytics_export_service; |
|
| 537 | + |
|
| 538 | + /** |
|
| 539 | + * {@link Wordlift}'s singleton instance. |
|
| 540 | + * |
|
| 541 | + * @since 3.15.0 |
|
| 542 | + * @access protected |
|
| 543 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 544 | + */ |
|
| 545 | + protected $entity_type_adapter; |
|
| 546 | + |
|
| 547 | + /** |
|
| 548 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 549 | + * |
|
| 550 | + * @since 3.15.0 |
|
| 551 | + * @access protected |
|
| 552 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 553 | + */ |
|
| 554 | + protected $storage_factory; |
|
| 555 | + |
|
| 556 | + /** |
|
| 557 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 558 | + * |
|
| 559 | + * @since 3.15.0 |
|
| 560 | + * @access private |
|
| 561 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 562 | + */ |
|
| 563 | + private $autocomplete_adapter; |
|
| 564 | + |
|
| 565 | + /** |
|
| 566 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 567 | + * |
|
| 568 | + * @since 3.16.0 |
|
| 569 | + * @access protected |
|
| 570 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 571 | + * |
|
| 572 | + */ |
|
| 573 | + protected $cached_postid_to_jsonld_converter; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.16.3 |
|
| 579 | + * @access protected |
|
| 580 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 581 | + */ |
|
| 582 | + protected $entity_uri_service; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.19.0 |
|
| 588 | + * @access protected |
|
| 589 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 590 | + */ |
|
| 591 | + protected $publisher_service; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 595 | + * |
|
| 596 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 597 | + */ |
|
| 598 | + protected $context_cards_service; |
|
| 599 | + |
|
| 600 | + /** |
|
| 601 | + * {@link Wordlift}'s singleton instance. |
|
| 602 | + * |
|
| 603 | + * @since 3.11.2 |
|
| 604 | + * @access private |
|
| 605 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 606 | + */ |
|
| 607 | + private static $instance; |
|
| 608 | + |
|
| 609 | + /** |
|
| 610 | + * A singleton instance of features registry. |
|
| 611 | + * @since 3.30.0 |
|
| 612 | + * @var Features_Registry |
|
| 613 | + */ |
|
| 614 | + private $features_registry; |
|
| 615 | + |
|
| 616 | + private $analytics_settings_page; |
|
| 617 | + //</editor-fold> |
|
| 618 | + |
|
| 619 | + // Experimental code added by Nishit for feature request 1496 |
|
| 620 | + private $webhook_loader; |
|
| 621 | + // Experimental code ents here |
|
| 622 | + |
|
| 623 | + /** |
|
| 624 | + * Define the core functionality of the plugin. |
|
| 625 | + * |
|
| 626 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 627 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 628 | + * the public-facing side of the site. |
|
| 629 | + * |
|
| 630 | + * @since 1.0.0 |
|
| 631 | + */ |
|
| 632 | + public function __construct() { |
|
| 633 | + |
|
| 634 | + self::$instance = $this; |
|
| 635 | + |
|
| 636 | + $this->plugin_name = 'wordlift'; |
|
| 637 | + $this->version = '3.35.10'; |
|
| 638 | + $this->load_dependencies(); |
|
| 639 | + $this->set_locale(); |
|
| 640 | + |
|
| 641 | + $that = $this; |
|
| 642 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 643 | + $that->define_admin_hooks( $that ); |
|
| 644 | + $that->define_public_hooks( $that ); |
|
| 645 | + }, 4 ); |
|
| 646 | + |
|
| 647 | + // If we're in `WP_CLI` load the related files. |
|
| 648 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 649 | + $this->load_cli_dependencies(); |
|
| 650 | + } |
|
| 651 | + |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + /** |
|
| 655 | + * Get the singleton instance. |
|
| 656 | + * |
|
| 657 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 658 | + * @since 3.11.2 |
|
| 659 | + * |
|
| 660 | + */ |
|
| 661 | + public static function get_instance() { |
|
| 662 | + |
|
| 663 | + return self::$instance; |
|
| 664 | + } |
|
| 665 | + |
|
| 666 | + /** |
|
| 667 | + * Load the required dependencies for this plugin. |
|
| 668 | + * |
|
| 669 | + * Include the following files that make up the plugin: |
|
| 670 | + * |
|
| 671 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 672 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 673 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 674 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 675 | + * |
|
| 676 | + * Create an instance of the loader which will be used to register the hooks |
|
| 677 | + * with WordPress. |
|
| 678 | + * |
|
| 679 | + * @throws Exception |
|
| 680 | + * @since 1.0.0 |
|
| 681 | + * @access private |
|
| 682 | + */ |
|
| 683 | + private function load_dependencies() { |
|
| 684 | + |
|
| 685 | + /** |
|
| 686 | + * The class responsible for orchestrating the actions and filters of the |
|
| 687 | + * core plugin. |
|
| 688 | + */ |
|
| 689 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 690 | + |
|
| 691 | + // The class responsible for plugin uninstall. |
|
| 692 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 693 | + |
|
| 694 | + /** |
|
| 695 | + * The class responsible for defining internationalization functionality |
|
| 696 | + * of the plugin. |
|
| 697 | + */ |
|
| 698 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 699 | + |
|
| 700 | + /** |
|
| 701 | + * WordLift's supported languages. |
|
| 702 | + */ |
|
| 703 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * WordLift's supported countries. |
|
| 707 | + */ |
|
| 708 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 709 | + |
|
| 710 | + /** |
|
| 711 | + * Provide support functions to sanitize data. |
|
| 712 | + */ |
|
| 713 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 714 | + |
|
| 715 | + /** Services. */ |
|
| 716 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 717 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 718 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 719 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 720 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 721 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 722 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 723 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 724 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 725 | + |
|
| 726 | + /** |
|
| 727 | + * The Schema service. |
|
| 728 | + */ |
|
| 729 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * The schema:url property service. |
|
| 733 | + */ |
|
| 734 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 735 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 736 | + |
|
| 737 | + /** |
|
| 738 | + * The UI service. |
|
| 739 | + */ |
|
| 740 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 741 | + |
|
| 742 | + /** |
|
| 743 | + * The Entity Types Taxonomy service. |
|
| 744 | + */ |
|
| 745 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 746 | + |
|
| 747 | + /** |
|
| 748 | + * The Entity service. |
|
| 749 | + */ |
|
| 750 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 751 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 752 | + |
|
| 753 | + // Add the entity rating service. |
|
| 754 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 755 | + |
|
| 756 | + /** |
|
| 757 | + * The User service. |
|
| 758 | + */ |
|
| 759 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 760 | + |
|
| 761 | + /** |
|
| 762 | + * The Timeline service. |
|
| 763 | + */ |
|
| 764 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 765 | + |
|
| 766 | + /** |
|
| 767 | + * The Topic Taxonomy service. |
|
| 768 | + */ |
|
| 769 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 770 | + |
|
| 771 | + /** |
|
| 772 | + * The WordLift URI service. |
|
| 773 | + */ |
|
| 774 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 775 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 776 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 777 | + |
|
| 778 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 779 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 780 | + |
|
| 781 | + /** |
|
| 782 | + * Load the converters. |
|
| 783 | + */ |
|
| 784 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 785 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 786 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 787 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 788 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 789 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 790 | + |
|
| 791 | + /** |
|
| 792 | + * Load cache-related files. |
|
| 793 | + */ |
|
| 794 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 795 | + |
|
| 796 | + /** |
|
| 797 | + * Load the content filter. |
|
| 798 | + */ |
|
| 799 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 800 | + |
|
| 801 | + /* |
|
| 802 | 802 | * Load the excerpt helper. |
| 803 | 803 | */ |
| 804 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 805 | - |
|
| 806 | - /** |
|
| 807 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 808 | - * |
|
| 809 | - * @since 3.8.0 |
|
| 810 | - */ |
|
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 812 | - |
|
| 813 | - // The Publisher Service and the AJAX adapter. |
|
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 815 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 816 | - |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 818 | - |
|
| 819 | - /** |
|
| 820 | - * Load the WordLift key validation service. |
|
| 821 | - */ |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 823 | - |
|
| 824 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 826 | - |
|
| 827 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 829 | - |
|
| 830 | - /** Linked Data. */ |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 836 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 840 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 841 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 842 | - |
|
| 843 | - /** Services. */ |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 846 | - |
|
| 847 | - /** Adapters. */ |
|
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 853 | - |
|
| 854 | - /** Autocomplete. */ |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 856 | - |
|
| 857 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 858 | - |
|
| 859 | - /** Analytics */ |
|
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * The class to customize the entity list admin page. |
|
| 869 | - */ |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 871 | - |
|
| 872 | - /** |
|
| 873 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 874 | - */ |
|
| 875 | - global $wp_version; |
|
| 876 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 877 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 878 | - } else { |
|
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 880 | - } |
|
| 881 | - |
|
| 882 | - /** |
|
| 883 | - * The Notice service. |
|
| 884 | - */ |
|
| 885 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 886 | - |
|
| 887 | - /** |
|
| 888 | - * The PrimaShop adapter. |
|
| 889 | - */ |
|
| 890 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 891 | - |
|
| 892 | - /** |
|
| 893 | - * The WordLift Dashboard service. |
|
| 894 | - */ |
|
| 895 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 896 | - |
|
| 897 | - /** |
|
| 898 | - * The admin 'Install wizard' page. |
|
| 899 | - */ |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The WordLift entity type list admin page controller. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 906 | - |
|
| 907 | - /** |
|
| 908 | - * The WordLift entity type settings admin page controller. |
|
| 909 | - */ |
|
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 911 | - |
|
| 912 | - /** |
|
| 913 | - * The admin 'Download Your Data' page. |
|
| 914 | - */ |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 916 | - |
|
| 917 | - /** |
|
| 918 | - * The admin 'WordLift Settings' page. |
|
| 919 | - */ |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 935 | - |
|
| 936 | - /** Admin Pages */ |
|
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 939 | - |
|
| 940 | - /** |
|
| 941 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 942 | - * side of the site. |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 945 | - |
|
| 946 | - /** |
|
| 947 | - * The shortcode abstract class. |
|
| 948 | - */ |
|
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 950 | - |
|
| 951 | - /** |
|
| 952 | - * The Timeline shortcode. |
|
| 953 | - */ |
|
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 955 | - |
|
| 956 | - /** |
|
| 957 | - * The Navigator shortcode. |
|
| 958 | - */ |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 960 | - |
|
| 961 | - /** |
|
| 962 | - * The Products Navigator shortcode. |
|
| 963 | - */ |
|
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 965 | - |
|
| 966 | - /** |
|
| 967 | - * The chord shortcode. |
|
| 968 | - */ |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 970 | - |
|
| 971 | - /** |
|
| 972 | - * The geomap shortcode. |
|
| 973 | - */ |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 975 | - |
|
| 976 | - /** |
|
| 977 | - * The entity cloud shortcode. |
|
| 978 | - */ |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 980 | - |
|
| 981 | - /** |
|
| 982 | - * The entity glossary shortcode. |
|
| 983 | - */ |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 986 | - |
|
| 987 | - /** |
|
| 988 | - * Faceted Search shortcode. |
|
| 989 | - */ |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 991 | - |
|
| 992 | - /** |
|
| 993 | - * The ShareThis service. |
|
| 994 | - */ |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 996 | - |
|
| 997 | - /** |
|
| 998 | - * The SEO service. |
|
| 999 | - */ |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1001 | - |
|
| 1002 | - /** |
|
| 1003 | - * The AMP service. |
|
| 1004 | - */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1006 | - |
|
| 1007 | - /** Widgets */ |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1009 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1011 | - |
|
| 1012 | - /* |
|
| 804 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 805 | + |
|
| 806 | + /** |
|
| 807 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 808 | + * |
|
| 809 | + * @since 3.8.0 |
|
| 810 | + */ |
|
| 811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 812 | + |
|
| 813 | + // The Publisher Service and the AJAX adapter. |
|
| 814 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 815 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 816 | + |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 818 | + |
|
| 819 | + /** |
|
| 820 | + * Load the WordLift key validation service. |
|
| 821 | + */ |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 823 | + |
|
| 824 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 826 | + |
|
| 827 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 829 | + |
|
| 830 | + /** Linked Data. */ |
|
| 831 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 834 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 835 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 836 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 839 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 840 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 841 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 842 | + |
|
| 843 | + /** Services. */ |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 845 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 846 | + |
|
| 847 | + /** Adapters. */ |
|
| 848 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 850 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 851 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 852 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 853 | + |
|
| 854 | + /** Autocomplete. */ |
|
| 855 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 856 | + |
|
| 857 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 858 | + |
|
| 859 | + /** Analytics */ |
|
| 860 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 861 | + |
|
| 862 | + /** |
|
| 863 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * The class to customize the entity list admin page. |
|
| 869 | + */ |
|
| 870 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 871 | + |
|
| 872 | + /** |
|
| 873 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 874 | + */ |
|
| 875 | + global $wp_version; |
|
| 876 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 877 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 878 | + } else { |
|
| 879 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 880 | + } |
|
| 881 | + |
|
| 882 | + /** |
|
| 883 | + * The Notice service. |
|
| 884 | + */ |
|
| 885 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 886 | + |
|
| 887 | + /** |
|
| 888 | + * The PrimaShop adapter. |
|
| 889 | + */ |
|
| 890 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 891 | + |
|
| 892 | + /** |
|
| 893 | + * The WordLift Dashboard service. |
|
| 894 | + */ |
|
| 895 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 896 | + |
|
| 897 | + /** |
|
| 898 | + * The admin 'Install wizard' page. |
|
| 899 | + */ |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The WordLift entity type list admin page controller. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 906 | + |
|
| 907 | + /** |
|
| 908 | + * The WordLift entity type settings admin page controller. |
|
| 909 | + */ |
|
| 910 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 911 | + |
|
| 912 | + /** |
|
| 913 | + * The admin 'Download Your Data' page. |
|
| 914 | + */ |
|
| 915 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 916 | + |
|
| 917 | + /** |
|
| 918 | + * The admin 'WordLift Settings' page. |
|
| 919 | + */ |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 923 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 931 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 935 | + |
|
| 936 | + /** Admin Pages */ |
|
| 937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 939 | + |
|
| 940 | + /** |
|
| 941 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 942 | + * side of the site. |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 945 | + |
|
| 946 | + /** |
|
| 947 | + * The shortcode abstract class. |
|
| 948 | + */ |
|
| 949 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 950 | + |
|
| 951 | + /** |
|
| 952 | + * The Timeline shortcode. |
|
| 953 | + */ |
|
| 954 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 955 | + |
|
| 956 | + /** |
|
| 957 | + * The Navigator shortcode. |
|
| 958 | + */ |
|
| 959 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 960 | + |
|
| 961 | + /** |
|
| 962 | + * The Products Navigator shortcode. |
|
| 963 | + */ |
|
| 964 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 965 | + |
|
| 966 | + /** |
|
| 967 | + * The chord shortcode. |
|
| 968 | + */ |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 970 | + |
|
| 971 | + /** |
|
| 972 | + * The geomap shortcode. |
|
| 973 | + */ |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 975 | + |
|
| 976 | + /** |
|
| 977 | + * The entity cloud shortcode. |
|
| 978 | + */ |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 980 | + |
|
| 981 | + /** |
|
| 982 | + * The entity glossary shortcode. |
|
| 983 | + */ |
|
| 984 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 986 | + |
|
| 987 | + /** |
|
| 988 | + * Faceted Search shortcode. |
|
| 989 | + */ |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 991 | + |
|
| 992 | + /** |
|
| 993 | + * The ShareThis service. |
|
| 994 | + */ |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 996 | + |
|
| 997 | + /** |
|
| 998 | + * The SEO service. |
|
| 999 | + */ |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1001 | + |
|
| 1002 | + /** |
|
| 1003 | + * The AMP service. |
|
| 1004 | + */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1006 | + |
|
| 1007 | + /** Widgets */ |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1009 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1011 | + |
|
| 1012 | + /* |
|
| 1013 | 1013 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1014 | 1014 | * |
| 1015 | 1015 | * Eventually Batch Actions will become Batch Operations. |
| 1016 | 1016 | * |
| 1017 | 1017 | * @since 3.20.0 |
| 1018 | 1018 | */ |
| 1019 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1019 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1021 | 1021 | |
| 1022 | - /* |
|
| 1022 | + /* |
|
| 1023 | 1023 | * Schema.org Services. |
| 1024 | 1024 | * |
| 1025 | 1025 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1026 | 1026 | */ |
| 1027 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1029 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1030 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1031 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1032 | - $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
| 1033 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1034 | - } else { |
|
| 1035 | - $schemaorg_property_service = null; |
|
| 1036 | - } |
|
| 1037 | - |
|
| 1038 | - $this->loader = new Wordlift_Loader(); |
|
| 1039 | - /** |
|
| 1040 | - * @since 3.30.0 |
|
| 1041 | - */ |
|
| 1042 | - $this->features_registry = Features_Registry::get_instance(); |
|
| 1043 | - |
|
| 1044 | - // Instantiate a global logger. |
|
| 1045 | - global $wl_logger; |
|
| 1046 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1047 | - |
|
| 1048 | - // Load the `wl-api` end-point. |
|
| 1049 | - new Wordlift_Http_Api(); |
|
| 1050 | - |
|
| 1051 | - // Load the Install Service. |
|
| 1052 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1053 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1054 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1055 | - $this->user_service = Wordlift_User_Service::get_instance(); |
|
| 1056 | - // create an instance of the entity type list admin page controller. |
|
| 1057 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1058 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1059 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1060 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1061 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
| 1062 | - Wordlift_Entity_Service::TYPE_NAME, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1063 | - /* WordPress Admin. */ |
|
| 1064 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
| 1065 | - // create an instance of the entity type setting admin page controller. |
|
| 1066 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1067 | - |
|
| 1068 | - |
|
| 1069 | - $that = $this; |
|
| 1070 | - add_action( 'plugins_loaded', function () use ( &$that, $schemaorg_property_service ) { |
|
| 1071 | - |
|
| 1072 | - /** Services. */ |
|
| 1073 | - // Create the configuration service. |
|
| 1074 | - $api_service = new Wordlift_Api_Service(); |
|
| 1075 | - |
|
| 1076 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1077 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1078 | - |
|
| 1079 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
| 1080 | - |
|
| 1081 | - $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
| 1082 | - |
|
| 1083 | - // Create a new instance of the Redirect service. |
|
| 1084 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
| 1085 | - |
|
| 1086 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1087 | - $that->timeline_service = new Wordlift_Timeline_Service(); |
|
| 1088 | - |
|
| 1089 | - $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1090 | - |
|
| 1091 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1092 | - $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1093 | - |
|
| 1094 | - // Create an instance of the PrimaShop adapter. |
|
| 1095 | - $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1096 | - |
|
| 1097 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1098 | - |
|
| 1099 | - // Create the entity rating service. |
|
| 1100 | - $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
| 1101 | - |
|
| 1102 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1103 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
| 1104 | - |
|
| 1105 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1106 | - $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
| 1107 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1108 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1109 | - |
|
| 1110 | - $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
| 1111 | - |
|
| 1112 | - // Instantiate the JSON-LD service. |
|
| 1113 | - $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
| 1114 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1115 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
| 1116 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
| 1117 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1118 | - |
|
| 1119 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1120 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
| 1121 | - /* |
|
| 1027 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1028 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1029 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1030 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1031 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1032 | + $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
| 1033 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1034 | + } else { |
|
| 1035 | + $schemaorg_property_service = null; |
|
| 1036 | + } |
|
| 1037 | + |
|
| 1038 | + $this->loader = new Wordlift_Loader(); |
|
| 1039 | + /** |
|
| 1040 | + * @since 3.30.0 |
|
| 1041 | + */ |
|
| 1042 | + $this->features_registry = Features_Registry::get_instance(); |
|
| 1043 | + |
|
| 1044 | + // Instantiate a global logger. |
|
| 1045 | + global $wl_logger; |
|
| 1046 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1047 | + |
|
| 1048 | + // Load the `wl-api` end-point. |
|
| 1049 | + new Wordlift_Http_Api(); |
|
| 1050 | + |
|
| 1051 | + // Load the Install Service. |
|
| 1052 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1053 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1054 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1055 | + $this->user_service = Wordlift_User_Service::get_instance(); |
|
| 1056 | + // create an instance of the entity type list admin page controller. |
|
| 1057 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1058 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1059 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1060 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1061 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
| 1062 | + Wordlift_Entity_Service::TYPE_NAME, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1063 | + /* WordPress Admin. */ |
|
| 1064 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
| 1065 | + // create an instance of the entity type setting admin page controller. |
|
| 1066 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1067 | + |
|
| 1068 | + |
|
| 1069 | + $that = $this; |
|
| 1070 | + add_action( 'plugins_loaded', function () use ( &$that, $schemaorg_property_service ) { |
|
| 1071 | + |
|
| 1072 | + /** Services. */ |
|
| 1073 | + // Create the configuration service. |
|
| 1074 | + $api_service = new Wordlift_Api_Service(); |
|
| 1075 | + |
|
| 1076 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1077 | + $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1078 | + |
|
| 1079 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
| 1080 | + |
|
| 1081 | + $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
| 1082 | + |
|
| 1083 | + // Create a new instance of the Redirect service. |
|
| 1084 | + $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
| 1085 | + |
|
| 1086 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1087 | + $that->timeline_service = new Wordlift_Timeline_Service(); |
|
| 1088 | + |
|
| 1089 | + $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1090 | + |
|
| 1091 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1092 | + $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1093 | + |
|
| 1094 | + // Create an instance of the PrimaShop adapter. |
|
| 1095 | + $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1096 | + |
|
| 1097 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1098 | + |
|
| 1099 | + // Create the entity rating service. |
|
| 1100 | + $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
| 1101 | + |
|
| 1102 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1103 | + $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
| 1104 | + |
|
| 1105 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1106 | + $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
| 1107 | + $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1108 | + $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1109 | + |
|
| 1110 | + $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
| 1111 | + |
|
| 1112 | + // Instantiate the JSON-LD service. |
|
| 1113 | + $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
| 1114 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1115 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
| 1116 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
| 1117 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1118 | + |
|
| 1119 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1120 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
| 1121 | + /* |
|
| 1122 | 1122 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1123 | 1123 | * |
| 1124 | 1124 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1125 | 1125 | * |
| 1126 | 1126 | * @since 3.20.0 |
| 1127 | 1127 | */ |
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1129 | - |
|
| 1130 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
| 1131 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
| 1132 | - |
|
| 1133 | - $jsonld_service = new Jsonld_Service( |
|
| 1134 | - $that->jsonld_service, |
|
| 1135 | - $term_jsonld_adapter, |
|
| 1136 | - new Jsonld_User_Service( $that->user_service ) ); |
|
| 1137 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
| 1138 | - |
|
| 1139 | - // Prints the JSON-LD in the head. |
|
| 1140 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
| 1141 | - |
|
| 1142 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
| 1143 | - |
|
| 1144 | - $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 1145 | - $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
| 1146 | - // Creating Faq Content filter service. |
|
| 1147 | - $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1148 | - $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
| 1149 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
| 1150 | - |
|
| 1151 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
| 1152 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
| 1153 | - |
|
| 1154 | - /** |
|
| 1155 | - * Filter: wl_feature__enable__blocks. |
|
| 1156 | - * |
|
| 1157 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1158 | - * |
|
| 1159 | - * @return bool |
|
| 1160 | - * @since 3.27.6 |
|
| 1161 | - */ |
|
| 1162 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1163 | - // Initialize the short-codes. |
|
| 1164 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1165 | - new Wordlift_Chord_Shortcode(); |
|
| 1166 | - new Wordlift_Geomap_Shortcode(); |
|
| 1167 | - new Wordlift_Timeline_Shortcode(); |
|
| 1168 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
| 1169 | - new Wordlift_Vocabulary_Shortcode(); |
|
| 1170 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1171 | - } |
|
| 1172 | - |
|
| 1173 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1174 | - |
|
| 1175 | - |
|
| 1176 | - // Initialize the Context Cards Service |
|
| 1177 | - $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1178 | - |
|
| 1179 | - // Initialize the SEO service. |
|
| 1180 | - new Wordlift_Seo_Service(); |
|
| 1181 | - |
|
| 1182 | - // Initialize the AMP service. |
|
| 1183 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
| 1184 | - |
|
| 1185 | - /** Services. */ |
|
| 1186 | - $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1187 | - new Wordlift_Image_Service(); |
|
| 1188 | - |
|
| 1189 | - /** Adapters. */ |
|
| 1190 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1191 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
| 1192 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
| 1193 | - |
|
| 1194 | - /* |
|
| 1128 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1129 | + |
|
| 1130 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
| 1131 | + $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
| 1132 | + |
|
| 1133 | + $jsonld_service = new Jsonld_Service( |
|
| 1134 | + $that->jsonld_service, |
|
| 1135 | + $term_jsonld_adapter, |
|
| 1136 | + new Jsonld_User_Service( $that->user_service ) ); |
|
| 1137 | + new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
| 1138 | + |
|
| 1139 | + // Prints the JSON-LD in the head. |
|
| 1140 | + new Jsonld_Adapter( $that->jsonld_service ); |
|
| 1141 | + |
|
| 1142 | + new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
| 1143 | + |
|
| 1144 | + $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 1145 | + $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
| 1146 | + // Creating Faq Content filter service. |
|
| 1147 | + $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1148 | + $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
| 1149 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
| 1150 | + |
|
| 1151 | + $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
| 1152 | + $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
| 1153 | + |
|
| 1154 | + /** |
|
| 1155 | + * Filter: wl_feature__enable__blocks. |
|
| 1156 | + * |
|
| 1157 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1158 | + * |
|
| 1159 | + * @return bool |
|
| 1160 | + * @since 3.27.6 |
|
| 1161 | + */ |
|
| 1162 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1163 | + // Initialize the short-codes. |
|
| 1164 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1165 | + new Wordlift_Chord_Shortcode(); |
|
| 1166 | + new Wordlift_Geomap_Shortcode(); |
|
| 1167 | + new Wordlift_Timeline_Shortcode(); |
|
| 1168 | + new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
| 1169 | + new Wordlift_Vocabulary_Shortcode(); |
|
| 1170 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1171 | + } |
|
| 1172 | + |
|
| 1173 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1174 | + |
|
| 1175 | + |
|
| 1176 | + // Initialize the Context Cards Service |
|
| 1177 | + $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1178 | + |
|
| 1179 | + // Initialize the SEO service. |
|
| 1180 | + new Wordlift_Seo_Service(); |
|
| 1181 | + |
|
| 1182 | + // Initialize the AMP service. |
|
| 1183 | + new Wordlift_AMP_Service( $that->jsonld_service ); |
|
| 1184 | + |
|
| 1185 | + /** Services. */ |
|
| 1186 | + $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1187 | + new Wordlift_Image_Service(); |
|
| 1188 | + |
|
| 1189 | + /** Adapters. */ |
|
| 1190 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1191 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
| 1192 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
| 1193 | + |
|
| 1194 | + /* |
|
| 1195 | 1195 | * Exclude our public js from WP-Rocket. |
| 1196 | 1196 | * |
| 1197 | 1197 | * @since 3.19.4 |
| 1198 | 1198 | * |
| 1199 | 1199 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1200 | 1200 | */ |
| 1201 | - new Wordlift_WpRocket_Adapter(); |
|
| 1201 | + new Wordlift_WpRocket_Adapter(); |
|
| 1202 | 1202 | |
| 1203 | - /** WordPress Admin UI. */ |
|
| 1203 | + /** WordPress Admin UI. */ |
|
| 1204 | 1204 | |
| 1205 | - // UI elements. |
|
| 1206 | - $that->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1207 | - $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1208 | - $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1209 | - $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1210 | - $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1211 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1212 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
| 1213 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
| 1205 | + // UI elements. |
|
| 1206 | + $that->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1207 | + $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1208 | + $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1209 | + $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1210 | + $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1211 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1212 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
| 1213 | + $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
| 1214 | 1214 | |
| 1215 | - $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 1216 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
| 1215 | + $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 1216 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
| 1217 | 1217 | |
| 1218 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
| 1219 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
| 1220 | - $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1218 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
| 1219 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
| 1220 | + $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1221 | 1221 | |
| 1222 | - // Pages. |
|
| 1223 | - /* |
|
| 1222 | + // Pages. |
|
| 1223 | + /* |
|
| 1224 | 1224 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1225 | 1225 | * |
| 1226 | 1226 | * @since 3.20.3 |
| 1227 | 1227 | * |
| 1228 | 1228 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1229 | 1229 | */ |
| 1230 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1231 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1232 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
| 1233 | - } |
|
| 1234 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1230 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1231 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1232 | + new Wordlift_Admin_Post_Edit_Page( $that ); |
|
| 1233 | + } |
|
| 1234 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1235 | 1235 | |
| 1236 | - /** Widgets */ |
|
| 1237 | - $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1236 | + /** Widgets */ |
|
| 1237 | + $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1238 | 1238 | |
| 1239 | - // Create an instance of the install wizard. |
|
| 1240 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
| 1239 | + // Create an instance of the install wizard. |
|
| 1240 | + $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
| 1241 | 1241 | |
| 1242 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
| 1242 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
| 1243 | 1243 | |
| 1244 | - // User Profile. |
|
| 1245 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
| 1244 | + // User Profile. |
|
| 1245 | + new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
| 1246 | 1246 | |
| 1247 | - $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1247 | + $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1248 | 1248 | |
| 1249 | - // Load the debug service if WP is in debug mode. |
|
| 1250 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1251 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1252 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
| 1253 | - } |
|
| 1249 | + // Load the debug service if WP is in debug mode. |
|
| 1250 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1251 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1252 | + new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
| 1253 | + } |
|
| 1254 | 1254 | |
| 1255 | - // Remote Image Service. |
|
| 1256 | - new Wordlift_Remote_Image_Service(); |
|
| 1255 | + // Remote Image Service. |
|
| 1256 | + new Wordlift_Remote_Image_Service(); |
|
| 1257 | 1257 | |
| 1258 | - /* |
|
| 1258 | + /* |
|
| 1259 | 1259 | * Provides mappings between post types and entity types. |
| 1260 | 1260 | * |
| 1261 | 1261 | * @since 3.20.0 |
| 1262 | 1262 | * |
| 1263 | 1263 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1264 | 1264 | */ |
| 1265 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1266 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1267 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1265 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1266 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1267 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1268 | 1268 | |
| 1269 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1270 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1269 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1270 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1271 | 1271 | |
| 1272 | - /* |
|
| 1272 | + /* |
|
| 1273 | 1273 | * Load the Mappings JSON-LD post processing. |
| 1274 | 1274 | * |
| 1275 | 1275 | * @since 3.25.0 |
| 1276 | 1276 | */ |
| 1277 | 1277 | |
| 1278 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1279 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1280 | - new Post_Type_Rule_Validator(); |
|
| 1281 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1282 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1283 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1284 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1285 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1286 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1287 | - |
|
| 1288 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
| 1289 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1290 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1291 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1292 | - |
|
| 1293 | - /** |
|
| 1294 | - * @since 3.27.1 |
|
| 1295 | - * Intiailize the acf group data formatter. |
|
| 1296 | - */ |
|
| 1297 | - new Acf_Group_Formatter(); |
|
| 1298 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1299 | - |
|
| 1300 | - /** |
|
| 1301 | - * @since 3.26.0 |
|
| 1302 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1303 | - */ |
|
| 1304 | - // new Faq_To_Jsonld_Converter(); |
|
| 1305 | - /* |
|
| 1278 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1279 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1280 | + new Post_Type_Rule_Validator(); |
|
| 1281 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1282 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1283 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1284 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1285 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1286 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1287 | + |
|
| 1288 | + new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
| 1289 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1290 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1291 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1292 | + |
|
| 1293 | + /** |
|
| 1294 | + * @since 3.27.1 |
|
| 1295 | + * Intiailize the acf group data formatter. |
|
| 1296 | + */ |
|
| 1297 | + new Acf_Group_Formatter(); |
|
| 1298 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1299 | + |
|
| 1300 | + /** |
|
| 1301 | + * @since 3.26.0 |
|
| 1302 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1303 | + */ |
|
| 1304 | + // new Faq_To_Jsonld_Converter(); |
|
| 1305 | + /* |
|
| 1306 | 1306 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1307 | 1307 | * end-point. |
| 1308 | 1308 | * |
| 1309 | 1309 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1310 | 1310 | * @since 3.24.4 |
| 1311 | 1311 | */ |
| 1312 | - new Templates_Ajax_Endpoint(); |
|
| 1313 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1314 | - //Faq_Rest_Controller::register_routes(); |
|
| 1315 | - |
|
| 1316 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
| 1317 | - |
|
| 1318 | - /** WL Autocomplete. */ |
|
| 1319 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1320 | - new Local_Autocomplete_Service(), |
|
| 1321 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
| 1322 | - ) ); |
|
| 1323 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1324 | - |
|
| 1325 | - /** |
|
| 1326 | - * @since 3.27.2 |
|
| 1327 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1328 | - * as default entity type to the wprm_recipe CPT. |
|
| 1329 | - */ |
|
| 1330 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1331 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1332 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1333 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1334 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
| 1335 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1336 | - |
|
| 1337 | - |
|
| 1338 | - /** |
|
| 1339 | - * @since 3.27.4 |
|
| 1340 | - * Add the faq duplicate markup hook. |
|
| 1341 | - */ |
|
| 1342 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1343 | - /** |
|
| 1344 | - * @since 3.33.1 |
|
| 1345 | - * Remove the duplicate HowTo Markup. |
|
| 1346 | - */ |
|
| 1347 | - new How_To_Duplicate_Markup_Remover(); |
|
| 1348 | - |
|
| 1349 | - /** |
|
| 1350 | - * @since 3.27.8 |
|
| 1351 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1352 | - */ |
|
| 1353 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
| 1354 | - /** |
|
| 1355 | - * @since 3.28.0 |
|
| 1356 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1357 | - */ |
|
| 1358 | - new Entity_No_Index_Flag(); |
|
| 1359 | - |
|
| 1360 | - /** |
|
| 1361 | - * @since 3.29.0 |
|
| 1362 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1363 | - */ |
|
| 1364 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1365 | - |
|
| 1366 | - /** |
|
| 1367 | - * Expand author in to references. |
|
| 1368 | - * @since 3.30.0 |
|
| 1369 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1370 | - */ |
|
| 1371 | - |
|
| 1372 | - |
|
| 1373 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1374 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1375 | - } |
|
| 1376 | - |
|
| 1377 | - |
|
| 1378 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1379 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1380 | - $vocabulary_loader->init_vocabulary(); |
|
| 1381 | - } |
|
| 1382 | - |
|
| 1383 | - /** |
|
| 1384 | - *Added for feature request 1496 (Webhooks) |
|
| 1385 | - */ |
|
| 1386 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
| 1387 | - $that->webhook_loader = new Webhooks_Loader(); |
|
| 1388 | - $that->webhook_loader->init(); |
|
| 1389 | - } |
|
| 1390 | - |
|
| 1391 | - /** |
|
| 1392 | - * @since 3.30.0 |
|
| 1393 | - * Add a checkbox to user option screen for wordlift admin. |
|
| 1394 | - */ |
|
| 1395 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1396 | - $wordlift_admin_checkbox->connect_hook(); |
|
| 1397 | - |
|
| 1398 | - /** |
|
| 1399 | - * @since 3.31.0 |
|
| 1400 | - * Init loader class for videoobject. |
|
| 1401 | - */ |
|
| 1402 | - $videoobject_loader = new Loader(); |
|
| 1403 | - $videoobject_loader->init_feature(); |
|
| 1404 | - |
|
| 1405 | - /** |
|
| 1406 | - * @since 3.35.0 |
|
| 1407 | - */ |
|
| 1408 | - $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
| 1409 | - $google_addon_integration_loader->init_feature(); |
|
| 1410 | - |
|
| 1411 | - /** |
|
| 1412 | - * @since 3.31.5 |
|
| 1413 | - * Create configuration endpoint for webapp to configure. |
|
| 1414 | - */ |
|
| 1415 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
| 1416 | - /** |
|
| 1417 | - * @since 3.31.7 |
|
| 1418 | - * Remove duplicate videoobject. |
|
| 1419 | - */ |
|
| 1420 | - new Videoobject_Duplicate_Remover(); |
|
| 1421 | - $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
| 1422 | - $synonym_loader->init_feature(); |
|
| 1423 | - /** |
|
| 1424 | - * @since 3.32.0 |
|
| 1425 | - * Create loader for vocabulary terms. |
|
| 1426 | - */ |
|
| 1427 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
| 1428 | - $vocabulary_terms_loader->init_feature(); |
|
| 1429 | - |
|
| 1430 | - new Entity_Type_Change_Handler( |
|
| 1431 | - Wordlift_Entity_Service::get_instance(), |
|
| 1432 | - Wordlift_Entity_Type_Service::get_instance() |
|
| 1433 | - ); |
|
| 1434 | - |
|
| 1435 | - }, 3 ); |
|
| 1436 | - |
|
| 1437 | - |
|
| 1438 | - new Entity_Type_Setter(); |
|
| 1439 | - $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
| 1440 | - $no_editor_analysis_loader->init_feature(); |
|
| 1441 | - } |
|
| 1442 | - |
|
| 1443 | - /** |
|
| 1444 | - * Define the locale for this plugin for internationalization. |
|
| 1445 | - * |
|
| 1446 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1447 | - * with WordPress. |
|
| 1448 | - * |
|
| 1449 | - * @since 1.0.0 |
|
| 1450 | - * @access private |
|
| 1451 | - */ |
|
| 1452 | - private function set_locale() { |
|
| 1453 | - |
|
| 1454 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1455 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1456 | - |
|
| 1457 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1458 | - |
|
| 1459 | - } |
|
| 1460 | - |
|
| 1461 | - /** |
|
| 1462 | - * Register all of the hooks related to the admin area functionality |
|
| 1463 | - * of the plugin. |
|
| 1464 | - * |
|
| 1465 | - * @since 1.0.0 |
|
| 1466 | - * @access private |
|
| 1467 | - */ |
|
| 1468 | - private function define_admin_hooks( $that ) { |
|
| 1469 | - $plugin_admin = new |
|
| 1470 | - Wordlift_Admin( |
|
| 1471 | - $that->get_plugin_name(), |
|
| 1472 | - $that->get_version(), |
|
| 1473 | - $that->notice_service, |
|
| 1474 | - $that->user_service |
|
| 1475 | - ); |
|
| 1476 | - |
|
| 1477 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1478 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1479 | - |
|
| 1480 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1481 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
| 1482 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
| 1483 | - |
|
| 1484 | - // Hook the admin_init to the settings page. |
|
| 1485 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
| 1486 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
| 1487 | - |
|
| 1488 | - // Hook the admin_init to the analytics settings page. |
|
| 1489 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
| 1490 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
| 1491 | - |
|
| 1492 | - // Hook the init action to taxonomy services. |
|
| 1493 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
| 1494 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1495 | - |
|
| 1496 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1497 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1498 | - |
|
| 1499 | - // Register custom allowed redirect hosts. |
|
| 1500 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1501 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1502 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
| 1503 | - |
|
| 1504 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1505 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1506 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3 ); |
|
| 1507 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1508 | - |
|
| 1509 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
| 1510 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
| 1511 | - |
|
| 1512 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1513 | - // Add custom columns. |
|
| 1514 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
| 1515 | - // no explicit entity as it prevents handling of other post types. |
|
| 1516 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1517 | - // Add 4W selection. |
|
| 1518 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1519 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1520 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
| 1521 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
| 1522 | - |
|
| 1523 | - /* |
|
| 1312 | + new Templates_Ajax_Endpoint(); |
|
| 1313 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1314 | + //Faq_Rest_Controller::register_routes(); |
|
| 1315 | + |
|
| 1316 | + $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
| 1317 | + |
|
| 1318 | + /** WL Autocomplete. */ |
|
| 1319 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1320 | + new Local_Autocomplete_Service(), |
|
| 1321 | + new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
| 1322 | + ) ); |
|
| 1323 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1324 | + |
|
| 1325 | + /** |
|
| 1326 | + * @since 3.27.2 |
|
| 1327 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1328 | + * as default entity type to the wprm_recipe CPT. |
|
| 1329 | + */ |
|
| 1330 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1331 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1332 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1333 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1334 | + new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
| 1335 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1336 | + |
|
| 1337 | + |
|
| 1338 | + /** |
|
| 1339 | + * @since 3.27.4 |
|
| 1340 | + * Add the faq duplicate markup hook. |
|
| 1341 | + */ |
|
| 1342 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1343 | + /** |
|
| 1344 | + * @since 3.33.1 |
|
| 1345 | + * Remove the duplicate HowTo Markup. |
|
| 1346 | + */ |
|
| 1347 | + new How_To_Duplicate_Markup_Remover(); |
|
| 1348 | + |
|
| 1349 | + /** |
|
| 1350 | + * @since 3.27.8 |
|
| 1351 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1352 | + */ |
|
| 1353 | + new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
| 1354 | + /** |
|
| 1355 | + * @since 3.28.0 |
|
| 1356 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1357 | + */ |
|
| 1358 | + new Entity_No_Index_Flag(); |
|
| 1359 | + |
|
| 1360 | + /** |
|
| 1361 | + * @since 3.29.0 |
|
| 1362 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1363 | + */ |
|
| 1364 | + new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1365 | + |
|
| 1366 | + /** |
|
| 1367 | + * Expand author in to references. |
|
| 1368 | + * @since 3.30.0 |
|
| 1369 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1370 | + */ |
|
| 1371 | + |
|
| 1372 | + |
|
| 1373 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1374 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1375 | + } |
|
| 1376 | + |
|
| 1377 | + |
|
| 1378 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1379 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1380 | + $vocabulary_loader->init_vocabulary(); |
|
| 1381 | + } |
|
| 1382 | + |
|
| 1383 | + /** |
|
| 1384 | + *Added for feature request 1496 (Webhooks) |
|
| 1385 | + */ |
|
| 1386 | + if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
| 1387 | + $that->webhook_loader = new Webhooks_Loader(); |
|
| 1388 | + $that->webhook_loader->init(); |
|
| 1389 | + } |
|
| 1390 | + |
|
| 1391 | + /** |
|
| 1392 | + * @since 3.30.0 |
|
| 1393 | + * Add a checkbox to user option screen for wordlift admin. |
|
| 1394 | + */ |
|
| 1395 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1396 | + $wordlift_admin_checkbox->connect_hook(); |
|
| 1397 | + |
|
| 1398 | + /** |
|
| 1399 | + * @since 3.31.0 |
|
| 1400 | + * Init loader class for videoobject. |
|
| 1401 | + */ |
|
| 1402 | + $videoobject_loader = new Loader(); |
|
| 1403 | + $videoobject_loader->init_feature(); |
|
| 1404 | + |
|
| 1405 | + /** |
|
| 1406 | + * @since 3.35.0 |
|
| 1407 | + */ |
|
| 1408 | + $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
| 1409 | + $google_addon_integration_loader->init_feature(); |
|
| 1410 | + |
|
| 1411 | + /** |
|
| 1412 | + * @since 3.31.5 |
|
| 1413 | + * Create configuration endpoint for webapp to configure. |
|
| 1414 | + */ |
|
| 1415 | + new Config( $that->admin_setup, $that->key_validation_service ); |
|
| 1416 | + /** |
|
| 1417 | + * @since 3.31.7 |
|
| 1418 | + * Remove duplicate videoobject. |
|
| 1419 | + */ |
|
| 1420 | + new Videoobject_Duplicate_Remover(); |
|
| 1421 | + $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
| 1422 | + $synonym_loader->init_feature(); |
|
| 1423 | + /** |
|
| 1424 | + * @since 3.32.0 |
|
| 1425 | + * Create loader for vocabulary terms. |
|
| 1426 | + */ |
|
| 1427 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
| 1428 | + $vocabulary_terms_loader->init_feature(); |
|
| 1429 | + |
|
| 1430 | + new Entity_Type_Change_Handler( |
|
| 1431 | + Wordlift_Entity_Service::get_instance(), |
|
| 1432 | + Wordlift_Entity_Type_Service::get_instance() |
|
| 1433 | + ); |
|
| 1434 | + |
|
| 1435 | + }, 3 ); |
|
| 1436 | + |
|
| 1437 | + |
|
| 1438 | + new Entity_Type_Setter(); |
|
| 1439 | + $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
| 1440 | + $no_editor_analysis_loader->init_feature(); |
|
| 1441 | + } |
|
| 1442 | + |
|
| 1443 | + /** |
|
| 1444 | + * Define the locale for this plugin for internationalization. |
|
| 1445 | + * |
|
| 1446 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1447 | + * with WordPress. |
|
| 1448 | + * |
|
| 1449 | + * @since 1.0.0 |
|
| 1450 | + * @access private |
|
| 1451 | + */ |
|
| 1452 | + private function set_locale() { |
|
| 1453 | + |
|
| 1454 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1455 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1456 | + |
|
| 1457 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1458 | + |
|
| 1459 | + } |
|
| 1460 | + |
|
| 1461 | + /** |
|
| 1462 | + * Register all of the hooks related to the admin area functionality |
|
| 1463 | + * of the plugin. |
|
| 1464 | + * |
|
| 1465 | + * @since 1.0.0 |
|
| 1466 | + * @access private |
|
| 1467 | + */ |
|
| 1468 | + private function define_admin_hooks( $that ) { |
|
| 1469 | + $plugin_admin = new |
|
| 1470 | + Wordlift_Admin( |
|
| 1471 | + $that->get_plugin_name(), |
|
| 1472 | + $that->get_version(), |
|
| 1473 | + $that->notice_service, |
|
| 1474 | + $that->user_service |
|
| 1475 | + ); |
|
| 1476 | + |
|
| 1477 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1478 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1479 | + |
|
| 1480 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1481 | + Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
| 1482 | + $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
| 1483 | + |
|
| 1484 | + // Hook the admin_init to the settings page. |
|
| 1485 | + Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
| 1486 | + $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
| 1487 | + |
|
| 1488 | + // Hook the admin_init to the analytics settings page. |
|
| 1489 | + Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
| 1490 | + $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
| 1491 | + |
|
| 1492 | + // Hook the init action to taxonomy services. |
|
| 1493 | + $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
| 1494 | + $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1495 | + |
|
| 1496 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1497 | + $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1498 | + |
|
| 1499 | + // Register custom allowed redirect hosts. |
|
| 1500 | + $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1501 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1502 | + $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
| 1503 | + |
|
| 1504 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1505 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1506 | + $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 3 ); |
|
| 1507 | + $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1508 | + |
|
| 1509 | + $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
| 1510 | + $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
| 1511 | + |
|
| 1512 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1513 | + // Add custom columns. |
|
| 1514 | + $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
| 1515 | + // no explicit entity as it prevents handling of other post types. |
|
| 1516 | + $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1517 | + // Add 4W selection. |
|
| 1518 | + $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1519 | + $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1520 | + $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
| 1521 | + $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
| 1522 | + |
|
| 1523 | + /* |
|
| 1524 | 1524 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1525 | 1525 | * |
| 1526 | 1526 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1527 | 1527 | */ |
| 1528 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1529 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1530 | - } |
|
| 1531 | - |
|
| 1532 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1533 | - // entities. |
|
| 1534 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1535 | - |
|
| 1536 | - /** |
|
| 1537 | - * Filter: wl_feature__enable__settings-download. |
|
| 1538 | - * |
|
| 1539 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1540 | - * |
|
| 1541 | - * @return bool |
|
| 1542 | - * @since 3.27.6 |
|
| 1543 | - */ |
|
| 1544 | - $that->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1545 | - $that, |
|
| 1546 | - 'register_screens' |
|
| 1547 | - ) ); |
|
| 1548 | - |
|
| 1549 | - |
|
| 1550 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1551 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
| 1552 | - |
|
| 1553 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1554 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1555 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1556 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1557 | - |
|
| 1558 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1559 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
| 1560 | - |
|
| 1561 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1562 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
| 1563 | - |
|
| 1564 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
| 1565 | - |
|
| 1566 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1567 | - /** |
|
| 1568 | - * Filter: wl_feature__enable__screens. |
|
| 1569 | - * |
|
| 1570 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1571 | - * |
|
| 1572 | - * @return bool |
|
| 1573 | - * @since 3.27.6 |
|
| 1574 | - * |
|
| 1575 | - * Since 3.30.0 this feature is registered using registry. |
|
| 1576 | - */ |
|
| 1577 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1578 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1579 | - } |
|
| 1580 | - |
|
| 1581 | - // Hook key update. |
|
| 1582 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1583 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
| 1584 | - |
|
| 1585 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1586 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1587 | - |
|
| 1588 | - /* |
|
| 1528 | + if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1529 | + $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1530 | + } |
|
| 1531 | + |
|
| 1532 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1533 | + // entities. |
|
| 1534 | + $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1535 | + |
|
| 1536 | + /** |
|
| 1537 | + * Filter: wl_feature__enable__settings-download. |
|
| 1538 | + * |
|
| 1539 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1540 | + * |
|
| 1541 | + * @return bool |
|
| 1542 | + * @since 3.27.6 |
|
| 1543 | + */ |
|
| 1544 | + $that->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1545 | + $that, |
|
| 1546 | + 'register_screens' |
|
| 1547 | + ) ); |
|
| 1548 | + |
|
| 1549 | + |
|
| 1550 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1551 | + $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
| 1552 | + |
|
| 1553 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1554 | + $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1555 | + $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1556 | + $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1557 | + |
|
| 1558 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1559 | + $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
| 1560 | + |
|
| 1561 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1562 | + $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
| 1563 | + |
|
| 1564 | + $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
| 1565 | + |
|
| 1566 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1567 | + /** |
|
| 1568 | + * Filter: wl_feature__enable__screens. |
|
| 1569 | + * |
|
| 1570 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1571 | + * |
|
| 1572 | + * @return bool |
|
| 1573 | + * @since 3.27.6 |
|
| 1574 | + * |
|
| 1575 | + * Since 3.30.0 this feature is registered using registry. |
|
| 1576 | + */ |
|
| 1577 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1578 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1579 | + } |
|
| 1580 | + |
|
| 1581 | + // Hook key update. |
|
| 1582 | + $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1583 | + $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
| 1584 | + |
|
| 1585 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1586 | + $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1587 | + |
|
| 1588 | + /* |
|
| 1589 | 1589 | * Remove the Analytics Settings link from the plugin page. |
| 1590 | 1590 | * |
| 1591 | 1591 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1592 | 1592 | * @since 3.21.1 |
| 1593 | 1593 | */ |
| 1594 | - // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1595 | - |
|
| 1596 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1597 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
| 1598 | - |
|
| 1599 | - // Hook row actions for the entity type list admin. |
|
| 1600 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1601 | - |
|
| 1602 | - /** Ajax actions. */ |
|
| 1603 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
| 1604 | - |
|
| 1605 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1606 | - // page on WordPress versions before 4.7. |
|
| 1607 | - global $wp_version; |
|
| 1608 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1609 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1610 | - } |
|
| 1611 | - |
|
| 1612 | - /** Adapters. */ |
|
| 1613 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1614 | - /** |
|
| 1615 | - * Disabling Faq temporarily. |
|
| 1616 | - * Load the tinymce editor button on the tool bar. |
|
| 1617 | - * @since 3.26.0 |
|
| 1618 | - */ |
|
| 1619 | - //$that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1620 | - //$that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1621 | - //$that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1622 | - |
|
| 1623 | - |
|
| 1624 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
| 1625 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
| 1626 | - |
|
| 1627 | - /** |
|
| 1628 | - * @since 3.26.0 |
|
| 1629 | - */ |
|
| 1630 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1631 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1632 | - // Adding Rest route for the post excerpt |
|
| 1633 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1634 | - |
|
| 1635 | - // Handle the autocomplete request. |
|
| 1636 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1637 | - $that->autocomplete_adapter, |
|
| 1638 | - 'wl_autocomplete', |
|
| 1639 | - ) ); |
|
| 1640 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1641 | - $that->autocomplete_adapter, |
|
| 1642 | - 'wl_autocomplete', |
|
| 1643 | - ) ); |
|
| 1644 | - |
|
| 1645 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1646 | - if ( is_multisite() ) { |
|
| 1647 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1648 | - } |
|
| 1649 | - |
|
| 1650 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
| 1651 | - |
|
| 1652 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1653 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1654 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( |
|
| 1655 | - $deactivator_feedback, |
|
| 1656 | - 'wl_deactivation_feedback' |
|
| 1657 | - ) ); |
|
| 1658 | - |
|
| 1659 | - /** |
|
| 1660 | - * Always allow the `wordlift/classification` block. |
|
| 1661 | - * |
|
| 1662 | - * @since 3.23.0 |
|
| 1663 | - */ |
|
| 1664 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1665 | - |
|
| 1666 | - if ( true === $value ) { |
|
| 1667 | - return $value; |
|
| 1668 | - } |
|
| 1669 | - |
|
| 1670 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1671 | - }, PHP_INT_MAX ); |
|
| 1672 | - |
|
| 1673 | - /** |
|
| 1674 | - * @since 3.27.7 |
|
| 1675 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1676 | - */ |
|
| 1677 | - new Top_Entities(); |
|
| 1678 | - |
|
| 1679 | - } |
|
| 1680 | - |
|
| 1681 | - /** |
|
| 1682 | - * Register all of the hooks related to the public-facing functionality |
|
| 1683 | - * of the plugin. |
|
| 1684 | - * |
|
| 1685 | - * @since 1.0.0 |
|
| 1686 | - * @access private |
|
| 1687 | - */ |
|
| 1688 | - private function define_public_hooks( $that ) { |
|
| 1689 | - |
|
| 1690 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
| 1691 | - |
|
| 1692 | - // Register the entity post type. |
|
| 1693 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
| 1694 | - |
|
| 1695 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1696 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1697 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1698 | - // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1699 | - // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1700 | - |
|
| 1701 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1702 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1703 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
| 1704 | - |
|
| 1705 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1706 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1707 | - // Hook the content filter service to add entity links. |
|
| 1708 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1709 | - // We run before other filters. |
|
| 1710 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
| 1711 | - } |
|
| 1712 | - |
|
| 1713 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1714 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1715 | - |
|
| 1716 | - // Hook the ShareThis service. |
|
| 1717 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
| 1718 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
| 1719 | - |
|
| 1720 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1721 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1722 | - |
|
| 1723 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1724 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1725 | - // to categories. |
|
| 1726 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1727 | - |
|
| 1728 | - /* |
|
| 1594 | + // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1595 | + |
|
| 1596 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1597 | + $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
| 1598 | + |
|
| 1599 | + // Hook row actions for the entity type list admin. |
|
| 1600 | + $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1601 | + |
|
| 1602 | + /** Ajax actions. */ |
|
| 1603 | + $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
| 1604 | + |
|
| 1605 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1606 | + // page on WordPress versions before 4.7. |
|
| 1607 | + global $wp_version; |
|
| 1608 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1609 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1610 | + } |
|
| 1611 | + |
|
| 1612 | + /** Adapters. */ |
|
| 1613 | + $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1614 | + /** |
|
| 1615 | + * Disabling Faq temporarily. |
|
| 1616 | + * Load the tinymce editor button on the tool bar. |
|
| 1617 | + * @since 3.26.0 |
|
| 1618 | + */ |
|
| 1619 | + //$that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1620 | + //$that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1621 | + //$that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1622 | + |
|
| 1623 | + |
|
| 1624 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
| 1625 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
| 1626 | + |
|
| 1627 | + /** |
|
| 1628 | + * @since 3.26.0 |
|
| 1629 | + */ |
|
| 1630 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1631 | + $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1632 | + // Adding Rest route for the post excerpt |
|
| 1633 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1634 | + |
|
| 1635 | + // Handle the autocomplete request. |
|
| 1636 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1637 | + $that->autocomplete_adapter, |
|
| 1638 | + 'wl_autocomplete', |
|
| 1639 | + ) ); |
|
| 1640 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1641 | + $that->autocomplete_adapter, |
|
| 1642 | + 'wl_autocomplete', |
|
| 1643 | + ) ); |
|
| 1644 | + |
|
| 1645 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1646 | + if ( is_multisite() ) { |
|
| 1647 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1648 | + } |
|
| 1649 | + |
|
| 1650 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
| 1651 | + |
|
| 1652 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1653 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1654 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( |
|
| 1655 | + $deactivator_feedback, |
|
| 1656 | + 'wl_deactivation_feedback' |
|
| 1657 | + ) ); |
|
| 1658 | + |
|
| 1659 | + /** |
|
| 1660 | + * Always allow the `wordlift/classification` block. |
|
| 1661 | + * |
|
| 1662 | + * @since 3.23.0 |
|
| 1663 | + */ |
|
| 1664 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1665 | + |
|
| 1666 | + if ( true === $value ) { |
|
| 1667 | + return $value; |
|
| 1668 | + } |
|
| 1669 | + |
|
| 1670 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1671 | + }, PHP_INT_MAX ); |
|
| 1672 | + |
|
| 1673 | + /** |
|
| 1674 | + * @since 3.27.7 |
|
| 1675 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1676 | + */ |
|
| 1677 | + new Top_Entities(); |
|
| 1678 | + |
|
| 1679 | + } |
|
| 1680 | + |
|
| 1681 | + /** |
|
| 1682 | + * Register all of the hooks related to the public-facing functionality |
|
| 1683 | + * of the plugin. |
|
| 1684 | + * |
|
| 1685 | + * @since 1.0.0 |
|
| 1686 | + * @access private |
|
| 1687 | + */ |
|
| 1688 | + private function define_public_hooks( $that ) { |
|
| 1689 | + |
|
| 1690 | + $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
| 1691 | + |
|
| 1692 | + // Register the entity post type. |
|
| 1693 | + $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
| 1694 | + |
|
| 1695 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1696 | + $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1697 | + $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1698 | + // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1699 | + // $that->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $that->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1700 | + |
|
| 1701 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1702 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1703 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
| 1704 | + |
|
| 1705 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1706 | + $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1707 | + // Hook the content filter service to add entity links. |
|
| 1708 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1709 | + // We run before other filters. |
|
| 1710 | + $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
| 1711 | + } |
|
| 1712 | + |
|
| 1713 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1714 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1715 | + |
|
| 1716 | + // Hook the ShareThis service. |
|
| 1717 | + $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
| 1718 | + $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
| 1719 | + |
|
| 1720 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1721 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1722 | + |
|
| 1723 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1724 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1725 | + // to categories. |
|
| 1726 | + $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1727 | + |
|
| 1728 | + /* |
|
| 1729 | 1729 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1730 | 1730 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1731 | 1731 | * order of start time. |
| 1732 | 1732 | */ |
| 1733 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1734 | - |
|
| 1735 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1736 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1737 | - |
|
| 1738 | - // Analytics Script Frontend. |
|
| 1739 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
| 1740 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1741 | - } |
|
| 1742 | - |
|
| 1743 | - } |
|
| 1744 | - |
|
| 1745 | - /** |
|
| 1746 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1747 | - * |
|
| 1748 | - * @since 1.0.0 |
|
| 1749 | - */ |
|
| 1750 | - public function run() { |
|
| 1751 | - $this->loader->run(); |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - /** |
|
| 1755 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1756 | - * WordPress and to define internationalization functionality. |
|
| 1757 | - * |
|
| 1758 | - * @return string The name of the plugin. |
|
| 1759 | - * @since 1.0.0 |
|
| 1760 | - */ |
|
| 1761 | - public function get_plugin_name() { |
|
| 1762 | - return $this->plugin_name; |
|
| 1763 | - } |
|
| 1764 | - |
|
| 1765 | - /** |
|
| 1766 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1767 | - * |
|
| 1768 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1769 | - * @since 1.0.0 |
|
| 1770 | - */ |
|
| 1771 | - public function get_loader() { |
|
| 1772 | - return $this->loader; |
|
| 1773 | - } |
|
| 1774 | - |
|
| 1775 | - /** |
|
| 1776 | - * Retrieve the version number of the plugin. |
|
| 1777 | - * |
|
| 1778 | - * @return string The version number of the plugin. |
|
| 1779 | - * @since 1.0.0 |
|
| 1780 | - */ |
|
| 1781 | - public function get_version() { |
|
| 1782 | - return $this->version; |
|
| 1783 | - } |
|
| 1784 | - |
|
| 1785 | - /** |
|
| 1786 | - * Load dependencies for WP-CLI. |
|
| 1787 | - * |
|
| 1788 | - * @throws Exception |
|
| 1789 | - * @since 3.18.0 |
|
| 1790 | - */ |
|
| 1791 | - private function load_cli_dependencies() { |
|
| 1792 | - |
|
| 1793 | - } |
|
| 1794 | - |
|
| 1795 | - public function add_wl_enabled_blocks() { |
|
| 1796 | - /** |
|
| 1797 | - * Filter: wl_feature__enable__blocks. |
|
| 1798 | - * |
|
| 1799 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1800 | - * |
|
| 1801 | - * @return bool |
|
| 1802 | - * @since 3.27.6 |
|
| 1803 | - */ |
|
| 1804 | - |
|
| 1805 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1806 | - |
|
| 1807 | - $enabled_blocks = array(); |
|
| 1808 | - |
|
| 1809 | - /** |
|
| 1810 | - * Filter name: wl_feature__enable__product-navigator |
|
| 1811 | - * @since 3.32.3 |
|
| 1812 | - */ |
|
| 1813 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
| 1814 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 1815 | - } |
|
| 1816 | - |
|
| 1817 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1818 | - // To intimate JS |
|
| 1819 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 1820 | - 'wordlift/navigator', |
|
| 1821 | - 'wordlift/chord', |
|
| 1822 | - 'wordlift/geomap', |
|
| 1823 | - 'wordlift/timeline', |
|
| 1824 | - 'wordlift/cloud', |
|
| 1825 | - 'wordlift/vocabulary', |
|
| 1826 | - 'wordlift/faceted-search' |
|
| 1827 | - ) ); |
|
| 1828 | - } |
|
| 1829 | - |
|
| 1830 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1831 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1832 | - } |
|
| 1833 | - |
|
| 1834 | - /** |
|
| 1835 | - * Register screens based on the filter. |
|
| 1836 | - */ |
|
| 1837 | - public function register_screens() { |
|
| 1838 | - // Hook the menu to the Download Your Data page. |
|
| 1839 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 1840 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
| 1841 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 1842 | - } |
|
| 1843 | - |
|
| 1844 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
| 1845 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 1846 | - |
|
| 1847 | - } |
|
| 1733 | + $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1734 | + |
|
| 1735 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1736 | + $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1737 | + |
|
| 1738 | + // Analytics Script Frontend. |
|
| 1739 | + if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
| 1740 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1741 | + } |
|
| 1742 | + |
|
| 1743 | + } |
|
| 1744 | + |
|
| 1745 | + /** |
|
| 1746 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1747 | + * |
|
| 1748 | + * @since 1.0.0 |
|
| 1749 | + */ |
|
| 1750 | + public function run() { |
|
| 1751 | + $this->loader->run(); |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + /** |
|
| 1755 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1756 | + * WordPress and to define internationalization functionality. |
|
| 1757 | + * |
|
| 1758 | + * @return string The name of the plugin. |
|
| 1759 | + * @since 1.0.0 |
|
| 1760 | + */ |
|
| 1761 | + public function get_plugin_name() { |
|
| 1762 | + return $this->plugin_name; |
|
| 1763 | + } |
|
| 1764 | + |
|
| 1765 | + /** |
|
| 1766 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1767 | + * |
|
| 1768 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1769 | + * @since 1.0.0 |
|
| 1770 | + */ |
|
| 1771 | + public function get_loader() { |
|
| 1772 | + return $this->loader; |
|
| 1773 | + } |
|
| 1774 | + |
|
| 1775 | + /** |
|
| 1776 | + * Retrieve the version number of the plugin. |
|
| 1777 | + * |
|
| 1778 | + * @return string The version number of the plugin. |
|
| 1779 | + * @since 1.0.0 |
|
| 1780 | + */ |
|
| 1781 | + public function get_version() { |
|
| 1782 | + return $this->version; |
|
| 1783 | + } |
|
| 1784 | + |
|
| 1785 | + /** |
|
| 1786 | + * Load dependencies for WP-CLI. |
|
| 1787 | + * |
|
| 1788 | + * @throws Exception |
|
| 1789 | + * @since 3.18.0 |
|
| 1790 | + */ |
|
| 1791 | + private function load_cli_dependencies() { |
|
| 1792 | + |
|
| 1793 | + } |
|
| 1794 | + |
|
| 1795 | + public function add_wl_enabled_blocks() { |
|
| 1796 | + /** |
|
| 1797 | + * Filter: wl_feature__enable__blocks. |
|
| 1798 | + * |
|
| 1799 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1800 | + * |
|
| 1801 | + * @return bool |
|
| 1802 | + * @since 3.27.6 |
|
| 1803 | + */ |
|
| 1804 | + |
|
| 1805 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1806 | + |
|
| 1807 | + $enabled_blocks = array(); |
|
| 1808 | + |
|
| 1809 | + /** |
|
| 1810 | + * Filter name: wl_feature__enable__product-navigator |
|
| 1811 | + * @since 3.32.3 |
|
| 1812 | + */ |
|
| 1813 | + if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
| 1814 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 1815 | + } |
|
| 1816 | + |
|
| 1817 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1818 | + // To intimate JS |
|
| 1819 | + $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 1820 | + 'wordlift/navigator', |
|
| 1821 | + 'wordlift/chord', |
|
| 1822 | + 'wordlift/geomap', |
|
| 1823 | + 'wordlift/timeline', |
|
| 1824 | + 'wordlift/cloud', |
|
| 1825 | + 'wordlift/vocabulary', |
|
| 1826 | + 'wordlift/faceted-search' |
|
| 1827 | + ) ); |
|
| 1828 | + } |
|
| 1829 | + |
|
| 1830 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1831 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1832 | + } |
|
| 1833 | + |
|
| 1834 | + /** |
|
| 1835 | + * Register screens based on the filter. |
|
| 1836 | + */ |
|
| 1837 | + public function register_screens() { |
|
| 1838 | + // Hook the menu to the Download Your Data page. |
|
| 1839 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 1840 | + Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
| 1841 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 1842 | + } |
|
| 1843 | + |
|
| 1844 | + Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
| 1845 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 1846 | + |
|
| 1847 | + } |
|
| 1848 | 1848 | |
| 1849 | 1849 | } |
@@ -21,63 +21,63 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | class Wl_Metabox_Field_Date extends Wl_Metabox_Field { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Attribute to distinguish between date formats, inferred from the schema property export type |
|
| 26 | - * |
|
| 27 | - * @since 3.2.0 |
|
| 28 | - * @access protected |
|
| 29 | - * @var string $date_format The date format. |
|
| 30 | - */ |
|
| 31 | - protected $date_format; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Boolean flag to decide if the calendar should include time or not |
|
| 35 | - * |
|
| 36 | - * @since 3.2.0 |
|
| 37 | - * @access protected |
|
| 38 | - * @var boolean $timepicker A boolean flag. |
|
| 39 | - */ |
|
| 40 | - protected $timepicker; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Whether the calendar should be displayed or not. |
|
| 44 | - * |
|
| 45 | - * @since 3.14.0 |
|
| 46 | - * @access protected |
|
| 47 | - * @var boolean $no_calendar Whether the calendar should be displayed or not. |
|
| 48 | - */ |
|
| 49 | - protected $no_calendar; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * {@inheritdoc} |
|
| 53 | - */ |
|
| 54 | - public function __construct( $args, $id, $type ) { |
|
| 55 | - parent::__construct( $args, $id, $type ); |
|
| 56 | - |
|
| 57 | - $this->no_calendar = false; |
|
| 58 | - |
|
| 59 | - // Distinguish between date and datetime |
|
| 60 | - if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) { |
|
| 61 | - $this->date_format = 'Y/m/d H:i'; |
|
| 62 | - $this->timepicker = true; |
|
| 63 | - } else { |
|
| 64 | - $this->date_format = 'Y/m/d'; |
|
| 65 | - $this->timepicker = false; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @param mixed $date |
|
| 72 | - * |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 75 | - public function html_input( $date ) { |
|
| 76 | - |
|
| 77 | - $this->log->debug( "Creating date input with date value $date..." ); |
|
| 78 | - |
|
| 79 | - ob_start(); |
|
| 80 | - ?> |
|
| 24 | + /** |
|
| 25 | + * Attribute to distinguish between date formats, inferred from the schema property export type |
|
| 26 | + * |
|
| 27 | + * @since 3.2.0 |
|
| 28 | + * @access protected |
|
| 29 | + * @var string $date_format The date format. |
|
| 30 | + */ |
|
| 31 | + protected $date_format; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Boolean flag to decide if the calendar should include time or not |
|
| 35 | + * |
|
| 36 | + * @since 3.2.0 |
|
| 37 | + * @access protected |
|
| 38 | + * @var boolean $timepicker A boolean flag. |
|
| 39 | + */ |
|
| 40 | + protected $timepicker; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Whether the calendar should be displayed or not. |
|
| 44 | + * |
|
| 45 | + * @since 3.14.0 |
|
| 46 | + * @access protected |
|
| 47 | + * @var boolean $no_calendar Whether the calendar should be displayed or not. |
|
| 48 | + */ |
|
| 49 | + protected $no_calendar; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * {@inheritdoc} |
|
| 53 | + */ |
|
| 54 | + public function __construct( $args, $id, $type ) { |
|
| 55 | + parent::__construct( $args, $id, $type ); |
|
| 56 | + |
|
| 57 | + $this->no_calendar = false; |
|
| 58 | + |
|
| 59 | + // Distinguish between date and datetime |
|
| 60 | + if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) { |
|
| 61 | + $this->date_format = 'Y/m/d H:i'; |
|
| 62 | + $this->timepicker = true; |
|
| 63 | + } else { |
|
| 64 | + $this->date_format = 'Y/m/d'; |
|
| 65 | + $this->timepicker = false; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @param mixed $date |
|
| 72 | + * |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | + public function html_input( $date ) { |
|
| 76 | + |
|
| 77 | + $this->log->debug( "Creating date input with date value $date..." ); |
|
| 78 | + |
|
| 79 | + ob_start(); |
|
| 80 | + ?> |
|
| 81 | 81 | <div class="wl-input-wrapper"> |
| 82 | 82 | <input |
| 83 | 83 | type="text" |
@@ -92,32 +92,32 @@ discard block |
||
| 92 | 92 | </button> |
| 93 | 93 | </div> |
| 94 | 94 | <?php |
| 95 | - $html = ob_get_clean(); |
|
| 95 | + $html = ob_get_clean(); |
|
| 96 | 96 | |
| 97 | - return $html; |
|
| 98 | - } |
|
| 97 | + return $html; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - public function html_wrapper_close() { |
|
| 100 | + public function html_wrapper_close() { |
|
| 101 | 101 | |
| 102 | - // Should the widget include time picker? |
|
| 103 | - $timepicker = json_encode( $this->timepicker ); |
|
| 104 | - $date_format = json_encode( $this->date_format ); |
|
| 105 | - $no_calendar = json_encode( $this->no_calendar ); |
|
| 102 | + // Should the widget include time picker? |
|
| 103 | + $timepicker = json_encode( $this->timepicker ); |
|
| 104 | + $date_format = json_encode( $this->date_format ); |
|
| 105 | + $no_calendar = json_encode( $this->no_calendar ); |
|
| 106 | 106 | |
| 107 | - // Set up the datetimepicker. |
|
| 108 | - // |
|
| 109 | - // See https://github.com/trentrichardson/jQuery-Timepicker-Addon |
|
| 110 | - // See in http://trentrichardson.com/examples/timepicker. |
|
| 107 | + // Set up the datetimepicker. |
|
| 108 | + // |
|
| 109 | + // See https://github.com/trentrichardson/jQuery-Timepicker-Addon |
|
| 110 | + // See in http://trentrichardson.com/examples/timepicker. |
|
| 111 | 111 | |
| 112 | - $js = wp_json_encode( array( |
|
| 113 | - 'enableTime' => $timepicker, |
|
| 114 | - 'noCalendar' => $no_calendar, |
|
| 115 | - 'time_24hr' => true, |
|
| 116 | - 'dateFormat' => $date_format, |
|
| 117 | - ) ); |
|
| 112 | + $js = wp_json_encode( array( |
|
| 113 | + 'enableTime' => $timepicker, |
|
| 114 | + 'noCalendar' => $no_calendar, |
|
| 115 | + 'time_24hr' => true, |
|
| 116 | + 'dateFormat' => $date_format, |
|
| 117 | + ) ); |
|
| 118 | 118 | |
| 119 | - @ob_start(); |
|
| 120 | - ?> |
|
| 119 | + @ob_start(); |
|
| 120 | + ?> |
|
| 121 | 121 | <script type='text/javascript'> |
| 122 | 122 | (function ($) { |
| 123 | 123 | $(function () { |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | })(jQuery); |
| 127 | 127 | </script> |
| 128 | 128 | <?php |
| 129 | - $html = ob_get_clean(); |
|
| 129 | + $html = ob_get_clean(); |
|
| 130 | 130 | |
| 131 | - $html .= parent::html_wrapper_close(); |
|
| 131 | + $html .= parent::html_wrapper_close(); |
|
| 132 | 132 | |
| 133 | - return $html; |
|
| 134 | - } |
|
| 133 | + return $html; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | } |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * {@inheritdoc} |
| 53 | 53 | */ |
| 54 | - public function __construct( $args, $id, $type ) { |
|
| 55 | - parent::__construct( $args, $id, $type ); |
|
| 54 | + public function __construct($args, $id, $type) { |
|
| 55 | + parent::__construct($args, $id, $type); |
|
| 56 | 56 | |
| 57 | 57 | $this->no_calendar = false; |
| 58 | 58 | |
| 59 | 59 | // Distinguish between date and datetime |
| 60 | - if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) { |
|
| 60 | + if (isset($this->raw_custom_field['export_type']) && 'xsd:dateTime' === $this->raw_custom_field['export_type']) { |
|
| 61 | 61 | $this->date_format = 'Y/m/d H:i'; |
| 62 | 62 | $this->timepicker = true; |
| 63 | 63 | } else { |
@@ -72,23 +72,23 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return string |
| 74 | 74 | */ |
| 75 | - public function html_input( $date ) { |
|
| 75 | + public function html_input($date) { |
|
| 76 | 76 | |
| 77 | - $this->log->debug( "Creating date input with date value $date..." ); |
|
| 77 | + $this->log->debug("Creating date input with date value $date..."); |
|
| 78 | 78 | |
| 79 | 79 | ob_start(); |
| 80 | 80 | ?> |
| 81 | 81 | <div class="wl-input-wrapper"> |
| 82 | 82 | <input |
| 83 | 83 | type="text" |
| 84 | - class="<?php echo esc_attr( $this->meta_name ); ?>" |
|
| 85 | - name="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][]" |
|
| 86 | - value="<?php echo esc_attr( $date ); ?>" |
|
| 84 | + class="<?php echo esc_attr($this->meta_name); ?>" |
|
| 85 | + name="wl_metaboxes[<?php echo esc_attr($this->meta_name); ?>][]" |
|
| 86 | + value="<?php echo esc_attr($date); ?>" |
|
| 87 | 87 | style="width:88%" |
| 88 | 88 | /> |
| 89 | 89 | |
| 90 | 90 | <button class="button wl-remove-input wl-button" type="button"> |
| 91 | - <?php esc_html_e( 'Remove', 'wordlift' ); ?> |
|
| 91 | + <?php esc_html_e('Remove', 'wordlift'); ?> |
|
| 92 | 92 | </button> |
| 93 | 93 | </div> |
| 94 | 94 | <?php |
@@ -100,28 +100,28 @@ discard block |
||
| 100 | 100 | public function html_wrapper_close() { |
| 101 | 101 | |
| 102 | 102 | // Should the widget include time picker? |
| 103 | - $timepicker = json_encode( $this->timepicker ); |
|
| 104 | - $date_format = json_encode( $this->date_format ); |
|
| 105 | - $no_calendar = json_encode( $this->no_calendar ); |
|
| 103 | + $timepicker = json_encode($this->timepicker); |
|
| 104 | + $date_format = json_encode($this->date_format); |
|
| 105 | + $no_calendar = json_encode($this->no_calendar); |
|
| 106 | 106 | |
| 107 | 107 | // Set up the datetimepicker. |
| 108 | 108 | // |
| 109 | 109 | // See https://github.com/trentrichardson/jQuery-Timepicker-Addon |
| 110 | 110 | // See in http://trentrichardson.com/examples/timepicker. |
| 111 | 111 | |
| 112 | - $js = wp_json_encode( array( |
|
| 112 | + $js = wp_json_encode(array( |
|
| 113 | 113 | 'enableTime' => $timepicker, |
| 114 | 114 | 'noCalendar' => $no_calendar, |
| 115 | 115 | 'time_24hr' => true, |
| 116 | 116 | 'dateFormat' => $date_format, |
| 117 | - ) ); |
|
| 117 | + )); |
|
| 118 | 118 | |
| 119 | 119 | @ob_start(); |
| 120 | 120 | ?> |
| 121 | 121 | <script type='text/javascript'> |
| 122 | 122 | (function ($) { |
| 123 | 123 | $(function () { |
| 124 | - $('.<?php echo esc_js( $this->meta_name ); ?>[type=text]').flatpickr(<?php echo $js; ?>); |
|
| 124 | + $('.<?php echo esc_js($this->meta_name); ?>[type=text]').flatpickr(<?php echo $js; ?>); |
|
| 125 | 125 | }); |
| 126 | 126 | })(jQuery); |
| 127 | 127 | </script> |