@@ -27,358 +27,358 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class WL_Metabox { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * The metabox custom fields for the current {@link WP_Post}. |
|
| 32 | - * |
|
| 33 | - * @since 3.1.0 |
|
| 34 | - * @access public |
|
| 35 | - * @var array $fields The metabox custom fields. |
|
| 36 | - */ |
|
| 37 | - public $fields; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * A {@link Wordlift_Log_Service} instance. |
|
| 41 | - * |
|
| 42 | - * @since 3.15.4 |
|
| 43 | - * |
|
| 44 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 45 | - */ |
|
| 46 | - private $log; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * WL_Metabox constructor. |
|
| 50 | - * |
|
| 51 | - * @since 3.1.0 |
|
| 52 | - */ |
|
| 53 | - public function __construct() { |
|
| 54 | - |
|
| 55 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Filter: wl_feature__enable__metabox. |
|
| 59 | - * |
|
| 60 | - * @param bool whether the metabox should be shown, defaults to true. |
|
| 61 | - * |
|
| 62 | - * @return bool |
|
| 63 | - * @since 3.28.1 |
|
| 64 | - */ |
|
| 65 | - if ( apply_filters( 'wl_feature__enable__metabox', true ) ) { |
|
| 66 | - |
|
| 67 | - // Add hooks to print metaboxes and save submitted data. |
|
| 68 | - add_action( 'add_meta_boxes', array( $this, 'add_main_metabox' ) ); |
|
| 69 | - add_action( 'wl_linked_data_save_post', array( $this, 'save_form_data', ) ); |
|
| 70 | - |
|
| 71 | - // Enqueue js and css. |
|
| 72 | - $this->enqueue_scripts_and_styles(); |
|
| 73 | - |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Add a callback to print the metabox in page. |
|
| 80 | - * Wordpress will fire the $this->html() callback at the right time. |
|
| 81 | - */ |
|
| 82 | - public function add_main_metabox() { |
|
| 83 | - |
|
| 84 | - // Build the fields we need to print. |
|
| 85 | - $this->instantiate_fields( get_the_ID() ); |
|
| 86 | - |
|
| 87 | - // Bailout if there are no actual fields, we do not need a metabox in that case. |
|
| 88 | - if ( empty( $this->fields ) ) { |
|
| 89 | - return; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - // Add main metabox (will print also the inner fields). |
|
| 93 | - $id = uniqid( 'wl-metabox-' ); |
|
| 94 | - $title = get_the_title() . ' ' . __( 'properties', 'wordlift' ); |
|
| 95 | - |
|
| 96 | - // WordPress 4.2 do not accept an array of screens as parameter, have to do be explicit. |
|
| 97 | - foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $screen ) { |
|
| 98 | - add_meta_box( $id, $title, array( |
|
| 99 | - $this, |
|
| 100 | - 'html', |
|
| 101 | - ), $screen, 'normal', 'high' ); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - // Add filter to change the metabox CSS class. |
|
| 105 | - // |
|
| 106 | - // @since 3.20.0 Since we support post types other than `entity` for entities, we need to set the `screen` |
|
| 107 | - // dynamically according to the `get_current_screen()` function. |
|
| 108 | - $current_screen = get_current_screen(); |
|
| 109 | - $screen = $current_screen ? $current_screen->post_type : 'entity'; |
|
| 110 | - add_filter( "postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class' ); |
|
| 111 | - |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Called from WP to print the metabox content in page. |
|
| 116 | - * |
|
| 117 | - * @param WP_Post $post The post. |
|
| 118 | - * |
|
| 119 | - * @since 3.1.0 |
|
| 120 | - * |
|
| 121 | - */ |
|
| 122 | - public function html( $post ) { |
|
| 123 | - |
|
| 124 | - // Loop over the fields. |
|
| 125 | - foreach ( $this->fields as $field ) { |
|
| 126 | - |
|
| 127 | - // load data from DB (values will be available in $field->data). |
|
| 128 | - $field->get_data(); |
|
| 129 | - |
|
| 130 | - // print field HTML (nonce included). |
|
| 131 | - echo $field->html(); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Read the WL <-> Schema mapping and build the Fields for the entity being edited. |
|
| 138 | - * |
|
| 139 | - * Note: the first function that calls this method will instantiate the fields. |
|
| 140 | - * Why it isn't called from the constructor? Because we need to hook this process as late as possible. |
|
| 141 | - * |
|
| 142 | - * @param int $post_id The post id. |
|
| 143 | - * |
|
| 144 | - * @since 3.1.0 |
|
| 145 | - * |
|
| 146 | - */ |
|
| 147 | - public function instantiate_fields( $post_id ) { |
|
| 148 | - |
|
| 149 | - $this->log->trace( "Instantiating fields for entity post $post_id..." ); |
|
| 150 | - |
|
| 151 | - // This function must be called only once. Not called from the constructor because WP hooks have a rococo ordering. |
|
| 152 | - if ( isset( $this->fields ) ) { |
|
| 153 | - return; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - $entity_type = wl_entity_taxonomy_get_custom_fields( $post_id ); |
|
| 157 | - |
|
| 158 | - if ( isset( $entity_type ) ) { |
|
| 159 | - |
|
| 160 | - /* |
|
| 30 | + /** |
|
| 31 | + * The metabox custom fields for the current {@link WP_Post}. |
|
| 32 | + * |
|
| 33 | + * @since 3.1.0 |
|
| 34 | + * @access public |
|
| 35 | + * @var array $fields The metabox custom fields. |
|
| 36 | + */ |
|
| 37 | + public $fields; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * A {@link Wordlift_Log_Service} instance. |
|
| 41 | + * |
|
| 42 | + * @since 3.15.4 |
|
| 43 | + * |
|
| 44 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 45 | + */ |
|
| 46 | + private $log; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * WL_Metabox constructor. |
|
| 50 | + * |
|
| 51 | + * @since 3.1.0 |
|
| 52 | + */ |
|
| 53 | + public function __construct() { |
|
| 54 | + |
|
| 55 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Filter: wl_feature__enable__metabox. |
|
| 59 | + * |
|
| 60 | + * @param bool whether the metabox should be shown, defaults to true. |
|
| 61 | + * |
|
| 62 | + * @return bool |
|
| 63 | + * @since 3.28.1 |
|
| 64 | + */ |
|
| 65 | + if ( apply_filters( 'wl_feature__enable__metabox', true ) ) { |
|
| 66 | + |
|
| 67 | + // Add hooks to print metaboxes and save submitted data. |
|
| 68 | + add_action( 'add_meta_boxes', array( $this, 'add_main_metabox' ) ); |
|
| 69 | + add_action( 'wl_linked_data_save_post', array( $this, 'save_form_data', ) ); |
|
| 70 | + |
|
| 71 | + // Enqueue js and css. |
|
| 72 | + $this->enqueue_scripts_and_styles(); |
|
| 73 | + |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Add a callback to print the metabox in page. |
|
| 80 | + * Wordpress will fire the $this->html() callback at the right time. |
|
| 81 | + */ |
|
| 82 | + public function add_main_metabox() { |
|
| 83 | + |
|
| 84 | + // Build the fields we need to print. |
|
| 85 | + $this->instantiate_fields( get_the_ID() ); |
|
| 86 | + |
|
| 87 | + // Bailout if there are no actual fields, we do not need a metabox in that case. |
|
| 88 | + if ( empty( $this->fields ) ) { |
|
| 89 | + return; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + // Add main metabox (will print also the inner fields). |
|
| 93 | + $id = uniqid( 'wl-metabox-' ); |
|
| 94 | + $title = get_the_title() . ' ' . __( 'properties', 'wordlift' ); |
|
| 95 | + |
|
| 96 | + // WordPress 4.2 do not accept an array of screens as parameter, have to do be explicit. |
|
| 97 | + foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $screen ) { |
|
| 98 | + add_meta_box( $id, $title, array( |
|
| 99 | + $this, |
|
| 100 | + 'html', |
|
| 101 | + ), $screen, 'normal', 'high' ); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + // Add filter to change the metabox CSS class. |
|
| 105 | + // |
|
| 106 | + // @since 3.20.0 Since we support post types other than `entity` for entities, we need to set the `screen` |
|
| 107 | + // dynamically according to the `get_current_screen()` function. |
|
| 108 | + $current_screen = get_current_screen(); |
|
| 109 | + $screen = $current_screen ? $current_screen->post_type : 'entity'; |
|
| 110 | + add_filter( "postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class' ); |
|
| 111 | + |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Called from WP to print the metabox content in page. |
|
| 116 | + * |
|
| 117 | + * @param WP_Post $post The post. |
|
| 118 | + * |
|
| 119 | + * @since 3.1.0 |
|
| 120 | + * |
|
| 121 | + */ |
|
| 122 | + public function html( $post ) { |
|
| 123 | + |
|
| 124 | + // Loop over the fields. |
|
| 125 | + foreach ( $this->fields as $field ) { |
|
| 126 | + |
|
| 127 | + // load data from DB (values will be available in $field->data). |
|
| 128 | + $field->get_data(); |
|
| 129 | + |
|
| 130 | + // print field HTML (nonce included). |
|
| 131 | + echo $field->html(); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Read the WL <-> Schema mapping and build the Fields for the entity being edited. |
|
| 138 | + * |
|
| 139 | + * Note: the first function that calls this method will instantiate the fields. |
|
| 140 | + * Why it isn't called from the constructor? Because we need to hook this process as late as possible. |
|
| 141 | + * |
|
| 142 | + * @param int $post_id The post id. |
|
| 143 | + * |
|
| 144 | + * @since 3.1.0 |
|
| 145 | + * |
|
| 146 | + */ |
|
| 147 | + public function instantiate_fields( $post_id ) { |
|
| 148 | + |
|
| 149 | + $this->log->trace( "Instantiating fields for entity post $post_id..." ); |
|
| 150 | + |
|
| 151 | + // This function must be called only once. Not called from the constructor because WP hooks have a rococo ordering. |
|
| 152 | + if ( isset( $this->fields ) ) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + $entity_type = wl_entity_taxonomy_get_custom_fields( $post_id ); |
|
| 157 | + |
|
| 158 | + if ( isset( $entity_type ) ) { |
|
| 159 | + |
|
| 160 | + /* |
|
| 161 | 161 | * Might not have any relevant meta box field, for example for articles, |
| 162 | 162 | * therefor make sure fields are at least an empty array to help the considered |
| 163 | 163 | * in other functions using it. |
| 164 | 164 | */ |
| 165 | - $this->fields = array(); |
|
| 165 | + $this->fields = array(); |
|
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * In some special case, properties must be grouped in one field (e.g. coordinates) or dealed with custom methods. |
|
| 169 | - * We must divide fields in two groups: |
|
| 170 | - * - simple: accept values for one property |
|
| 171 | - * - grouped: accept values for more properties, or for one property that needs a specific metabox. |
|
| 172 | - */ |
|
| 173 | - $metaboxes = $this->group_properties_by_input_field( $entity_type ); |
|
| 174 | - $simple_metaboxes = $metaboxes[0]; |
|
| 175 | - $grouped_metaboxes = $metaboxes[1]; |
|
| 167 | + /** |
|
| 168 | + * In some special case, properties must be grouped in one field (e.g. coordinates) or dealed with custom methods. |
|
| 169 | + * We must divide fields in two groups: |
|
| 170 | + * - simple: accept values for one property |
|
| 171 | + * - grouped: accept values for more properties, or for one property that needs a specific metabox. |
|
| 172 | + */ |
|
| 173 | + $metaboxes = $this->group_properties_by_input_field( $entity_type ); |
|
| 174 | + $simple_metaboxes = $metaboxes[0]; |
|
| 175 | + $grouped_metaboxes = $metaboxes[1]; |
|
| 176 | 176 | |
| 177 | - // Loop over simple entity properties. |
|
| 178 | - foreach ( $simple_metaboxes as $key => $property ) { |
|
| 177 | + // Loop over simple entity properties. |
|
| 178 | + foreach ( $simple_metaboxes as $key => $property ) { |
|
| 179 | 179 | |
| 180 | - // Info passed to the metabox. |
|
| 181 | - $info = array(); |
|
| 182 | - $info[ $key ] = $property; |
|
| 180 | + // Info passed to the metabox. |
|
| 181 | + $info = array(); |
|
| 182 | + $info[ $key ] = $property; |
|
| 183 | 183 | |
| 184 | - // Build the requested field as WL_Metabox_Field_ object. |
|
| 185 | - $this->add_field( $info ); |
|
| 184 | + // Build the requested field as WL_Metabox_Field_ object. |
|
| 185 | + $this->add_field( $info ); |
|
| 186 | 186 | |
| 187 | - } |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - // Loop over grouped properties. |
|
| 190 | - foreach ( $grouped_metaboxes as $key => $property ) { |
|
| 189 | + // Loop over grouped properties. |
|
| 190 | + foreach ( $grouped_metaboxes as $key => $property ) { |
|
| 191 | 191 | |
| 192 | - // Info passed to the metabox. |
|
| 193 | - $info = array(); |
|
| 194 | - $info[ $key ] = $property; |
|
| 192 | + // Info passed to the metabox. |
|
| 193 | + $info = array(); |
|
| 194 | + $info[ $key ] = $property; |
|
| 195 | 195 | |
| 196 | - // Build the requested field group as WL_Metabox_Field_ object. |
|
| 197 | - $this->add_field( $info, true ); |
|
| 196 | + // Build the requested field group as WL_Metabox_Field_ object. |
|
| 197 | + $this->add_field( $info, true ); |
|
| 198 | 198 | |
| 199 | - } |
|
| 200 | - } |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Separates metaboxes in simple and grouped. |
|
| 206 | - * |
|
| 207 | - * @param array $custom_fields Information on the entity type. |
|
| 208 | - * |
|
| 209 | - * @return array |
|
| 210 | - */ |
|
| 211 | - public function group_properties_by_input_field( $custom_fields ) { |
|
| 204 | + /** |
|
| 205 | + * Separates metaboxes in simple and grouped. |
|
| 206 | + * |
|
| 207 | + * @param array $custom_fields Information on the entity type. |
|
| 208 | + * |
|
| 209 | + * @return array |
|
| 210 | + */ |
|
| 211 | + public function group_properties_by_input_field( $custom_fields ) { |
|
| 212 | 212 | |
| 213 | - $simple_properties = array(); |
|
| 214 | - $grouped_properties = array(); |
|
| 213 | + $simple_properties = array(); |
|
| 214 | + $grouped_properties = array(); |
|
| 215 | 215 | |
| 216 | - // Loop over possible entity properties. |
|
| 217 | - foreach ( $custom_fields as $key => $property ) { |
|
| 216 | + // Loop over possible entity properties. |
|
| 217 | + foreach ( $custom_fields as $key => $property ) { |
|
| 218 | 218 | |
| 219 | - // Check presence of predicate and type. |
|
| 220 | - if ( isset( $property['predicate'] ) && isset( $property['type'] ) ) { |
|
| 219 | + // Check presence of predicate and type. |
|
| 220 | + if ( isset( $property['predicate'] ) && isset( $property['type'] ) ) { |
|
| 221 | 221 | |
| 222 | - // Check if input_field is defined. |
|
| 223 | - if ( isset( $property['input_field'] ) && '' !== $property['input_field'] ) { |
|
| 222 | + // Check if input_field is defined. |
|
| 223 | + if ( isset( $property['input_field'] ) && '' !== $property['input_field'] ) { |
|
| 224 | 224 | |
| 225 | - $grouped_key = $property['input_field']; |
|
| 225 | + $grouped_key = $property['input_field']; |
|
| 226 | 226 | |
| 227 | - // Update list of grouped properties. |
|
| 228 | - $grouped_properties[ $grouped_key ][ $key ] = $property; |
|
| 227 | + // Update list of grouped properties. |
|
| 228 | + $grouped_properties[ $grouped_key ][ $key ] = $property; |
|
| 229 | 229 | |
| 230 | - } else { |
|
| 230 | + } else { |
|
| 231 | 231 | |
| 232 | - // input_field not defined, add simple metabox. |
|
| 233 | - $simple_properties[ $key ] = $property; |
|
| 234 | - } |
|
| 235 | - } |
|
| 236 | - } |
|
| 232 | + // input_field not defined, add simple metabox. |
|
| 233 | + $simple_properties[ $key ] = $property; |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - return array( $simple_properties, $grouped_properties ); |
|
| 239 | - } |
|
| 238 | + return array( $simple_properties, $grouped_properties ); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Add a Field to the current Metabox, based on the description of the Field. |
|
| 243 | - * This method is a rude factory for Field objects. |
|
| 244 | - * |
|
| 245 | - * @param array $args The field's information. |
|
| 246 | - * @param bool $grouped Flag to distinguish between simple and grouped fields. |
|
| 247 | - */ |
|
| 248 | - public function add_field( $args, $grouped = false ) { |
|
| 241 | + /** |
|
| 242 | + * Add a Field to the current Metabox, based on the description of the Field. |
|
| 243 | + * This method is a rude factory for Field objects. |
|
| 244 | + * |
|
| 245 | + * @param array $args The field's information. |
|
| 246 | + * @param bool $grouped Flag to distinguish between simple and grouped fields. |
|
| 247 | + */ |
|
| 248 | + public function add_field( $args, $grouped = false ) { |
|
| 249 | 249 | |
| 250 | - if ( $grouped ) { |
|
| 250 | + if ( $grouped ) { |
|
| 251 | 251 | |
| 252 | - // Special fields (sameas, coordinates, etc.). |
|
| 253 | - // |
|
| 254 | - // Build Field with a custom class (e.g. WL_Metabox_Field_date). |
|
| 255 | - $field_class = 'WL_Metabox_Field_' . key( $args ); |
|
| 252 | + // Special fields (sameas, coordinates, etc.). |
|
| 253 | + // |
|
| 254 | + // Build Field with a custom class (e.g. WL_Metabox_Field_date). |
|
| 255 | + $field_class = 'WL_Metabox_Field_' . key( $args ); |
|
| 256 | 256 | |
| 257 | - } else { |
|
| 257 | + } else { |
|
| 258 | 258 | |
| 259 | - // Simple fields (string, uri, boolean, etc.). |
|
| 260 | - // |
|
| 261 | - // Which field? We want to use the class that is specific for the field. |
|
| 262 | - $meta = key( $args ); |
|
| 263 | - $this_meta = $args[ $meta ]; |
|
| 259 | + // Simple fields (string, uri, boolean, etc.). |
|
| 260 | + // |
|
| 261 | + // Which field? We want to use the class that is specific for the field. |
|
| 262 | + $meta = key( $args ); |
|
| 263 | + $this_meta = $args[ $meta ]; |
|
| 264 | 264 | |
| 265 | - // If the field declares what metabox it wants, use that one. |
|
| 266 | - if ( isset( $this_meta['metabox']['class'] ) ) { |
|
| 265 | + // If the field declares what metabox it wants, use that one. |
|
| 266 | + if ( isset( $this_meta['metabox']['class'] ) ) { |
|
| 267 | 267 | |
| 268 | - $field_class = $this_meta['metabox']['class']; |
|
| 268 | + $field_class = $this_meta['metabox']['class']; |
|
| 269 | 269 | |
| 270 | - } elseif ( ! isset( $this_meta['type'] ) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type'] ) { |
|
| 270 | + } elseif ( ! isset( $this_meta['type'] ) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type'] ) { |
|
| 271 | 271 | |
| 272 | - // TODO: all fields should explicitly declare the required WL_Metabox. |
|
| 273 | - // When they will remove this. |
|
| 274 | - // |
|
| 275 | - // Use default WL_Metabox_Field (manages strings). |
|
| 276 | - $field_class = 'WL_Metabox_Field'; |
|
| 272 | + // TODO: all fields should explicitly declare the required WL_Metabox. |
|
| 273 | + // When they will remove this. |
|
| 274 | + // |
|
| 275 | + // Use default WL_Metabox_Field (manages strings). |
|
| 276 | + $field_class = 'WL_Metabox_Field'; |
|
| 277 | 277 | |
| 278 | - } else { |
|
| 278 | + } else { |
|
| 279 | 279 | |
| 280 | - // TODO: all fields should explicitly declare the required WL_Metabox. |
|
| 281 | - // When they will remove this. |
|
| 282 | - // |
|
| 283 | - // Build Field with a custom class (e.g. WL_Metabox_Field_date). |
|
| 284 | - $field_class = 'WL_Metabox_Field_' . $this_meta['type']; |
|
| 280 | + // TODO: all fields should explicitly declare the required WL_Metabox. |
|
| 281 | + // When they will remove this. |
|
| 282 | + // |
|
| 283 | + // Build Field with a custom class (e.g. WL_Metabox_Field_date). |
|
| 284 | + $field_class = 'WL_Metabox_Field_' . $this_meta['type']; |
|
| 285 | 285 | |
| 286 | - } |
|
| 286 | + } |
|
| 287 | 287 | |
| 288 | - } |
|
| 289 | - // End if(). |
|
| 288 | + } |
|
| 289 | + // End if(). |
|
| 290 | 290 | |
| 291 | - // Call apropriate constructor (e.g. WL_Metabox_Field_... ). |
|
| 292 | - $this->fields[] = new $field_class( $args ); |
|
| 293 | - } |
|
| 291 | + // Call apropriate constructor (e.g. WL_Metabox_Field_... ). |
|
| 292 | + $this->fields[] = new $field_class( $args ); |
|
| 293 | + } |
|
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Save the form data for the specified entity {@link WP_Post}'s id. |
|
| 297 | - * |
|
| 298 | - * @param int $entity_id The entity's {@link WP_Post}'s id. |
|
| 299 | - * |
|
| 300 | - * @since 3.5.4 |
|
| 301 | - * |
|
| 302 | - */ |
|
| 303 | - public function save_form_data( $entity_id ) { |
|
| 304 | - |
|
| 305 | - $this->log->trace( "Saving form data for entity post $entity_id..." ); |
|
| 306 | - |
|
| 307 | - // Build Field objects. |
|
| 308 | - $this->instantiate_fields( $entity_id ); |
|
| 295 | + /** |
|
| 296 | + * Save the form data for the specified entity {@link WP_Post}'s id. |
|
| 297 | + * |
|
| 298 | + * @param int $entity_id The entity's {@link WP_Post}'s id. |
|
| 299 | + * |
|
| 300 | + * @since 3.5.4 |
|
| 301 | + * |
|
| 302 | + */ |
|
| 303 | + public function save_form_data( $entity_id ) { |
|
| 304 | + |
|
| 305 | + $this->log->trace( "Saving form data for entity post $entity_id..." ); |
|
| 306 | + |
|
| 307 | + // Build Field objects. |
|
| 308 | + $this->instantiate_fields( $entity_id ); |
|
| 309 | 309 | |
| 310 | - // Check if WL metabox form was posted. |
|
| 311 | - if ( ! isset( $_POST['wl_metaboxes'] ) ) { |
|
| 312 | - $this->log->debug( "`wl_metaboxes`, skipping..." ); |
|
| 310 | + // Check if WL metabox form was posted. |
|
| 311 | + if ( ! isset( $_POST['wl_metaboxes'] ) ) { |
|
| 312 | + $this->log->debug( "`wl_metaboxes`, skipping..." ); |
|
| 313 | 313 | |
| 314 | - return; |
|
| 315 | - } |
|
| 314 | + return; |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - foreach ( $this->fields as $field ) { |
|
| 317 | + foreach ( $this->fields as $field ) { |
|
| 318 | 318 | |
| 319 | - // Verify nonce. |
|
| 320 | - $valid_nonce = $field->verify_nonce(); |
|
| 321 | - if ( $valid_nonce ) { |
|
| 322 | - |
|
| 323 | - $posted_data = $_POST['wl_metaboxes']; |
|
| 324 | - $field_name = $field->meta_name; |
|
| 325 | - |
|
| 326 | - // Each Filed only deals with its values. |
|
| 327 | - if ( isset( $posted_data[ $field_name ] ) ) { |
|
| 328 | - |
|
| 329 | - $values = $posted_data[ $field_name ]; |
|
| 330 | - if ( ! is_array( $values ) ) { |
|
| 331 | - $values = array( $values ); |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - // Save data permanently |
|
| 335 | - $field->save_data( $values ); |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * Filter: 'wl_save_form_pre_push_entity' - Allow to hook right |
|
| 342 | - * before the triples are pushed to the linked dataset. |
|
| 343 | - * |
|
| 344 | - * @param int $entity_id The entity id. |
|
| 345 | - * @param int $id The post data. |
|
| 346 | - * |
|
| 347 | - * @since 3.18.2 |
|
| 348 | - * |
|
| 349 | - */ |
|
| 350 | - do_action( 'wl_save_form_pre_push_entity', $entity_id, $_POST ); |
|
| 351 | - |
|
| 352 | - do_action( 'wl_legacy_linked_data__push', $entity_id ); |
|
| 353 | - |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - /** |
|
| 357 | - * Enqueue scripts and styles. |
|
| 358 | - * |
|
| 359 | - * @since 3.0.0 |
|
| 360 | - */ |
|
| 361 | - public function enqueue_scripts_and_styles() { |
|
| 362 | - |
|
| 363 | - // Use the minified version if PW_DEBUG isn't set. |
|
| 364 | - $min = ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ? '.min' : ''; |
|
| 365 | - |
|
| 366 | - // Load the jquery-ui-timepicker-addon library. |
|
| 367 | - wp_enqueue_style( 'wl-flatpickr', dirname( plugin_dir_url( __FILE__ ) ) . "/js/flatpickr/flatpickr$min.css", array(), '3.0.6' ); |
|
| 368 | - wp_enqueue_script( 'wl-flatpickr', dirname( plugin_dir_url( __FILE__ ) ) . "/js/flatpickr/flatpickr$min.js", array( 'jquery' ), '3.0.6', true ); |
|
| 369 | - |
|
| 370 | - // Leaflet. |
|
| 371 | - wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' ); |
|
| 372 | - wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0' ); |
|
| 373 | - |
|
| 374 | - // Add AJAX autocomplete to facilitate metabox editing. |
|
| 375 | - wp_enqueue_script( 'wl-entity-metabox-utility', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wl_entity_metabox_utilities.js' ); |
|
| 376 | - wp_localize_script( 'wl-entity-metabox-utility', 'wlEntityMetaboxParams', array( |
|
| 377 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 378 | - 'action' => 'entity_by_title', |
|
| 379 | - ) |
|
| 380 | - ); |
|
| 381 | - |
|
| 382 | - } |
|
| 319 | + // Verify nonce. |
|
| 320 | + $valid_nonce = $field->verify_nonce(); |
|
| 321 | + if ( $valid_nonce ) { |
|
| 322 | + |
|
| 323 | + $posted_data = $_POST['wl_metaboxes']; |
|
| 324 | + $field_name = $field->meta_name; |
|
| 325 | + |
|
| 326 | + // Each Filed only deals with its values. |
|
| 327 | + if ( isset( $posted_data[ $field_name ] ) ) { |
|
| 328 | + |
|
| 329 | + $values = $posted_data[ $field_name ]; |
|
| 330 | + if ( ! is_array( $values ) ) { |
|
| 331 | + $values = array( $values ); |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + // Save data permanently |
|
| 335 | + $field->save_data( $values ); |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * Filter: 'wl_save_form_pre_push_entity' - Allow to hook right |
|
| 342 | + * before the triples are pushed to the linked dataset. |
|
| 343 | + * |
|
| 344 | + * @param int $entity_id The entity id. |
|
| 345 | + * @param int $id The post data. |
|
| 346 | + * |
|
| 347 | + * @since 3.18.2 |
|
| 348 | + * |
|
| 349 | + */ |
|
| 350 | + do_action( 'wl_save_form_pre_push_entity', $entity_id, $_POST ); |
|
| 351 | + |
|
| 352 | + do_action( 'wl_legacy_linked_data__push', $entity_id ); |
|
| 353 | + |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + /** |
|
| 357 | + * Enqueue scripts and styles. |
|
| 358 | + * |
|
| 359 | + * @since 3.0.0 |
|
| 360 | + */ |
|
| 361 | + public function enqueue_scripts_and_styles() { |
|
| 362 | + |
|
| 363 | + // Use the minified version if PW_DEBUG isn't set. |
|
| 364 | + $min = ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ? '.min' : ''; |
|
| 365 | + |
|
| 366 | + // Load the jquery-ui-timepicker-addon library. |
|
| 367 | + wp_enqueue_style( 'wl-flatpickr', dirname( plugin_dir_url( __FILE__ ) ) . "/js/flatpickr/flatpickr$min.css", array(), '3.0.6' ); |
|
| 368 | + wp_enqueue_script( 'wl-flatpickr', dirname( plugin_dir_url( __FILE__ ) ) . "/js/flatpickr/flatpickr$min.js", array( 'jquery' ), '3.0.6', true ); |
|
| 369 | + |
|
| 370 | + // Leaflet. |
|
| 371 | + wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' ); |
|
| 372 | + wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0' ); |
|
| 373 | + |
|
| 374 | + // Add AJAX autocomplete to facilitate metabox editing. |
|
| 375 | + wp_enqueue_script( 'wl-entity-metabox-utility', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wl_entity_metabox_utilities.js' ); |
|
| 376 | + wp_localize_script( 'wl-entity-metabox-utility', 'wlEntityMetaboxParams', array( |
|
| 377 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 378 | + 'action' => 'entity_by_title', |
|
| 379 | + ) |
|
| 380 | + ); |
|
| 381 | + |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | 384 | } |
@@ -7,16 +7,16 @@ discard block |
||
| 7 | 7 | * @subpackage Wordlift/admin/WL_Metabox |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -require_once( 'class-wl-metabox-field.php' ); |
|
| 11 | -require_once( 'class-wl-metabox-field-uri.php' ); |
|
| 12 | -require_once( 'class-wl-metabox-field-sameas.php' ); |
|
| 13 | -require_once( 'WL_Metabox_Field_date.php' ); |
|
| 14 | -require_once( 'WL_Metabox_Field_coordinates.php' ); |
|
| 15 | -require_once( 'WL_Metabox_Field_address.php' ); |
|
| 16 | -require_once( 'class-wordlift-metabox-field-duration.php' ); |
|
| 17 | -require_once( 'class-wordlift-metabox-field-multiline.php' ); |
|
| 18 | -require_once( 'class-wordlift-metabox-field-integer.php' ); |
|
| 19 | -require_once( 'class-wordlift-metabox-field-select.php' ); |
|
| 10 | +require_once('class-wl-metabox-field.php'); |
|
| 11 | +require_once('class-wl-metabox-field-uri.php'); |
|
| 12 | +require_once('class-wl-metabox-field-sameas.php'); |
|
| 13 | +require_once('WL_Metabox_Field_date.php'); |
|
| 14 | +require_once('WL_Metabox_Field_coordinates.php'); |
|
| 15 | +require_once('WL_Metabox_Field_address.php'); |
|
| 16 | +require_once('class-wordlift-metabox-field-duration.php'); |
|
| 17 | +require_once('class-wordlift-metabox-field-multiline.php'); |
|
| 18 | +require_once('class-wordlift-metabox-field-integer.php'); |
|
| 19 | +require_once('class-wordlift-metabox-field-select.php'); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Define the {@link WL_Metabox} class. |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function __construct() { |
| 54 | 54 | |
| 55 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 55 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Filter: wl_feature__enable__metabox. |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | * @return bool |
| 63 | 63 | * @since 3.28.1 |
| 64 | 64 | */ |
| 65 | - if ( apply_filters( 'wl_feature__enable__metabox', true ) ) { |
|
| 65 | + if (apply_filters('wl_feature__enable__metabox', true)) { |
|
| 66 | 66 | |
| 67 | 67 | // Add hooks to print metaboxes and save submitted data. |
| 68 | - add_action( 'add_meta_boxes', array( $this, 'add_main_metabox' ) ); |
|
| 69 | - add_action( 'wl_linked_data_save_post', array( $this, 'save_form_data', ) ); |
|
| 68 | + add_action('add_meta_boxes', array($this, 'add_main_metabox')); |
|
| 69 | + add_action('wl_linked_data_save_post', array($this, 'save_form_data',)); |
|
| 70 | 70 | |
| 71 | 71 | // Enqueue js and css. |
| 72 | 72 | $this->enqueue_scripts_and_styles(); |
@@ -82,23 +82,23 @@ discard block |
||
| 82 | 82 | public function add_main_metabox() { |
| 83 | 83 | |
| 84 | 84 | // Build the fields we need to print. |
| 85 | - $this->instantiate_fields( get_the_ID() ); |
|
| 85 | + $this->instantiate_fields(get_the_ID()); |
|
| 86 | 86 | |
| 87 | 87 | // Bailout if there are no actual fields, we do not need a metabox in that case. |
| 88 | - if ( empty( $this->fields ) ) { |
|
| 88 | + if (empty($this->fields)) { |
|
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // Add main metabox (will print also the inner fields). |
| 93 | - $id = uniqid( 'wl-metabox-' ); |
|
| 94 | - $title = get_the_title() . ' ' . __( 'properties', 'wordlift' ); |
|
| 93 | + $id = uniqid('wl-metabox-'); |
|
| 94 | + $title = get_the_title().' '.__('properties', 'wordlift'); |
|
| 95 | 95 | |
| 96 | 96 | // WordPress 4.2 do not accept an array of screens as parameter, have to do be explicit. |
| 97 | - foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $screen ) { |
|
| 98 | - add_meta_box( $id, $title, array( |
|
| 97 | + foreach (Wordlift_Entity_Service::valid_entity_post_types() as $screen) { |
|
| 98 | + add_meta_box($id, $title, array( |
|
| 99 | 99 | $this, |
| 100 | 100 | 'html', |
| 101 | - ), $screen, 'normal', 'high' ); |
|
| 101 | + ), $screen, 'normal', 'high'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // Add filter to change the metabox CSS class. |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | // dynamically according to the `get_current_screen()` function. |
| 108 | 108 | $current_screen = get_current_screen(); |
| 109 | 109 | $screen = $current_screen ? $current_screen->post_type : 'entity'; |
| 110 | - add_filter( "postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class' ); |
|
| 110 | + add_filter("postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class'); |
|
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | * @since 3.1.0 |
| 120 | 120 | * |
| 121 | 121 | */ |
| 122 | - public function html( $post ) { |
|
| 122 | + public function html($post) { |
|
| 123 | 123 | |
| 124 | 124 | // Loop over the fields. |
| 125 | - foreach ( $this->fields as $field ) { |
|
| 125 | + foreach ($this->fields as $field) { |
|
| 126 | 126 | |
| 127 | 127 | // load data from DB (values will be available in $field->data). |
| 128 | 128 | $field->get_data(); |
@@ -144,18 +144,18 @@ discard block |
||
| 144 | 144 | * @since 3.1.0 |
| 145 | 145 | * |
| 146 | 146 | */ |
| 147 | - public function instantiate_fields( $post_id ) { |
|
| 147 | + public function instantiate_fields($post_id) { |
|
| 148 | 148 | |
| 149 | - $this->log->trace( "Instantiating fields for entity post $post_id..." ); |
|
| 149 | + $this->log->trace("Instantiating fields for entity post $post_id..."); |
|
| 150 | 150 | |
| 151 | 151 | // This function must be called only once. Not called from the constructor because WP hooks have a rococo ordering. |
| 152 | - if ( isset( $this->fields ) ) { |
|
| 152 | + if (isset($this->fields)) { |
|
| 153 | 153 | return; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $entity_type = wl_entity_taxonomy_get_custom_fields( $post_id ); |
|
| 156 | + $entity_type = wl_entity_taxonomy_get_custom_fields($post_id); |
|
| 157 | 157 | |
| 158 | - if ( isset( $entity_type ) ) { |
|
| 158 | + if (isset($entity_type)) { |
|
| 159 | 159 | |
| 160 | 160 | /* |
| 161 | 161 | * Might not have any relevant meta box field, for example for articles, |
@@ -170,31 +170,31 @@ discard block |
||
| 170 | 170 | * - simple: accept values for one property |
| 171 | 171 | * - grouped: accept values for more properties, or for one property that needs a specific metabox. |
| 172 | 172 | */ |
| 173 | - $metaboxes = $this->group_properties_by_input_field( $entity_type ); |
|
| 173 | + $metaboxes = $this->group_properties_by_input_field($entity_type); |
|
| 174 | 174 | $simple_metaboxes = $metaboxes[0]; |
| 175 | 175 | $grouped_metaboxes = $metaboxes[1]; |
| 176 | 176 | |
| 177 | 177 | // Loop over simple entity properties. |
| 178 | - foreach ( $simple_metaboxes as $key => $property ) { |
|
| 178 | + foreach ($simple_metaboxes as $key => $property) { |
|
| 179 | 179 | |
| 180 | 180 | // Info passed to the metabox. |
| 181 | 181 | $info = array(); |
| 182 | - $info[ $key ] = $property; |
|
| 182 | + $info[$key] = $property; |
|
| 183 | 183 | |
| 184 | 184 | // Build the requested field as WL_Metabox_Field_ object. |
| 185 | - $this->add_field( $info ); |
|
| 185 | + $this->add_field($info); |
|
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Loop over grouped properties. |
| 190 | - foreach ( $grouped_metaboxes as $key => $property ) { |
|
| 190 | + foreach ($grouped_metaboxes as $key => $property) { |
|
| 191 | 191 | |
| 192 | 192 | // Info passed to the metabox. |
| 193 | 193 | $info = array(); |
| 194 | - $info[ $key ] = $property; |
|
| 194 | + $info[$key] = $property; |
|
| 195 | 195 | |
| 196 | 196 | // Build the requested field group as WL_Metabox_Field_ object. |
| 197 | - $this->add_field( $info, true ); |
|
| 197 | + $this->add_field($info, true); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -208,34 +208,34 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return array |
| 210 | 210 | */ |
| 211 | - public function group_properties_by_input_field( $custom_fields ) { |
|
| 211 | + public function group_properties_by_input_field($custom_fields) { |
|
| 212 | 212 | |
| 213 | 213 | $simple_properties = array(); |
| 214 | 214 | $grouped_properties = array(); |
| 215 | 215 | |
| 216 | 216 | // Loop over possible entity properties. |
| 217 | - foreach ( $custom_fields as $key => $property ) { |
|
| 217 | + foreach ($custom_fields as $key => $property) { |
|
| 218 | 218 | |
| 219 | 219 | // Check presence of predicate and type. |
| 220 | - if ( isset( $property['predicate'] ) && isset( $property['type'] ) ) { |
|
| 220 | + if (isset($property['predicate']) && isset($property['type'])) { |
|
| 221 | 221 | |
| 222 | 222 | // Check if input_field is defined. |
| 223 | - if ( isset( $property['input_field'] ) && '' !== $property['input_field'] ) { |
|
| 223 | + if (isset($property['input_field']) && '' !== $property['input_field']) { |
|
| 224 | 224 | |
| 225 | 225 | $grouped_key = $property['input_field']; |
| 226 | 226 | |
| 227 | 227 | // Update list of grouped properties. |
| 228 | - $grouped_properties[ $grouped_key ][ $key ] = $property; |
|
| 228 | + $grouped_properties[$grouped_key][$key] = $property; |
|
| 229 | 229 | |
| 230 | 230 | } else { |
| 231 | 231 | |
| 232 | 232 | // input_field not defined, add simple metabox. |
| 233 | - $simple_properties[ $key ] = $property; |
|
| 233 | + $simple_properties[$key] = $property; |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - return array( $simple_properties, $grouped_properties ); |
|
| 238 | + return array($simple_properties, $grouped_properties); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -245,29 +245,29 @@ discard block |
||
| 245 | 245 | * @param array $args The field's information. |
| 246 | 246 | * @param bool $grouped Flag to distinguish between simple and grouped fields. |
| 247 | 247 | */ |
| 248 | - public function add_field( $args, $grouped = false ) { |
|
| 248 | + public function add_field($args, $grouped = false) { |
|
| 249 | 249 | |
| 250 | - if ( $grouped ) { |
|
| 250 | + if ($grouped) { |
|
| 251 | 251 | |
| 252 | 252 | // Special fields (sameas, coordinates, etc.). |
| 253 | 253 | // |
| 254 | 254 | // Build Field with a custom class (e.g. WL_Metabox_Field_date). |
| 255 | - $field_class = 'WL_Metabox_Field_' . key( $args ); |
|
| 255 | + $field_class = 'WL_Metabox_Field_'.key($args); |
|
| 256 | 256 | |
| 257 | 257 | } else { |
| 258 | 258 | |
| 259 | 259 | // Simple fields (string, uri, boolean, etc.). |
| 260 | 260 | // |
| 261 | 261 | // Which field? We want to use the class that is specific for the field. |
| 262 | - $meta = key( $args ); |
|
| 263 | - $this_meta = $args[ $meta ]; |
|
| 262 | + $meta = key($args); |
|
| 263 | + $this_meta = $args[$meta]; |
|
| 264 | 264 | |
| 265 | 265 | // If the field declares what metabox it wants, use that one. |
| 266 | - if ( isset( $this_meta['metabox']['class'] ) ) { |
|
| 266 | + if (isset($this_meta['metabox']['class'])) { |
|
| 267 | 267 | |
| 268 | 268 | $field_class = $this_meta['metabox']['class']; |
| 269 | 269 | |
| 270 | - } elseif ( ! isset( $this_meta['type'] ) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type'] ) { |
|
| 270 | + } elseif ( ! isset($this_meta['type']) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type']) { |
|
| 271 | 271 | |
| 272 | 272 | // TODO: all fields should explicitly declare the required WL_Metabox. |
| 273 | 273 | // When they will remove this. |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // When they will remove this. |
| 282 | 282 | // |
| 283 | 283 | // Build Field with a custom class (e.g. WL_Metabox_Field_date). |
| 284 | - $field_class = 'WL_Metabox_Field_' . $this_meta['type']; |
|
| 284 | + $field_class = 'WL_Metabox_Field_'.$this_meta['type']; |
|
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | // End if(). |
| 290 | 290 | |
| 291 | 291 | // Call apropriate constructor (e.g. WL_Metabox_Field_... ). |
| 292 | - $this->fields[] = new $field_class( $args ); |
|
| 292 | + $this->fields[] = new $field_class($args); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -300,39 +300,39 @@ discard block |
||
| 300 | 300 | * @since 3.5.4 |
| 301 | 301 | * |
| 302 | 302 | */ |
| 303 | - public function save_form_data( $entity_id ) { |
|
| 303 | + public function save_form_data($entity_id) { |
|
| 304 | 304 | |
| 305 | - $this->log->trace( "Saving form data for entity post $entity_id..." ); |
|
| 305 | + $this->log->trace("Saving form data for entity post $entity_id..."); |
|
| 306 | 306 | |
| 307 | 307 | // Build Field objects. |
| 308 | - $this->instantiate_fields( $entity_id ); |
|
| 308 | + $this->instantiate_fields($entity_id); |
|
| 309 | 309 | |
| 310 | 310 | // Check if WL metabox form was posted. |
| 311 | - if ( ! isset( $_POST['wl_metaboxes'] ) ) { |
|
| 312 | - $this->log->debug( "`wl_metaboxes`, skipping..." ); |
|
| 311 | + if ( ! isset($_POST['wl_metaboxes'])) { |
|
| 312 | + $this->log->debug("`wl_metaboxes`, skipping..."); |
|
| 313 | 313 | |
| 314 | 314 | return; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - foreach ( $this->fields as $field ) { |
|
| 317 | + foreach ($this->fields as $field) { |
|
| 318 | 318 | |
| 319 | 319 | // Verify nonce. |
| 320 | 320 | $valid_nonce = $field->verify_nonce(); |
| 321 | - if ( $valid_nonce ) { |
|
| 321 | + if ($valid_nonce) { |
|
| 322 | 322 | |
| 323 | 323 | $posted_data = $_POST['wl_metaboxes']; |
| 324 | 324 | $field_name = $field->meta_name; |
| 325 | 325 | |
| 326 | 326 | // Each Filed only deals with its values. |
| 327 | - if ( isset( $posted_data[ $field_name ] ) ) { |
|
| 327 | + if (isset($posted_data[$field_name])) { |
|
| 328 | 328 | |
| 329 | - $values = $posted_data[ $field_name ]; |
|
| 330 | - if ( ! is_array( $values ) ) { |
|
| 331 | - $values = array( $values ); |
|
| 329 | + $values = $posted_data[$field_name]; |
|
| 330 | + if ( ! is_array($values)) { |
|
| 331 | + $values = array($values); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // Save data permanently |
| 335 | - $field->save_data( $values ); |
|
| 335 | + $field->save_data($values); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | * @since 3.18.2 |
| 348 | 348 | * |
| 349 | 349 | */ |
| 350 | - do_action( 'wl_save_form_pre_push_entity', $entity_id, $_POST ); |
|
| 350 | + do_action('wl_save_form_pre_push_entity', $entity_id, $_POST); |
|
| 351 | 351 | |
| 352 | - do_action( 'wl_legacy_linked_data__push', $entity_id ); |
|
| 352 | + do_action('wl_legacy_linked_data__push', $entity_id); |
|
| 353 | 353 | |
| 354 | 354 | } |
| 355 | 355 | |
@@ -361,20 +361,20 @@ discard block |
||
| 361 | 361 | public function enqueue_scripts_and_styles() { |
| 362 | 362 | |
| 363 | 363 | // Use the minified version if PW_DEBUG isn't set. |
| 364 | - $min = ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ? '.min' : ''; |
|
| 364 | + $min = ! defined('WP_DEBUG') || ! WP_DEBUG ? '.min' : ''; |
|
| 365 | 365 | |
| 366 | 366 | // Load the jquery-ui-timepicker-addon library. |
| 367 | - wp_enqueue_style( 'wl-flatpickr', dirname( plugin_dir_url( __FILE__ ) ) . "/js/flatpickr/flatpickr$min.css", array(), '3.0.6' ); |
|
| 368 | - wp_enqueue_script( 'wl-flatpickr', dirname( plugin_dir_url( __FILE__ ) ) . "/js/flatpickr/flatpickr$min.js", array( 'jquery' ), '3.0.6', true ); |
|
| 367 | + wp_enqueue_style('wl-flatpickr', dirname(plugin_dir_url(__FILE__))."/js/flatpickr/flatpickr$min.css", array(), '3.0.6'); |
|
| 368 | + wp_enqueue_script('wl-flatpickr', dirname(plugin_dir_url(__FILE__))."/js/flatpickr/flatpickr$min.js", array('jquery'), '3.0.6', true); |
|
| 369 | 369 | |
| 370 | 370 | // Leaflet. |
| 371 | - wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' ); |
|
| 372 | - wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0' ); |
|
| 371 | + wp_enqueue_style('wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0'); |
|
| 372 | + wp_enqueue_script('wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0'); |
|
| 373 | 373 | |
| 374 | 374 | // Add AJAX autocomplete to facilitate metabox editing. |
| 375 | - wp_enqueue_script( 'wl-entity-metabox-utility', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wl_entity_metabox_utilities.js' ); |
|
| 376 | - wp_localize_script( 'wl-entity-metabox-utility', 'wlEntityMetaboxParams', array( |
|
| 377 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 375 | + wp_enqueue_script('wl-entity-metabox-utility', dirname(plugin_dir_url(__FILE__)).'/js/wl_entity_metabox_utilities.js'); |
|
| 376 | + wp_localize_script('wl-entity-metabox-utility', 'wlEntityMetaboxParams', array( |
|
| 377 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 378 | 378 | 'action' => 'entity_by_title', |
| 379 | 379 | ) |
| 380 | 380 | ); |
@@ -18,224 +18,224 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Term_JsonLd_Adapter { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.20.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $entity_uri_service; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * The {@link Wordlift_Jsonld_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.20.0 |
|
| 34 | - * @access private |
|
| 35 | - * @var \Wordlift_Jsonld_Service $jsonld_service The {@link Wordlift_Jsonld_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private $jsonld_service; |
|
| 38 | - |
|
| 39 | - private static $instance; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Wordlift_Term_JsonLd_Adapter constructor. |
|
| 43 | - * |
|
| 44 | - * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 45 | - * @param \Wordlift_Jsonld_Service $jsonld_service The {@link Wordlift_Jsonld_Service} instance. |
|
| 46 | - * |
|
| 47 | - * @since 3.20.0 |
|
| 48 | - * |
|
| 49 | - */ |
|
| 50 | - public function __construct( $entity_uri_service, $jsonld_service ) { |
|
| 51 | - |
|
| 52 | - add_action( 'wp_head', array( $this, 'wp_head' ) ); |
|
| 53 | - |
|
| 54 | - $this->entity_uri_service = $entity_uri_service; |
|
| 55 | - $this->jsonld_service = $jsonld_service; |
|
| 56 | - |
|
| 57 | - self::$instance = $this; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - public static function get_instance() { |
|
| 61 | - |
|
| 62 | - return self::$instance; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Adds carousel json ld data to term page if the conditions match |
|
| 67 | - * |
|
| 68 | - * @return array|boolean |
|
| 69 | - */ |
|
| 70 | - public function get_carousel_jsonld( $id = null ) { |
|
| 71 | - $posts = $this->get_posts( $id ); |
|
| 72 | - $post_jsonld = array(); |
|
| 73 | - if ( ! is_array( $posts ) || count( $posts ) < 2 ) { |
|
| 74 | - // Bail out if no posts are present. |
|
| 75 | - return false; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if ( ! is_null( $id ) ) { |
|
| 79 | - $term = get_term( $id ); |
|
| 80 | - $post_jsonld['description'] = strip_tags( strip_shortcodes( $term->description ) ); |
|
| 81 | - $thumbnail_id = get_term_meta( $id, 'thumbnail_id', true ); |
|
| 82 | - if ( ! empty( $thumbnail_id ) ) { |
|
| 83 | - $post_jsonld['image'] = wp_get_attachment_url( $thumbnail_id ); |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // More than 2 items are present, so construct the post_jsonld data |
|
| 88 | - $post_jsonld['@context'] = 'https://schema.org'; |
|
| 89 | - $post_jsonld['@type'] = 'ItemList'; |
|
| 90 | - $post_jsonld['url'] = $this->get_term_url( $id ); |
|
| 91 | - $post_jsonld['itemListElement'] = array(); |
|
| 92 | - $position = 1; |
|
| 93 | - |
|
| 94 | - foreach ( $posts as $post_id ) { |
|
| 95 | - $result = array( |
|
| 96 | - '@type' => 'ListItem', |
|
| 97 | - 'position' => $position, |
|
| 98 | - /** |
|
| 99 | - * We can't use `item` here unless we change the URL for the item to point to the current page. |
|
| 100 | - * |
|
| 101 | - * See https://developers.google.com/search/docs/data-types/carousel |
|
| 102 | - */ |
|
| 103 | - 'url' => apply_filters( 'wl_carousel_post_list_item_url', get_permalink( $post_id ), $post_id ), |
|
| 104 | - ); |
|
| 105 | - array_push( $post_jsonld['itemListElement'], $result ); |
|
| 106 | - $position += 1; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - return $post_jsonld; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - private function get_posts( $id ) { |
|
| 113 | - global $wp_query; |
|
| 114 | - |
|
| 115 | - if ( ! is_null( $wp_query->posts ) ) { |
|
| 116 | - return array_map( function ( $post ) { |
|
| 117 | - return $post->ID; |
|
| 118 | - }, $wp_query->posts ); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - if ( is_null( $id ) ) { |
|
| 122 | - return null; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $term = get_term( $id ); |
|
| 126 | - |
|
| 127 | - return get_objects_in_term( $id, $term->taxonomy ); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Hook to `wp_head` to print the JSON-LD. |
|
| 132 | - * |
|
| 133 | - * @since 3.20.0 |
|
| 134 | - */ |
|
| 135 | - public function wp_head() { |
|
| 136 | - $query_object = get_queried_object(); |
|
| 137 | - |
|
| 138 | - // Check if it is a term page. |
|
| 139 | - if ( ! $query_object instanceof WP_Term ) { |
|
| 140 | - return; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // Bail out if `wl_jsonld_enabled` isn't enabled. |
|
| 144 | - if ( ! apply_filters( 'wl_jsonld_enabled', true ) ) { |
|
| 145 | - return; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - $term_id = $query_object->term_id; |
|
| 149 | - |
|
| 150 | - $jsonld = $this->get( $term_id ); |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - // Bail out if the JSON-LD is empty. |
|
| 154 | - if ( empty( $jsonld ) ) { |
|
| 155 | - return; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - $jsonld_string = wp_json_encode( $jsonld ); |
|
| 159 | - |
|
| 160 | - echo "<script type=\"application/ld+json\" id=\"wl-jsonld-term\">$jsonld_string</script>"; |
|
| 161 | - |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - public function get( $id ) { |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Support for carousel rich snippet, get jsonld data present |
|
| 168 | - * for all the posts shown in the term page, and add the jsonld data |
|
| 169 | - * to list |
|
| 170 | - * |
|
| 171 | - * see here: https://developers.google.com/search/docs/data-types/carousel |
|
| 172 | - * |
|
| 173 | - * @since 3.26.0 |
|
| 174 | - */ |
|
| 175 | - $carousel_data = $this->get_carousel_jsonld( $id ); |
|
| 176 | - $jsonld_array = array(); |
|
| 177 | - if ( $carousel_data ) { |
|
| 178 | - $jsonld_array[] = $carousel_data; |
|
| 179 | - } |
|
| 180 | - $context = empty( $carousel_data ) ? Jsonld_Context_Enum::PAGE : Jsonld_Context_Enum::CAROUSEL; |
|
| 181 | - $entities_jsonld_array = $this->get_entity_jsonld( $id, $context ); |
|
| 182 | - |
|
| 183 | - $result = array( |
|
| 184 | - 'jsonld' => array_merge( $jsonld_array, $entities_jsonld_array ), |
|
| 185 | - 'references' => array() |
|
| 186 | - ); |
|
| 187 | - /** |
|
| 188 | - * @since 3.26.3 |
|
| 189 | - * Filter: wl_term_jsonld_array |
|
| 190 | - * @var $id int Term id |
|
| 191 | - * @var $jsonld_array array An array containing jsonld for term and entities. |
|
| 192 | - */ |
|
| 193 | - $arr = apply_filters( 'wl_term_jsonld_array', $result, $id ); |
|
| 194 | - return $arr['jsonld']; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - private function get_term_url( $id ) { |
|
| 198 | - |
|
| 199 | - if ( is_null( $id ) ) { |
|
| 200 | - return $_SERVER['REQUEST_URI']; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - $maybe_url = get_term_meta( $id, Wordlift_Url_Property_Service::META_KEY, true ); |
|
| 204 | - if ( ! empty( $maybe_url ) ) { |
|
| 205 | - return $maybe_url; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - return get_term_link( $id ); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * Return jsonld for entities bound to terms. |
|
| 213 | - * |
|
| 214 | - * @param int $term_id Term ID. |
|
| 215 | - * @param int $context A context for the JSON-LD generation, valid values in Jsonld_Context_Enum. |
|
| 216 | - * |
|
| 217 | - * @return array |
|
| 218 | - */ |
|
| 219 | - private function get_entity_jsonld( $term_id, $context ) { |
|
| 220 | - // The `_wl_entity_id` are URIs. |
|
| 221 | - $entity_ids = get_term_meta( $term_id, '_wl_entity_id' ); |
|
| 222 | - $entity_uri_service = $this->entity_uri_service; |
|
| 223 | - |
|
| 224 | - $local_entity_ids = array_filter( $entity_ids, function ( $uri ) use ( $entity_uri_service ) { |
|
| 225 | - return $entity_uri_service->is_internal( $uri ); |
|
| 226 | - } ); |
|
| 227 | - |
|
| 228 | - // Bail out if there are no entities. |
|
| 229 | - if ( empty( $local_entity_ids ) ) { |
|
| 230 | - return array(); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - $post = $this->entity_uri_service->get_entity( array_shift( $local_entity_ids ) ); |
|
| 234 | - $jsonld = $this->jsonld_service->get_jsonld( false, $post->ID, $context ); |
|
| 235 | - // Reset the `url` to the term page. |
|
| 236 | - $jsonld[0]['url'] = get_term_link( $term_id ); |
|
| 237 | - |
|
| 238 | - return $jsonld; |
|
| 239 | - } |
|
| 21 | + /** |
|
| 22 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.20.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $entity_uri_service; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * The {@link Wordlift_Jsonld_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.20.0 |
|
| 34 | + * @access private |
|
| 35 | + * @var \Wordlift_Jsonld_Service $jsonld_service The {@link Wordlift_Jsonld_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private $jsonld_service; |
|
| 38 | + |
|
| 39 | + private static $instance; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Wordlift_Term_JsonLd_Adapter constructor. |
|
| 43 | + * |
|
| 44 | + * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 45 | + * @param \Wordlift_Jsonld_Service $jsonld_service The {@link Wordlift_Jsonld_Service} instance. |
|
| 46 | + * |
|
| 47 | + * @since 3.20.0 |
|
| 48 | + * |
|
| 49 | + */ |
|
| 50 | + public function __construct( $entity_uri_service, $jsonld_service ) { |
|
| 51 | + |
|
| 52 | + add_action( 'wp_head', array( $this, 'wp_head' ) ); |
|
| 53 | + |
|
| 54 | + $this->entity_uri_service = $entity_uri_service; |
|
| 55 | + $this->jsonld_service = $jsonld_service; |
|
| 56 | + |
|
| 57 | + self::$instance = $this; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + public static function get_instance() { |
|
| 61 | + |
|
| 62 | + return self::$instance; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Adds carousel json ld data to term page if the conditions match |
|
| 67 | + * |
|
| 68 | + * @return array|boolean |
|
| 69 | + */ |
|
| 70 | + public function get_carousel_jsonld( $id = null ) { |
|
| 71 | + $posts = $this->get_posts( $id ); |
|
| 72 | + $post_jsonld = array(); |
|
| 73 | + if ( ! is_array( $posts ) || count( $posts ) < 2 ) { |
|
| 74 | + // Bail out if no posts are present. |
|
| 75 | + return false; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if ( ! is_null( $id ) ) { |
|
| 79 | + $term = get_term( $id ); |
|
| 80 | + $post_jsonld['description'] = strip_tags( strip_shortcodes( $term->description ) ); |
|
| 81 | + $thumbnail_id = get_term_meta( $id, 'thumbnail_id', true ); |
|
| 82 | + if ( ! empty( $thumbnail_id ) ) { |
|
| 83 | + $post_jsonld['image'] = wp_get_attachment_url( $thumbnail_id ); |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // More than 2 items are present, so construct the post_jsonld data |
|
| 88 | + $post_jsonld['@context'] = 'https://schema.org'; |
|
| 89 | + $post_jsonld['@type'] = 'ItemList'; |
|
| 90 | + $post_jsonld['url'] = $this->get_term_url( $id ); |
|
| 91 | + $post_jsonld['itemListElement'] = array(); |
|
| 92 | + $position = 1; |
|
| 93 | + |
|
| 94 | + foreach ( $posts as $post_id ) { |
|
| 95 | + $result = array( |
|
| 96 | + '@type' => 'ListItem', |
|
| 97 | + 'position' => $position, |
|
| 98 | + /** |
|
| 99 | + * We can't use `item` here unless we change the URL for the item to point to the current page. |
|
| 100 | + * |
|
| 101 | + * See https://developers.google.com/search/docs/data-types/carousel |
|
| 102 | + */ |
|
| 103 | + 'url' => apply_filters( 'wl_carousel_post_list_item_url', get_permalink( $post_id ), $post_id ), |
|
| 104 | + ); |
|
| 105 | + array_push( $post_jsonld['itemListElement'], $result ); |
|
| 106 | + $position += 1; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + return $post_jsonld; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + private function get_posts( $id ) { |
|
| 113 | + global $wp_query; |
|
| 114 | + |
|
| 115 | + if ( ! is_null( $wp_query->posts ) ) { |
|
| 116 | + return array_map( function ( $post ) { |
|
| 117 | + return $post->ID; |
|
| 118 | + }, $wp_query->posts ); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + if ( is_null( $id ) ) { |
|
| 122 | + return null; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $term = get_term( $id ); |
|
| 126 | + |
|
| 127 | + return get_objects_in_term( $id, $term->taxonomy ); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Hook to `wp_head` to print the JSON-LD. |
|
| 132 | + * |
|
| 133 | + * @since 3.20.0 |
|
| 134 | + */ |
|
| 135 | + public function wp_head() { |
|
| 136 | + $query_object = get_queried_object(); |
|
| 137 | + |
|
| 138 | + // Check if it is a term page. |
|
| 139 | + if ( ! $query_object instanceof WP_Term ) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // Bail out if `wl_jsonld_enabled` isn't enabled. |
|
| 144 | + if ( ! apply_filters( 'wl_jsonld_enabled', true ) ) { |
|
| 145 | + return; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + $term_id = $query_object->term_id; |
|
| 149 | + |
|
| 150 | + $jsonld = $this->get( $term_id ); |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + // Bail out if the JSON-LD is empty. |
|
| 154 | + if ( empty( $jsonld ) ) { |
|
| 155 | + return; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + $jsonld_string = wp_json_encode( $jsonld ); |
|
| 159 | + |
|
| 160 | + echo "<script type=\"application/ld+json\" id=\"wl-jsonld-term\">$jsonld_string</script>"; |
|
| 161 | + |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + public function get( $id ) { |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Support for carousel rich snippet, get jsonld data present |
|
| 168 | + * for all the posts shown in the term page, and add the jsonld data |
|
| 169 | + * to list |
|
| 170 | + * |
|
| 171 | + * see here: https://developers.google.com/search/docs/data-types/carousel |
|
| 172 | + * |
|
| 173 | + * @since 3.26.0 |
|
| 174 | + */ |
|
| 175 | + $carousel_data = $this->get_carousel_jsonld( $id ); |
|
| 176 | + $jsonld_array = array(); |
|
| 177 | + if ( $carousel_data ) { |
|
| 178 | + $jsonld_array[] = $carousel_data; |
|
| 179 | + } |
|
| 180 | + $context = empty( $carousel_data ) ? Jsonld_Context_Enum::PAGE : Jsonld_Context_Enum::CAROUSEL; |
|
| 181 | + $entities_jsonld_array = $this->get_entity_jsonld( $id, $context ); |
|
| 182 | + |
|
| 183 | + $result = array( |
|
| 184 | + 'jsonld' => array_merge( $jsonld_array, $entities_jsonld_array ), |
|
| 185 | + 'references' => array() |
|
| 186 | + ); |
|
| 187 | + /** |
|
| 188 | + * @since 3.26.3 |
|
| 189 | + * Filter: wl_term_jsonld_array |
|
| 190 | + * @var $id int Term id |
|
| 191 | + * @var $jsonld_array array An array containing jsonld for term and entities. |
|
| 192 | + */ |
|
| 193 | + $arr = apply_filters( 'wl_term_jsonld_array', $result, $id ); |
|
| 194 | + return $arr['jsonld']; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + private function get_term_url( $id ) { |
|
| 198 | + |
|
| 199 | + if ( is_null( $id ) ) { |
|
| 200 | + return $_SERVER['REQUEST_URI']; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + $maybe_url = get_term_meta( $id, Wordlift_Url_Property_Service::META_KEY, true ); |
|
| 204 | + if ( ! empty( $maybe_url ) ) { |
|
| 205 | + return $maybe_url; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + return get_term_link( $id ); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * Return jsonld for entities bound to terms. |
|
| 213 | + * |
|
| 214 | + * @param int $term_id Term ID. |
|
| 215 | + * @param int $context A context for the JSON-LD generation, valid values in Jsonld_Context_Enum. |
|
| 216 | + * |
|
| 217 | + * @return array |
|
| 218 | + */ |
|
| 219 | + private function get_entity_jsonld( $term_id, $context ) { |
|
| 220 | + // The `_wl_entity_id` are URIs. |
|
| 221 | + $entity_ids = get_term_meta( $term_id, '_wl_entity_id' ); |
|
| 222 | + $entity_uri_service = $this->entity_uri_service; |
|
| 223 | + |
|
| 224 | + $local_entity_ids = array_filter( $entity_ids, function ( $uri ) use ( $entity_uri_service ) { |
|
| 225 | + return $entity_uri_service->is_internal( $uri ); |
|
| 226 | + } ); |
|
| 227 | + |
|
| 228 | + // Bail out if there are no entities. |
|
| 229 | + if ( empty( $local_entity_ids ) ) { |
|
| 230 | + return array(); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + $post = $this->entity_uri_service->get_entity( array_shift( $local_entity_ids ) ); |
|
| 234 | + $jsonld = $this->jsonld_service->get_jsonld( false, $post->ID, $context ); |
|
| 235 | + // Reset the `url` to the term page. |
|
| 236 | + $jsonld[0]['url'] = get_term_link( $term_id ); |
|
| 237 | + |
|
| 238 | + return $jsonld; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | } |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | * @since 3.20.0 |
| 48 | 48 | * |
| 49 | 49 | */ |
| 50 | - public function __construct( $entity_uri_service, $jsonld_service ) { |
|
| 50 | + public function __construct($entity_uri_service, $jsonld_service) { |
|
| 51 | 51 | |
| 52 | - add_action( 'wp_head', array( $this, 'wp_head' ) ); |
|
| 52 | + add_action('wp_head', array($this, 'wp_head')); |
|
| 53 | 53 | |
| 54 | 54 | $this->entity_uri_service = $entity_uri_service; |
| 55 | 55 | $this->jsonld_service = $jsonld_service; |
@@ -67,31 +67,31 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return array|boolean |
| 69 | 69 | */ |
| 70 | - public function get_carousel_jsonld( $id = null ) { |
|
| 71 | - $posts = $this->get_posts( $id ); |
|
| 70 | + public function get_carousel_jsonld($id = null) { |
|
| 71 | + $posts = $this->get_posts($id); |
|
| 72 | 72 | $post_jsonld = array(); |
| 73 | - if ( ! is_array( $posts ) || count( $posts ) < 2 ) { |
|
| 73 | + if ( ! is_array($posts) || count($posts) < 2) { |
|
| 74 | 74 | // Bail out if no posts are present. |
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if ( ! is_null( $id ) ) { |
|
| 79 | - $term = get_term( $id ); |
|
| 80 | - $post_jsonld['description'] = strip_tags( strip_shortcodes( $term->description ) ); |
|
| 81 | - $thumbnail_id = get_term_meta( $id, 'thumbnail_id', true ); |
|
| 82 | - if ( ! empty( $thumbnail_id ) ) { |
|
| 83 | - $post_jsonld['image'] = wp_get_attachment_url( $thumbnail_id ); |
|
| 78 | + if ( ! is_null($id)) { |
|
| 79 | + $term = get_term($id); |
|
| 80 | + $post_jsonld['description'] = strip_tags(strip_shortcodes($term->description)); |
|
| 81 | + $thumbnail_id = get_term_meta($id, 'thumbnail_id', true); |
|
| 82 | + if ( ! empty($thumbnail_id)) { |
|
| 83 | + $post_jsonld['image'] = wp_get_attachment_url($thumbnail_id); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // More than 2 items are present, so construct the post_jsonld data |
| 88 | 88 | $post_jsonld['@context'] = 'https://schema.org'; |
| 89 | 89 | $post_jsonld['@type'] = 'ItemList'; |
| 90 | - $post_jsonld['url'] = $this->get_term_url( $id ); |
|
| 90 | + $post_jsonld['url'] = $this->get_term_url($id); |
|
| 91 | 91 | $post_jsonld['itemListElement'] = array(); |
| 92 | 92 | $position = 1; |
| 93 | 93 | |
| 94 | - foreach ( $posts as $post_id ) { |
|
| 94 | + foreach ($posts as $post_id) { |
|
| 95 | 95 | $result = array( |
| 96 | 96 | '@type' => 'ListItem', |
| 97 | 97 | 'position' => $position, |
@@ -100,31 +100,31 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * See https://developers.google.com/search/docs/data-types/carousel |
| 102 | 102 | */ |
| 103 | - 'url' => apply_filters( 'wl_carousel_post_list_item_url', get_permalink( $post_id ), $post_id ), |
|
| 103 | + 'url' => apply_filters('wl_carousel_post_list_item_url', get_permalink($post_id), $post_id), |
|
| 104 | 104 | ); |
| 105 | - array_push( $post_jsonld['itemListElement'], $result ); |
|
| 105 | + array_push($post_jsonld['itemListElement'], $result); |
|
| 106 | 106 | $position += 1; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | return $post_jsonld; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - private function get_posts( $id ) { |
|
| 112 | + private function get_posts($id) { |
|
| 113 | 113 | global $wp_query; |
| 114 | 114 | |
| 115 | - if ( ! is_null( $wp_query->posts ) ) { |
|
| 116 | - return array_map( function ( $post ) { |
|
| 115 | + if ( ! is_null($wp_query->posts)) { |
|
| 116 | + return array_map(function($post) { |
|
| 117 | 117 | return $post->ID; |
| 118 | - }, $wp_query->posts ); |
|
| 118 | + }, $wp_query->posts); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ( is_null( $id ) ) { |
|
| 121 | + if (is_null($id)) { |
|
| 122 | 122 | return null; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $term = get_term( $id ); |
|
| 125 | + $term = get_term($id); |
|
| 126 | 126 | |
| 127 | - return get_objects_in_term( $id, $term->taxonomy ); |
|
| 127 | + return get_objects_in_term($id, $term->taxonomy); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -136,32 +136,32 @@ discard block |
||
| 136 | 136 | $query_object = get_queried_object(); |
| 137 | 137 | |
| 138 | 138 | // Check if it is a term page. |
| 139 | - if ( ! $query_object instanceof WP_Term ) { |
|
| 139 | + if ( ! $query_object instanceof WP_Term) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Bail out if `wl_jsonld_enabled` isn't enabled. |
| 144 | - if ( ! apply_filters( 'wl_jsonld_enabled', true ) ) { |
|
| 144 | + if ( ! apply_filters('wl_jsonld_enabled', true)) { |
|
| 145 | 145 | return; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $term_id = $query_object->term_id; |
| 149 | 149 | |
| 150 | - $jsonld = $this->get( $term_id ); |
|
| 150 | + $jsonld = $this->get($term_id); |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | // Bail out if the JSON-LD is empty. |
| 154 | - if ( empty( $jsonld ) ) { |
|
| 154 | + if (empty($jsonld)) { |
|
| 155 | 155 | return; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $jsonld_string = wp_json_encode( $jsonld ); |
|
| 158 | + $jsonld_string = wp_json_encode($jsonld); |
|
| 159 | 159 | |
| 160 | 160 | echo "<script type=\"application/ld+json\" id=\"wl-jsonld-term\">$jsonld_string</script>"; |
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function get( $id ) { |
|
| 164 | + public function get($id) { |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * Support for carousel rich snippet, get jsonld data present |
@@ -172,16 +172,16 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @since 3.26.0 |
| 174 | 174 | */ |
| 175 | - $carousel_data = $this->get_carousel_jsonld( $id ); |
|
| 175 | + $carousel_data = $this->get_carousel_jsonld($id); |
|
| 176 | 176 | $jsonld_array = array(); |
| 177 | - if ( $carousel_data ) { |
|
| 177 | + if ($carousel_data) { |
|
| 178 | 178 | $jsonld_array[] = $carousel_data; |
| 179 | 179 | } |
| 180 | - $context = empty( $carousel_data ) ? Jsonld_Context_Enum::PAGE : Jsonld_Context_Enum::CAROUSEL; |
|
| 181 | - $entities_jsonld_array = $this->get_entity_jsonld( $id, $context ); |
|
| 180 | + $context = empty($carousel_data) ? Jsonld_Context_Enum::PAGE : Jsonld_Context_Enum::CAROUSEL; |
|
| 181 | + $entities_jsonld_array = $this->get_entity_jsonld($id, $context); |
|
| 182 | 182 | |
| 183 | 183 | $result = array( |
| 184 | - 'jsonld' => array_merge( $jsonld_array, $entities_jsonld_array ), |
|
| 184 | + 'jsonld' => array_merge($jsonld_array, $entities_jsonld_array), |
|
| 185 | 185 | 'references' => array() |
| 186 | 186 | ); |
| 187 | 187 | /** |
@@ -190,22 +190,22 @@ discard block |
||
| 190 | 190 | * @var $id int Term id |
| 191 | 191 | * @var $jsonld_array array An array containing jsonld for term and entities. |
| 192 | 192 | */ |
| 193 | - $arr = apply_filters( 'wl_term_jsonld_array', $result, $id ); |
|
| 193 | + $arr = apply_filters('wl_term_jsonld_array', $result, $id); |
|
| 194 | 194 | return $arr['jsonld']; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - private function get_term_url( $id ) { |
|
| 197 | + private function get_term_url($id) { |
|
| 198 | 198 | |
| 199 | - if ( is_null( $id ) ) { |
|
| 199 | + if (is_null($id)) { |
|
| 200 | 200 | return $_SERVER['REQUEST_URI']; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $maybe_url = get_term_meta( $id, Wordlift_Url_Property_Service::META_KEY, true ); |
|
| 204 | - if ( ! empty( $maybe_url ) ) { |
|
| 203 | + $maybe_url = get_term_meta($id, Wordlift_Url_Property_Service::META_KEY, true); |
|
| 204 | + if ( ! empty($maybe_url)) { |
|
| 205 | 205 | return $maybe_url; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - return get_term_link( $id ); |
|
| 208 | + return get_term_link($id); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -216,24 +216,24 @@ discard block |
||
| 216 | 216 | * |
| 217 | 217 | * @return array |
| 218 | 218 | */ |
| 219 | - private function get_entity_jsonld( $term_id, $context ) { |
|
| 219 | + private function get_entity_jsonld($term_id, $context) { |
|
| 220 | 220 | // The `_wl_entity_id` are URIs. |
| 221 | - $entity_ids = get_term_meta( $term_id, '_wl_entity_id' ); |
|
| 221 | + $entity_ids = get_term_meta($term_id, '_wl_entity_id'); |
|
| 222 | 222 | $entity_uri_service = $this->entity_uri_service; |
| 223 | 223 | |
| 224 | - $local_entity_ids = array_filter( $entity_ids, function ( $uri ) use ( $entity_uri_service ) { |
|
| 225 | - return $entity_uri_service->is_internal( $uri ); |
|
| 224 | + $local_entity_ids = array_filter($entity_ids, function($uri) use ($entity_uri_service) { |
|
| 225 | + return $entity_uri_service->is_internal($uri); |
|
| 226 | 226 | } ); |
| 227 | 227 | |
| 228 | 228 | // Bail out if there are no entities. |
| 229 | - if ( empty( $local_entity_ids ) ) { |
|
| 229 | + if (empty($local_entity_ids)) { |
|
| 230 | 230 | return array(); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $post = $this->entity_uri_service->get_entity( array_shift( $local_entity_ids ) ); |
|
| 234 | - $jsonld = $this->jsonld_service->get_jsonld( false, $post->ID, $context ); |
|
| 233 | + $post = $this->entity_uri_service->get_entity(array_shift($local_entity_ids)); |
|
| 234 | + $jsonld = $this->jsonld_service->get_jsonld(false, $post->ID, $context); |
|
| 235 | 235 | // Reset the `url` to the term page. |
| 236 | - $jsonld[0]['url'] = get_term_link( $term_id ); |
|
| 236 | + $jsonld[0]['url'] = get_term_link($term_id); |
|
| 237 | 237 | |
| 238 | 238 | return $jsonld; |
| 239 | 239 | } |
@@ -69,1561 +69,1561 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | class Wordlift { |
| 71 | 71 | |
| 72 | - //<editor-fold desc="## FIELDS"> |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 76 | - * the plugin. |
|
| 77 | - * |
|
| 78 | - * @since 1.0.0 |
|
| 79 | - * @access protected |
|
| 80 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 81 | - */ |
|
| 82 | - protected $loader; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * The unique identifier of this plugin. |
|
| 86 | - * |
|
| 87 | - * @since 1.0.0 |
|
| 88 | - * @access protected |
|
| 89 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 90 | - */ |
|
| 91 | - protected $plugin_name; |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * The current version of the plugin. |
|
| 95 | - * |
|
| 96 | - * @since 1.0.0 |
|
| 97 | - * @access protected |
|
| 98 | - * @var string $version The current version of the plugin. |
|
| 99 | - */ |
|
| 100 | - protected $version; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 104 | - * |
|
| 105 | - * @since 3.12.0 |
|
| 106 | - * @access protected |
|
| 107 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 108 | - */ |
|
| 109 | - protected $tinymce_adapter; |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 113 | - * @since 3.26.0 |
|
| 114 | - * @access protected |
|
| 115 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 116 | - */ |
|
| 117 | - //protected $faq_tinymce_adapter; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The Thumbnail service. |
|
| 121 | - * |
|
| 122 | - * @since 3.1.5 |
|
| 123 | - * @access private |
|
| 124 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 125 | - */ |
|
| 126 | - private $thumbnail_service; |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * The UI service. |
|
| 130 | - * |
|
| 131 | - * @since 3.2.0 |
|
| 132 | - * @access private |
|
| 133 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 134 | - */ |
|
| 135 | - private $ui_service; |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * The Schema service. |
|
| 139 | - * |
|
| 140 | - * @since 3.3.0 |
|
| 141 | - * @access protected |
|
| 142 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 143 | - */ |
|
| 144 | - protected $schema_service; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * The Entity service. |
|
| 148 | - * |
|
| 149 | - * @since 3.1.0 |
|
| 150 | - * @access protected |
|
| 151 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 152 | - */ |
|
| 153 | - protected $entity_service; |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * The Topic Taxonomy service. |
|
| 157 | - * |
|
| 158 | - * @since 3.5.0 |
|
| 159 | - * @access private |
|
| 160 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 161 | - */ |
|
| 162 | - private $topic_taxonomy_service; |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * The Entity Types Taxonomy service. |
|
| 166 | - * |
|
| 167 | - * @since 3.18.0 |
|
| 168 | - * @access private |
|
| 169 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 170 | - */ |
|
| 171 | - private $entity_types_taxonomy_service; |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * The User service. |
|
| 175 | - * |
|
| 176 | - * @since 3.1.7 |
|
| 177 | - * @access protected |
|
| 178 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 179 | - */ |
|
| 180 | - protected $user_service; |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * The Timeline service. |
|
| 184 | - * |
|
| 185 | - * @since 3.1.0 |
|
| 186 | - * @access private |
|
| 187 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 188 | - */ |
|
| 189 | - private $timeline_service; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * The Redirect service. |
|
| 193 | - * |
|
| 194 | - * @since 3.2.0 |
|
| 195 | - * @access private |
|
| 196 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 197 | - */ |
|
| 198 | - private $redirect_service; |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * The Notice service. |
|
| 202 | - * |
|
| 203 | - * @since 3.3.0 |
|
| 204 | - * @access private |
|
| 205 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 206 | - */ |
|
| 207 | - private $notice_service; |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * The Entity list customization. |
|
| 211 | - * |
|
| 212 | - * @since 3.3.0 |
|
| 213 | - * @access protected |
|
| 214 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 215 | - */ |
|
| 216 | - protected $entity_list_service; |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * The Entity Types Taxonomy Walker. |
|
| 220 | - * |
|
| 221 | - * @since 3.1.0 |
|
| 222 | - * @access private |
|
| 223 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 224 | - */ |
|
| 225 | - private $entity_types_taxonomy_walker; |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * The ShareThis service. |
|
| 229 | - * |
|
| 230 | - * @since 3.2.0 |
|
| 231 | - * @access private |
|
| 232 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 233 | - */ |
|
| 234 | - private $sharethis_service; |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * The PrimaShop adapter. |
|
| 238 | - * |
|
| 239 | - * @since 3.2.3 |
|
| 240 | - * @access private |
|
| 241 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 242 | - */ |
|
| 243 | - private $primashop_adapter; |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * The WordLift Dashboard adapter. |
|
| 247 | - * |
|
| 248 | - * @since 3.4.0 |
|
| 249 | - * @access private |
|
| 250 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 251 | - */ |
|
| 252 | - private $dashboard_service; |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * The entity type service. |
|
| 256 | - * |
|
| 257 | - * @since 3.6.0 |
|
| 258 | - * @access private |
|
| 259 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 260 | - */ |
|
| 261 | - private $entity_post_type_service; |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 265 | - * |
|
| 266 | - * @since 3.6.0 |
|
| 267 | - * @access private |
|
| 268 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 269 | - */ |
|
| 270 | - private $entity_link_service; |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 274 | - * |
|
| 275 | - * @since 3.6.0 |
|
| 276 | - * @access protected |
|
| 277 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 278 | - */ |
|
| 279 | - protected $sparql_service; |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * A {@link Wordlift_Import_Service} instance. |
|
| 283 | - * |
|
| 284 | - * @since 3.6.0 |
|
| 285 | - * @access private |
|
| 286 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 287 | - */ |
|
| 288 | - private $import_service; |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 292 | - * |
|
| 293 | - * @since 3.6.0 |
|
| 294 | - * @access private |
|
| 295 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 296 | - */ |
|
| 297 | - private $rebuild_service; |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 301 | - * |
|
| 302 | - * @since 3.7.0 |
|
| 303 | - * @access protected |
|
| 304 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 305 | - */ |
|
| 306 | - protected $jsonld_service; |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 310 | - * |
|
| 311 | - * @since 3.14.0 |
|
| 312 | - * @access protected |
|
| 313 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 314 | - */ |
|
| 315 | - protected $jsonld_website_converter; |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 319 | - * |
|
| 320 | - * @since 3.7.0 |
|
| 321 | - * @access private |
|
| 322 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 323 | - */ |
|
| 324 | - private $property_factory; |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * The 'Download Your Data' page. |
|
| 328 | - * |
|
| 329 | - * @since 3.6.0 |
|
| 330 | - * @access private |
|
| 331 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 332 | - */ |
|
| 333 | - private $download_your_data_page; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * The 'WordLift Settings' page. |
|
| 337 | - * |
|
| 338 | - * @since 3.11.0 |
|
| 339 | - * @access protected |
|
| 340 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 341 | - */ |
|
| 342 | - protected $settings_page; |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * The install wizard page. |
|
| 346 | - * |
|
| 347 | - * @since 3.9.0 |
|
| 348 | - * @access private |
|
| 349 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 350 | - */ |
|
| 351 | - public $admin_setup; |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 355 | - * linking of entities to their pages. |
|
| 356 | - * |
|
| 357 | - * @since 3.8.0 |
|
| 358 | - * @access private |
|
| 359 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 360 | - */ |
|
| 361 | - private $content_filter_service; |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * The Faq Content filter service |
|
| 365 | - * @since 3.26.0 |
|
| 366 | - * @access private |
|
| 367 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 368 | - */ |
|
| 369 | - private $faq_content_filter_service; |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 373 | - * |
|
| 374 | - * @since 3.9.0 |
|
| 375 | - * @access private |
|
| 376 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 377 | - */ |
|
| 378 | - private $key_validation_service; |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 382 | - * |
|
| 383 | - * @since 3.10.0 |
|
| 384 | - * @access private |
|
| 385 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 386 | - */ |
|
| 387 | - private $rating_service; |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 391 | - * |
|
| 392 | - * @since 3.10.0 |
|
| 393 | - * @access protected |
|
| 394 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 395 | - */ |
|
| 396 | - protected $post_to_jsonld_converter; |
|
| 397 | - |
|
| 398 | - /** |
|
| 399 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 400 | - * |
|
| 401 | - * @since 3.10.0 |
|
| 402 | - * @access protected |
|
| 403 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 404 | - */ |
|
| 405 | - protected $configuration_service; |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * A {@link Wordlift_Install_Service} instance. |
|
| 409 | - * |
|
| 410 | - * @since 3.18.0 |
|
| 411 | - * @access protected |
|
| 412 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 413 | - */ |
|
| 414 | - protected $install_service; |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 418 | - * |
|
| 419 | - * @since 3.10.0 |
|
| 420 | - * @access protected |
|
| 421 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 422 | - */ |
|
| 423 | - protected $entity_type_service; |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 427 | - * |
|
| 428 | - * @since 3.10.0 |
|
| 429 | - * @access protected |
|
| 430 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 431 | - */ |
|
| 432 | - protected $entity_post_to_jsonld_converter; |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 436 | - * |
|
| 437 | - * @since 3.10.0 |
|
| 438 | - * @access protected |
|
| 439 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 440 | - */ |
|
| 441 | - protected $postid_to_jsonld_converter; |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 445 | - * |
|
| 446 | - * @since 3.9.8 |
|
| 447 | - * @access private |
|
| 448 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 449 | - */ |
|
| 450 | - private $status_page; |
|
| 451 | - |
|
| 452 | - /** |
|
| 453 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 454 | - * |
|
| 455 | - * @since 3.11.0 |
|
| 456 | - * @access protected |
|
| 457 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 458 | - */ |
|
| 459 | - protected $category_taxonomy_service; |
|
| 460 | - |
|
| 461 | - /** |
|
| 462 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 463 | - * |
|
| 464 | - * @since 3.11.0 |
|
| 465 | - * @access protected |
|
| 466 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 467 | - */ |
|
| 468 | - protected $entity_page_service; |
|
| 469 | - |
|
| 470 | - /** |
|
| 471 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 472 | - * |
|
| 473 | - * @since 3.11.0 |
|
| 474 | - * @access protected |
|
| 475 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 476 | - */ |
|
| 477 | - protected $settings_page_action_link; |
|
| 478 | - |
|
| 479 | - /** |
|
| 480 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 481 | - * |
|
| 482 | - * @since 3.11.0 |
|
| 483 | - * @access protected |
|
| 484 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 485 | - */ |
|
| 486 | - protected $analytics_settings_page_action_link; |
|
| 487 | - |
|
| 488 | - /** |
|
| 489 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 490 | - * |
|
| 491 | - * @since 3.11.0 |
|
| 492 | - * @access protected |
|
| 493 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 494 | - */ |
|
| 495 | - protected $analytics_connect; |
|
| 496 | - |
|
| 497 | - /** |
|
| 498 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 499 | - * |
|
| 500 | - * @since 3.11.0 |
|
| 501 | - * @access protected |
|
| 502 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 503 | - */ |
|
| 504 | - protected $publisher_ajax_adapter; |
|
| 505 | - |
|
| 506 | - /** |
|
| 507 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 508 | - * |
|
| 509 | - * @since 3.11.0 |
|
| 510 | - * @access protected |
|
| 511 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 512 | - */ |
|
| 513 | - protected $input_element; |
|
| 514 | - |
|
| 515 | - /** |
|
| 516 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 517 | - * |
|
| 518 | - * @since 3.13.0 |
|
| 519 | - * @access protected |
|
| 520 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 521 | - */ |
|
| 522 | - protected $radio_input_element; |
|
| 523 | - |
|
| 524 | - /** |
|
| 525 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 526 | - * |
|
| 527 | - * @since 3.11.0 |
|
| 528 | - * @access protected |
|
| 529 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 530 | - */ |
|
| 531 | - protected $language_select_element; |
|
| 532 | - |
|
| 533 | - /** |
|
| 534 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 535 | - * |
|
| 536 | - * @since 3.18.0 |
|
| 537 | - * @access protected |
|
| 538 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 539 | - */ |
|
| 540 | - protected $country_select_element; |
|
| 541 | - |
|
| 542 | - /** |
|
| 543 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 544 | - * |
|
| 545 | - * @since 3.11.0 |
|
| 546 | - * @access protected |
|
| 547 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 548 | - */ |
|
| 549 | - protected $publisher_element; |
|
| 550 | - |
|
| 551 | - /** |
|
| 552 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 553 | - * |
|
| 554 | - * @since 3.11.0 |
|
| 555 | - * @access protected |
|
| 556 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 557 | - */ |
|
| 558 | - protected $select2_element; |
|
| 559 | - |
|
| 560 | - /** |
|
| 561 | - * The controller for the entity type list admin page |
|
| 562 | - * |
|
| 563 | - * @since 3.11.0 |
|
| 564 | - * @access private |
|
| 565 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 566 | - */ |
|
| 567 | - private $entity_type_admin_page; |
|
| 568 | - |
|
| 569 | - /** |
|
| 570 | - * The controller for the entity type settings admin page |
|
| 571 | - * |
|
| 572 | - * @since 3.11.0 |
|
| 573 | - * @access private |
|
| 574 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 575 | - */ |
|
| 576 | - private $entity_type_settings_admin_page; |
|
| 577 | - |
|
| 578 | - /** |
|
| 579 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 580 | - * |
|
| 581 | - * @since 3.11.0 |
|
| 582 | - * @access protected |
|
| 583 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 584 | - */ |
|
| 585 | - protected $related_entities_cloud_widget; |
|
| 586 | - |
|
| 587 | - /** |
|
| 588 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 589 | - * |
|
| 590 | - * @since 3.14.0 |
|
| 591 | - * @access protected |
|
| 592 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 593 | - */ |
|
| 594 | - protected $author_element; |
|
| 595 | - |
|
| 596 | - /** |
|
| 597 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 598 | - * |
|
| 599 | - * @since 3.12.0 |
|
| 600 | - * @access protected |
|
| 601 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 602 | - */ |
|
| 603 | - protected $sample_data_service; |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 607 | - * |
|
| 608 | - * @since 3.12.0 |
|
| 609 | - * @access protected |
|
| 610 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 611 | - */ |
|
| 612 | - protected $sample_data_ajax_adapter; |
|
| 613 | - |
|
| 614 | - /** |
|
| 615 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 616 | - * |
|
| 617 | - * @since 3.14.3 |
|
| 618 | - * @access private |
|
| 619 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 620 | - */ |
|
| 621 | - private $relation_rebuild_service; |
|
| 622 | - |
|
| 623 | - /** |
|
| 624 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 625 | - * |
|
| 626 | - * @since 3.14.3 |
|
| 627 | - * @access private |
|
| 628 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 629 | - */ |
|
| 630 | - private $relation_rebuild_adapter; |
|
| 631 | - |
|
| 632 | - /** |
|
| 633 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 634 | - * |
|
| 635 | - * @since 3.18.0 |
|
| 636 | - * @access private |
|
| 637 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 638 | - */ |
|
| 639 | - private $reference_rebuild_service; |
|
| 640 | - |
|
| 641 | - /** |
|
| 642 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 643 | - * |
|
| 644 | - * @since 3.16.0 |
|
| 645 | - * @access protected |
|
| 646 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 647 | - */ |
|
| 648 | - protected $google_analytics_export_service; |
|
| 649 | - |
|
| 650 | - /** |
|
| 651 | - * {@link Wordlift}'s singleton instance. |
|
| 652 | - * |
|
| 653 | - * @since 3.15.0 |
|
| 654 | - * @access protected |
|
| 655 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 656 | - */ |
|
| 657 | - protected $entity_type_adapter; |
|
| 658 | - |
|
| 659 | - /** |
|
| 660 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 661 | - * |
|
| 662 | - * @since 3.15.0 |
|
| 663 | - * @access protected |
|
| 664 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 665 | - */ |
|
| 666 | - protected $storage_factory; |
|
| 667 | - |
|
| 668 | - /** |
|
| 669 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 670 | - * |
|
| 671 | - * @since 3.15.0 |
|
| 672 | - * @access protected |
|
| 673 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 674 | - */ |
|
| 675 | - protected $rendition_factory; |
|
| 676 | - |
|
| 677 | - /** |
|
| 678 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 679 | - * |
|
| 680 | - * @since 3.15.0 |
|
| 681 | - * @access private |
|
| 682 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 683 | - */ |
|
| 684 | - private $autocomplete_adapter; |
|
| 685 | - |
|
| 686 | - /** |
|
| 687 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 688 | - * |
|
| 689 | - * @since 3.15.0 |
|
| 690 | - * @access protected |
|
| 691 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 692 | - */ |
|
| 693 | - protected $relation_service; |
|
| 694 | - |
|
| 695 | - /** |
|
| 696 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 697 | - * |
|
| 698 | - * @since 3.16.0 |
|
| 699 | - * @access protected |
|
| 700 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 701 | - * |
|
| 702 | - */ |
|
| 703 | - protected $cached_postid_to_jsonld_converter; |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 707 | - * |
|
| 708 | - * @since 3.16.3 |
|
| 709 | - * @access protected |
|
| 710 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 711 | - */ |
|
| 712 | - protected $entity_uri_service; |
|
| 713 | - |
|
| 714 | - /** |
|
| 715 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 716 | - * |
|
| 717 | - * @since 3.19.0 |
|
| 718 | - * @access protected |
|
| 719 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 720 | - */ |
|
| 721 | - protected $publisher_service; |
|
| 722 | - |
|
| 723 | - /** |
|
| 724 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 725 | - * |
|
| 726 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 727 | - */ |
|
| 728 | - protected $context_cards_service; |
|
| 729 | - |
|
| 730 | - /** |
|
| 731 | - * {@link Wordlift}'s singleton instance. |
|
| 732 | - * |
|
| 733 | - * @since 3.11.2 |
|
| 734 | - * @access private |
|
| 735 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 736 | - */ |
|
| 737 | - private static $instance; |
|
| 738 | - |
|
| 739 | - //</editor-fold> |
|
| 740 | - |
|
| 741 | - /** |
|
| 742 | - * Define the core functionality of the plugin. |
|
| 743 | - * |
|
| 744 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 745 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 746 | - * the public-facing side of the site. |
|
| 747 | - * |
|
| 748 | - * @since 1.0.0 |
|
| 749 | - */ |
|
| 750 | - public function __construct() { |
|
| 751 | - |
|
| 752 | - self::$instance = $this; |
|
| 753 | - |
|
| 754 | - $this->plugin_name = 'wordlift'; |
|
| 755 | - $this->version = '3.28.1'; |
|
| 756 | - $this->load_dependencies(); |
|
| 757 | - $this->set_locale(); |
|
| 758 | - $this->define_admin_hooks(); |
|
| 759 | - $this->define_public_hooks(); |
|
| 760 | - |
|
| 761 | - // If we're in `WP_CLI` load the related files. |
|
| 762 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 763 | - $this->load_cli_dependencies(); |
|
| 764 | - } |
|
| 765 | - |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - /** |
|
| 769 | - * Get the singleton instance. |
|
| 770 | - * |
|
| 771 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 772 | - * @since 3.11.2 |
|
| 773 | - * |
|
| 774 | - */ |
|
| 775 | - public static function get_instance() { |
|
| 776 | - |
|
| 777 | - return self::$instance; |
|
| 778 | - } |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * Load the required dependencies for this plugin. |
|
| 782 | - * |
|
| 783 | - * Include the following files that make up the plugin: |
|
| 784 | - * |
|
| 785 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 786 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 787 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 788 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 789 | - * |
|
| 790 | - * Create an instance of the loader which will be used to register the hooks |
|
| 791 | - * with WordPress. |
|
| 792 | - * |
|
| 793 | - * @throws Exception |
|
| 794 | - * @since 1.0.0 |
|
| 795 | - * @access private |
|
| 796 | - */ |
|
| 797 | - private function load_dependencies() { |
|
| 798 | - |
|
| 799 | - /** |
|
| 800 | - * The class responsible for orchestrating the actions and filters of the |
|
| 801 | - * core plugin. |
|
| 802 | - */ |
|
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 804 | - |
|
| 805 | - // The class responsible for plugin uninstall. |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * The class responsible for defining internationalization functionality |
|
| 810 | - * of the plugin. |
|
| 811 | - */ |
|
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 813 | - |
|
| 814 | - /** |
|
| 815 | - * WordLift's supported languages. |
|
| 816 | - */ |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 818 | - |
|
| 819 | - /** |
|
| 820 | - * WordLift's supported countries. |
|
| 821 | - */ |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * Provide support functions to sanitize data. |
|
| 826 | - */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 828 | - |
|
| 829 | - /** Services. */ |
|
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 834 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 836 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 839 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 840 | - |
|
| 841 | - /** |
|
| 842 | - * The Query builder. |
|
| 843 | - */ |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The Schema service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * The schema:url property service. |
|
| 853 | - */ |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * The UI service. |
|
| 859 | - */ |
|
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The Thumbnail service. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * The Entity Types Taxonomy service. |
|
| 869 | - */ |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 871 | - |
|
| 872 | - /** |
|
| 873 | - * The Entity service. |
|
| 874 | - */ |
|
| 875 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 876 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 877 | - |
|
| 878 | - // Add the entity rating service. |
|
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 880 | - |
|
| 881 | - /** |
|
| 882 | - * The User service. |
|
| 883 | - */ |
|
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 885 | - |
|
| 886 | - /** |
|
| 887 | - * The Timeline service. |
|
| 888 | - */ |
|
| 889 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 890 | - |
|
| 891 | - /** |
|
| 892 | - * The Topic Taxonomy service. |
|
| 893 | - */ |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 895 | - |
|
| 896 | - /** |
|
| 897 | - * The SPARQL service. |
|
| 898 | - */ |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 900 | - |
|
| 901 | - /** |
|
| 902 | - * The WordLift import service. |
|
| 903 | - */ |
|
| 904 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 905 | - |
|
| 906 | - /** |
|
| 907 | - * The WordLift URI service. |
|
| 908 | - */ |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 912 | - |
|
| 913 | - /** |
|
| 914 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 915 | - */ |
|
| 916 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 921 | - |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 924 | - |
|
| 925 | - /** |
|
| 926 | - * Load the converters. |
|
| 927 | - */ |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 929 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 930 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 934 | - |
|
| 935 | - /** |
|
| 936 | - * Load cache-related files. |
|
| 937 | - */ |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 939 | - |
|
| 940 | - /** |
|
| 941 | - * Load the content filter. |
|
| 942 | - */ |
|
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 944 | - |
|
| 945 | - /* |
|
| 72 | + //<editor-fold desc="## FIELDS"> |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 76 | + * the plugin. |
|
| 77 | + * |
|
| 78 | + * @since 1.0.0 |
|
| 79 | + * @access protected |
|
| 80 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 81 | + */ |
|
| 82 | + protected $loader; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * The unique identifier of this plugin. |
|
| 86 | + * |
|
| 87 | + * @since 1.0.0 |
|
| 88 | + * @access protected |
|
| 89 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 90 | + */ |
|
| 91 | + protected $plugin_name; |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * The current version of the plugin. |
|
| 95 | + * |
|
| 96 | + * @since 1.0.0 |
|
| 97 | + * @access protected |
|
| 98 | + * @var string $version The current version of the plugin. |
|
| 99 | + */ |
|
| 100 | + protected $version; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 104 | + * |
|
| 105 | + * @since 3.12.0 |
|
| 106 | + * @access protected |
|
| 107 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 108 | + */ |
|
| 109 | + protected $tinymce_adapter; |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 113 | + * @since 3.26.0 |
|
| 114 | + * @access protected |
|
| 115 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 116 | + */ |
|
| 117 | + //protected $faq_tinymce_adapter; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The Thumbnail service. |
|
| 121 | + * |
|
| 122 | + * @since 3.1.5 |
|
| 123 | + * @access private |
|
| 124 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 125 | + */ |
|
| 126 | + private $thumbnail_service; |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * The UI service. |
|
| 130 | + * |
|
| 131 | + * @since 3.2.0 |
|
| 132 | + * @access private |
|
| 133 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 134 | + */ |
|
| 135 | + private $ui_service; |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * The Schema service. |
|
| 139 | + * |
|
| 140 | + * @since 3.3.0 |
|
| 141 | + * @access protected |
|
| 142 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 143 | + */ |
|
| 144 | + protected $schema_service; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * The Entity service. |
|
| 148 | + * |
|
| 149 | + * @since 3.1.0 |
|
| 150 | + * @access protected |
|
| 151 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 152 | + */ |
|
| 153 | + protected $entity_service; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * The Topic Taxonomy service. |
|
| 157 | + * |
|
| 158 | + * @since 3.5.0 |
|
| 159 | + * @access private |
|
| 160 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 161 | + */ |
|
| 162 | + private $topic_taxonomy_service; |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * The Entity Types Taxonomy service. |
|
| 166 | + * |
|
| 167 | + * @since 3.18.0 |
|
| 168 | + * @access private |
|
| 169 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 170 | + */ |
|
| 171 | + private $entity_types_taxonomy_service; |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * The User service. |
|
| 175 | + * |
|
| 176 | + * @since 3.1.7 |
|
| 177 | + * @access protected |
|
| 178 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 179 | + */ |
|
| 180 | + protected $user_service; |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * The Timeline service. |
|
| 184 | + * |
|
| 185 | + * @since 3.1.0 |
|
| 186 | + * @access private |
|
| 187 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 188 | + */ |
|
| 189 | + private $timeline_service; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * The Redirect service. |
|
| 193 | + * |
|
| 194 | + * @since 3.2.0 |
|
| 195 | + * @access private |
|
| 196 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 197 | + */ |
|
| 198 | + private $redirect_service; |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * The Notice service. |
|
| 202 | + * |
|
| 203 | + * @since 3.3.0 |
|
| 204 | + * @access private |
|
| 205 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 206 | + */ |
|
| 207 | + private $notice_service; |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * The Entity list customization. |
|
| 211 | + * |
|
| 212 | + * @since 3.3.0 |
|
| 213 | + * @access protected |
|
| 214 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 215 | + */ |
|
| 216 | + protected $entity_list_service; |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * The Entity Types Taxonomy Walker. |
|
| 220 | + * |
|
| 221 | + * @since 3.1.0 |
|
| 222 | + * @access private |
|
| 223 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 224 | + */ |
|
| 225 | + private $entity_types_taxonomy_walker; |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * The ShareThis service. |
|
| 229 | + * |
|
| 230 | + * @since 3.2.0 |
|
| 231 | + * @access private |
|
| 232 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 233 | + */ |
|
| 234 | + private $sharethis_service; |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * The PrimaShop adapter. |
|
| 238 | + * |
|
| 239 | + * @since 3.2.3 |
|
| 240 | + * @access private |
|
| 241 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 242 | + */ |
|
| 243 | + private $primashop_adapter; |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * The WordLift Dashboard adapter. |
|
| 247 | + * |
|
| 248 | + * @since 3.4.0 |
|
| 249 | + * @access private |
|
| 250 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 251 | + */ |
|
| 252 | + private $dashboard_service; |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * The entity type service. |
|
| 256 | + * |
|
| 257 | + * @since 3.6.0 |
|
| 258 | + * @access private |
|
| 259 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 260 | + */ |
|
| 261 | + private $entity_post_type_service; |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 265 | + * |
|
| 266 | + * @since 3.6.0 |
|
| 267 | + * @access private |
|
| 268 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 269 | + */ |
|
| 270 | + private $entity_link_service; |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 274 | + * |
|
| 275 | + * @since 3.6.0 |
|
| 276 | + * @access protected |
|
| 277 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 278 | + */ |
|
| 279 | + protected $sparql_service; |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * A {@link Wordlift_Import_Service} instance. |
|
| 283 | + * |
|
| 284 | + * @since 3.6.0 |
|
| 285 | + * @access private |
|
| 286 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 287 | + */ |
|
| 288 | + private $import_service; |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 292 | + * |
|
| 293 | + * @since 3.6.0 |
|
| 294 | + * @access private |
|
| 295 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 296 | + */ |
|
| 297 | + private $rebuild_service; |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 301 | + * |
|
| 302 | + * @since 3.7.0 |
|
| 303 | + * @access protected |
|
| 304 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 305 | + */ |
|
| 306 | + protected $jsonld_service; |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 310 | + * |
|
| 311 | + * @since 3.14.0 |
|
| 312 | + * @access protected |
|
| 313 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 314 | + */ |
|
| 315 | + protected $jsonld_website_converter; |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 319 | + * |
|
| 320 | + * @since 3.7.0 |
|
| 321 | + * @access private |
|
| 322 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 323 | + */ |
|
| 324 | + private $property_factory; |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * The 'Download Your Data' page. |
|
| 328 | + * |
|
| 329 | + * @since 3.6.0 |
|
| 330 | + * @access private |
|
| 331 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 332 | + */ |
|
| 333 | + private $download_your_data_page; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * The 'WordLift Settings' page. |
|
| 337 | + * |
|
| 338 | + * @since 3.11.0 |
|
| 339 | + * @access protected |
|
| 340 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 341 | + */ |
|
| 342 | + protected $settings_page; |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * The install wizard page. |
|
| 346 | + * |
|
| 347 | + * @since 3.9.0 |
|
| 348 | + * @access private |
|
| 349 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 350 | + */ |
|
| 351 | + public $admin_setup; |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 355 | + * linking of entities to their pages. |
|
| 356 | + * |
|
| 357 | + * @since 3.8.0 |
|
| 358 | + * @access private |
|
| 359 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 360 | + */ |
|
| 361 | + private $content_filter_service; |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * The Faq Content filter service |
|
| 365 | + * @since 3.26.0 |
|
| 366 | + * @access private |
|
| 367 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 368 | + */ |
|
| 369 | + private $faq_content_filter_service; |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 373 | + * |
|
| 374 | + * @since 3.9.0 |
|
| 375 | + * @access private |
|
| 376 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 377 | + */ |
|
| 378 | + private $key_validation_service; |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 382 | + * |
|
| 383 | + * @since 3.10.0 |
|
| 384 | + * @access private |
|
| 385 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 386 | + */ |
|
| 387 | + private $rating_service; |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 391 | + * |
|
| 392 | + * @since 3.10.0 |
|
| 393 | + * @access protected |
|
| 394 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 395 | + */ |
|
| 396 | + protected $post_to_jsonld_converter; |
|
| 397 | + |
|
| 398 | + /** |
|
| 399 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 400 | + * |
|
| 401 | + * @since 3.10.0 |
|
| 402 | + * @access protected |
|
| 403 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 404 | + */ |
|
| 405 | + protected $configuration_service; |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * A {@link Wordlift_Install_Service} instance. |
|
| 409 | + * |
|
| 410 | + * @since 3.18.0 |
|
| 411 | + * @access protected |
|
| 412 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 413 | + */ |
|
| 414 | + protected $install_service; |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 418 | + * |
|
| 419 | + * @since 3.10.0 |
|
| 420 | + * @access protected |
|
| 421 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 422 | + */ |
|
| 423 | + protected $entity_type_service; |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 427 | + * |
|
| 428 | + * @since 3.10.0 |
|
| 429 | + * @access protected |
|
| 430 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 431 | + */ |
|
| 432 | + protected $entity_post_to_jsonld_converter; |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 436 | + * |
|
| 437 | + * @since 3.10.0 |
|
| 438 | + * @access protected |
|
| 439 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 440 | + */ |
|
| 441 | + protected $postid_to_jsonld_converter; |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 445 | + * |
|
| 446 | + * @since 3.9.8 |
|
| 447 | + * @access private |
|
| 448 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 449 | + */ |
|
| 450 | + private $status_page; |
|
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 454 | + * |
|
| 455 | + * @since 3.11.0 |
|
| 456 | + * @access protected |
|
| 457 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 458 | + */ |
|
| 459 | + protected $category_taxonomy_service; |
|
| 460 | + |
|
| 461 | + /** |
|
| 462 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 463 | + * |
|
| 464 | + * @since 3.11.0 |
|
| 465 | + * @access protected |
|
| 466 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 467 | + */ |
|
| 468 | + protected $entity_page_service; |
|
| 469 | + |
|
| 470 | + /** |
|
| 471 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 472 | + * |
|
| 473 | + * @since 3.11.0 |
|
| 474 | + * @access protected |
|
| 475 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 476 | + */ |
|
| 477 | + protected $settings_page_action_link; |
|
| 478 | + |
|
| 479 | + /** |
|
| 480 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 481 | + * |
|
| 482 | + * @since 3.11.0 |
|
| 483 | + * @access protected |
|
| 484 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 485 | + */ |
|
| 486 | + protected $analytics_settings_page_action_link; |
|
| 487 | + |
|
| 488 | + /** |
|
| 489 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 490 | + * |
|
| 491 | + * @since 3.11.0 |
|
| 492 | + * @access protected |
|
| 493 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 494 | + */ |
|
| 495 | + protected $analytics_connect; |
|
| 496 | + |
|
| 497 | + /** |
|
| 498 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 499 | + * |
|
| 500 | + * @since 3.11.0 |
|
| 501 | + * @access protected |
|
| 502 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 503 | + */ |
|
| 504 | + protected $publisher_ajax_adapter; |
|
| 505 | + |
|
| 506 | + /** |
|
| 507 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 508 | + * |
|
| 509 | + * @since 3.11.0 |
|
| 510 | + * @access protected |
|
| 511 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 512 | + */ |
|
| 513 | + protected $input_element; |
|
| 514 | + |
|
| 515 | + /** |
|
| 516 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 517 | + * |
|
| 518 | + * @since 3.13.0 |
|
| 519 | + * @access protected |
|
| 520 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 521 | + */ |
|
| 522 | + protected $radio_input_element; |
|
| 523 | + |
|
| 524 | + /** |
|
| 525 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 526 | + * |
|
| 527 | + * @since 3.11.0 |
|
| 528 | + * @access protected |
|
| 529 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 530 | + */ |
|
| 531 | + protected $language_select_element; |
|
| 532 | + |
|
| 533 | + /** |
|
| 534 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 535 | + * |
|
| 536 | + * @since 3.18.0 |
|
| 537 | + * @access protected |
|
| 538 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 539 | + */ |
|
| 540 | + protected $country_select_element; |
|
| 541 | + |
|
| 542 | + /** |
|
| 543 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 544 | + * |
|
| 545 | + * @since 3.11.0 |
|
| 546 | + * @access protected |
|
| 547 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 548 | + */ |
|
| 549 | + protected $publisher_element; |
|
| 550 | + |
|
| 551 | + /** |
|
| 552 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 553 | + * |
|
| 554 | + * @since 3.11.0 |
|
| 555 | + * @access protected |
|
| 556 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 557 | + */ |
|
| 558 | + protected $select2_element; |
|
| 559 | + |
|
| 560 | + /** |
|
| 561 | + * The controller for the entity type list admin page |
|
| 562 | + * |
|
| 563 | + * @since 3.11.0 |
|
| 564 | + * @access private |
|
| 565 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 566 | + */ |
|
| 567 | + private $entity_type_admin_page; |
|
| 568 | + |
|
| 569 | + /** |
|
| 570 | + * The controller for the entity type settings admin page |
|
| 571 | + * |
|
| 572 | + * @since 3.11.0 |
|
| 573 | + * @access private |
|
| 574 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 575 | + */ |
|
| 576 | + private $entity_type_settings_admin_page; |
|
| 577 | + |
|
| 578 | + /** |
|
| 579 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 580 | + * |
|
| 581 | + * @since 3.11.0 |
|
| 582 | + * @access protected |
|
| 583 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 584 | + */ |
|
| 585 | + protected $related_entities_cloud_widget; |
|
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 589 | + * |
|
| 590 | + * @since 3.14.0 |
|
| 591 | + * @access protected |
|
| 592 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 593 | + */ |
|
| 594 | + protected $author_element; |
|
| 595 | + |
|
| 596 | + /** |
|
| 597 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 598 | + * |
|
| 599 | + * @since 3.12.0 |
|
| 600 | + * @access protected |
|
| 601 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 602 | + */ |
|
| 603 | + protected $sample_data_service; |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 607 | + * |
|
| 608 | + * @since 3.12.0 |
|
| 609 | + * @access protected |
|
| 610 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 611 | + */ |
|
| 612 | + protected $sample_data_ajax_adapter; |
|
| 613 | + |
|
| 614 | + /** |
|
| 615 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 616 | + * |
|
| 617 | + * @since 3.14.3 |
|
| 618 | + * @access private |
|
| 619 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 620 | + */ |
|
| 621 | + private $relation_rebuild_service; |
|
| 622 | + |
|
| 623 | + /** |
|
| 624 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 625 | + * |
|
| 626 | + * @since 3.14.3 |
|
| 627 | + * @access private |
|
| 628 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 629 | + */ |
|
| 630 | + private $relation_rebuild_adapter; |
|
| 631 | + |
|
| 632 | + /** |
|
| 633 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 634 | + * |
|
| 635 | + * @since 3.18.0 |
|
| 636 | + * @access private |
|
| 637 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 638 | + */ |
|
| 639 | + private $reference_rebuild_service; |
|
| 640 | + |
|
| 641 | + /** |
|
| 642 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 643 | + * |
|
| 644 | + * @since 3.16.0 |
|
| 645 | + * @access protected |
|
| 646 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 647 | + */ |
|
| 648 | + protected $google_analytics_export_service; |
|
| 649 | + |
|
| 650 | + /** |
|
| 651 | + * {@link Wordlift}'s singleton instance. |
|
| 652 | + * |
|
| 653 | + * @since 3.15.0 |
|
| 654 | + * @access protected |
|
| 655 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 656 | + */ |
|
| 657 | + protected $entity_type_adapter; |
|
| 658 | + |
|
| 659 | + /** |
|
| 660 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 661 | + * |
|
| 662 | + * @since 3.15.0 |
|
| 663 | + * @access protected |
|
| 664 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 665 | + */ |
|
| 666 | + protected $storage_factory; |
|
| 667 | + |
|
| 668 | + /** |
|
| 669 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 670 | + * |
|
| 671 | + * @since 3.15.0 |
|
| 672 | + * @access protected |
|
| 673 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 674 | + */ |
|
| 675 | + protected $rendition_factory; |
|
| 676 | + |
|
| 677 | + /** |
|
| 678 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 679 | + * |
|
| 680 | + * @since 3.15.0 |
|
| 681 | + * @access private |
|
| 682 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 683 | + */ |
|
| 684 | + private $autocomplete_adapter; |
|
| 685 | + |
|
| 686 | + /** |
|
| 687 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 688 | + * |
|
| 689 | + * @since 3.15.0 |
|
| 690 | + * @access protected |
|
| 691 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 692 | + */ |
|
| 693 | + protected $relation_service; |
|
| 694 | + |
|
| 695 | + /** |
|
| 696 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 697 | + * |
|
| 698 | + * @since 3.16.0 |
|
| 699 | + * @access protected |
|
| 700 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 701 | + * |
|
| 702 | + */ |
|
| 703 | + protected $cached_postid_to_jsonld_converter; |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 707 | + * |
|
| 708 | + * @since 3.16.3 |
|
| 709 | + * @access protected |
|
| 710 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 711 | + */ |
|
| 712 | + protected $entity_uri_service; |
|
| 713 | + |
|
| 714 | + /** |
|
| 715 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 716 | + * |
|
| 717 | + * @since 3.19.0 |
|
| 718 | + * @access protected |
|
| 719 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 720 | + */ |
|
| 721 | + protected $publisher_service; |
|
| 722 | + |
|
| 723 | + /** |
|
| 724 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 725 | + * |
|
| 726 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 727 | + */ |
|
| 728 | + protected $context_cards_service; |
|
| 729 | + |
|
| 730 | + /** |
|
| 731 | + * {@link Wordlift}'s singleton instance. |
|
| 732 | + * |
|
| 733 | + * @since 3.11.2 |
|
| 734 | + * @access private |
|
| 735 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 736 | + */ |
|
| 737 | + private static $instance; |
|
| 738 | + |
|
| 739 | + //</editor-fold> |
|
| 740 | + |
|
| 741 | + /** |
|
| 742 | + * Define the core functionality of the plugin. |
|
| 743 | + * |
|
| 744 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 745 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 746 | + * the public-facing side of the site. |
|
| 747 | + * |
|
| 748 | + * @since 1.0.0 |
|
| 749 | + */ |
|
| 750 | + public function __construct() { |
|
| 751 | + |
|
| 752 | + self::$instance = $this; |
|
| 753 | + |
|
| 754 | + $this->plugin_name = 'wordlift'; |
|
| 755 | + $this->version = '3.28.1'; |
|
| 756 | + $this->load_dependencies(); |
|
| 757 | + $this->set_locale(); |
|
| 758 | + $this->define_admin_hooks(); |
|
| 759 | + $this->define_public_hooks(); |
|
| 760 | + |
|
| 761 | + // If we're in `WP_CLI` load the related files. |
|
| 762 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 763 | + $this->load_cli_dependencies(); |
|
| 764 | + } |
|
| 765 | + |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + /** |
|
| 769 | + * Get the singleton instance. |
|
| 770 | + * |
|
| 771 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 772 | + * @since 3.11.2 |
|
| 773 | + * |
|
| 774 | + */ |
|
| 775 | + public static function get_instance() { |
|
| 776 | + |
|
| 777 | + return self::$instance; |
|
| 778 | + } |
|
| 779 | + |
|
| 780 | + /** |
|
| 781 | + * Load the required dependencies for this plugin. |
|
| 782 | + * |
|
| 783 | + * Include the following files that make up the plugin: |
|
| 784 | + * |
|
| 785 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 786 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 787 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 788 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 789 | + * |
|
| 790 | + * Create an instance of the loader which will be used to register the hooks |
|
| 791 | + * with WordPress. |
|
| 792 | + * |
|
| 793 | + * @throws Exception |
|
| 794 | + * @since 1.0.0 |
|
| 795 | + * @access private |
|
| 796 | + */ |
|
| 797 | + private function load_dependencies() { |
|
| 798 | + |
|
| 799 | + /** |
|
| 800 | + * The class responsible for orchestrating the actions and filters of the |
|
| 801 | + * core plugin. |
|
| 802 | + */ |
|
| 803 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 804 | + |
|
| 805 | + // The class responsible for plugin uninstall. |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * The class responsible for defining internationalization functionality |
|
| 810 | + * of the plugin. |
|
| 811 | + */ |
|
| 812 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * WordLift's supported languages. |
|
| 816 | + */ |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 818 | + |
|
| 819 | + /** |
|
| 820 | + * WordLift's supported countries. |
|
| 821 | + */ |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * Provide support functions to sanitize data. |
|
| 826 | + */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 828 | + |
|
| 829 | + /** Services. */ |
|
| 830 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 831 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 834 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 835 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 836 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 839 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 840 | + |
|
| 841 | + /** |
|
| 842 | + * The Query builder. |
|
| 843 | + */ |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The Schema service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * The schema:url property service. |
|
| 853 | + */ |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 855 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * The UI service. |
|
| 859 | + */ |
|
| 860 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 861 | + |
|
| 862 | + /** |
|
| 863 | + * The Thumbnail service. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * The Entity Types Taxonomy service. |
|
| 869 | + */ |
|
| 870 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 871 | + |
|
| 872 | + /** |
|
| 873 | + * The Entity service. |
|
| 874 | + */ |
|
| 875 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 876 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 877 | + |
|
| 878 | + // Add the entity rating service. |
|
| 879 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 880 | + |
|
| 881 | + /** |
|
| 882 | + * The User service. |
|
| 883 | + */ |
|
| 884 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 885 | + |
|
| 886 | + /** |
|
| 887 | + * The Timeline service. |
|
| 888 | + */ |
|
| 889 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 890 | + |
|
| 891 | + /** |
|
| 892 | + * The Topic Taxonomy service. |
|
| 893 | + */ |
|
| 894 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 895 | + |
|
| 896 | + /** |
|
| 897 | + * The SPARQL service. |
|
| 898 | + */ |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 900 | + |
|
| 901 | + /** |
|
| 902 | + * The WordLift import service. |
|
| 903 | + */ |
|
| 904 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 905 | + |
|
| 906 | + /** |
|
| 907 | + * The WordLift URI service. |
|
| 908 | + */ |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 910 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 912 | + |
|
| 913 | + /** |
|
| 914 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 915 | + */ |
|
| 916 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 921 | + |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 923 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 924 | + |
|
| 925 | + /** |
|
| 926 | + * Load the converters. |
|
| 927 | + */ |
|
| 928 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 929 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 930 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 931 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 934 | + |
|
| 935 | + /** |
|
| 936 | + * Load cache-related files. |
|
| 937 | + */ |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 939 | + |
|
| 940 | + /** |
|
| 941 | + * Load the content filter. |
|
| 942 | + */ |
|
| 943 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 944 | + |
|
| 945 | + /* |
|
| 946 | 946 | * Load the excerpt helper. |
| 947 | 947 | */ |
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 949 | - |
|
| 950 | - /** |
|
| 951 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 952 | - * |
|
| 953 | - * @since 3.8.0 |
|
| 954 | - */ |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 956 | - |
|
| 957 | - // The Publisher Service and the AJAX adapter. |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 960 | - |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 962 | - |
|
| 963 | - /** |
|
| 964 | - * Load the WordLift key validation service. |
|
| 965 | - */ |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 967 | - |
|
| 968 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 970 | - |
|
| 971 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 973 | - |
|
| 974 | - /** Linked Data. */ |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 984 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 986 | - |
|
| 987 | - /** Linked Data Rendition. */ |
|
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 989 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 992 | - |
|
| 993 | - /** Services. */ |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 996 | - |
|
| 997 | - /** Adapters. */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1003 | - |
|
| 1004 | - /** Async Tasks. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1008 | - |
|
| 1009 | - /** Autocomplete. */ |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1011 | - |
|
| 1012 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1013 | - |
|
| 1014 | - /** Analytics */ |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1016 | - |
|
| 1017 | - /** |
|
| 1018 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1019 | - */ |
|
| 1020 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1021 | - |
|
| 1022 | - /** |
|
| 1023 | - * The class to customize the entity list admin page. |
|
| 1024 | - */ |
|
| 1025 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1026 | - |
|
| 1027 | - /** |
|
| 1028 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1029 | - */ |
|
| 1030 | - global $wp_version; |
|
| 1031 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1032 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1033 | - } else { |
|
| 1034 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1035 | - } |
|
| 1036 | - |
|
| 1037 | - /** |
|
| 1038 | - * The Notice service. |
|
| 1039 | - */ |
|
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1041 | - |
|
| 1042 | - /** |
|
| 1043 | - * The PrimaShop adapter. |
|
| 1044 | - */ |
|
| 1045 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1046 | - |
|
| 1047 | - /** |
|
| 1048 | - * The WordLift Dashboard service. |
|
| 1049 | - */ |
|
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1051 | - |
|
| 1052 | - /** |
|
| 1053 | - * The admin 'Install wizard' page. |
|
| 1054 | - */ |
|
| 1055 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1056 | - |
|
| 1057 | - /** |
|
| 1058 | - * The WordLift entity type list admin page controller. |
|
| 1059 | - */ |
|
| 1060 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1061 | - |
|
| 1062 | - /** |
|
| 1063 | - * The WordLift entity type settings admin page controller. |
|
| 1064 | - */ |
|
| 1065 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1066 | - |
|
| 1067 | - /** |
|
| 1068 | - * The admin 'Download Your Data' page. |
|
| 1069 | - */ |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1071 | - |
|
| 1072 | - /** |
|
| 1073 | - * The admin 'WordLift Settings' page. |
|
| 1074 | - */ |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1082 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1083 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1089 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1090 | - |
|
| 1091 | - /** Admin Pages */ |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1096 | - |
|
| 1097 | - /** |
|
| 1098 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1099 | - * side of the site. |
|
| 1100 | - */ |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1102 | - |
|
| 1103 | - /** |
|
| 1104 | - * The shortcode abstract class. |
|
| 1105 | - */ |
|
| 1106 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1107 | - |
|
| 1108 | - /** |
|
| 1109 | - * The Timeline shortcode. |
|
| 1110 | - */ |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1112 | - |
|
| 1113 | - /** |
|
| 1114 | - * The Navigator shortcode. |
|
| 1115 | - */ |
|
| 1116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1117 | - |
|
| 1118 | - /** |
|
| 1119 | - * The Products Navigator shortcode. |
|
| 1120 | - */ |
|
| 1121 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1122 | - |
|
| 1123 | - /** |
|
| 1124 | - * The chord shortcode. |
|
| 1125 | - */ |
|
| 1126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1127 | - |
|
| 1128 | - /** |
|
| 1129 | - * The geomap shortcode. |
|
| 1130 | - */ |
|
| 1131 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1132 | - |
|
| 1133 | - /** |
|
| 1134 | - * The entity cloud shortcode. |
|
| 1135 | - */ |
|
| 1136 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1137 | - |
|
| 1138 | - /** |
|
| 1139 | - * The entity glossary shortcode. |
|
| 1140 | - */ |
|
| 1141 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1143 | - |
|
| 1144 | - /** |
|
| 1145 | - * Faceted Search shortcode. |
|
| 1146 | - */ |
|
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1148 | - |
|
| 1149 | - /** |
|
| 1150 | - * The ShareThis service. |
|
| 1151 | - */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1153 | - |
|
| 1154 | - /** |
|
| 1155 | - * The SEO service. |
|
| 1156 | - */ |
|
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1158 | - |
|
| 1159 | - /** |
|
| 1160 | - * The AMP service. |
|
| 1161 | - */ |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1163 | - |
|
| 1164 | - /** Widgets */ |
|
| 1165 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1166 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1167 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1168 | - |
|
| 1169 | - /* |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 949 | + |
|
| 950 | + /** |
|
| 951 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 952 | + * |
|
| 953 | + * @since 3.8.0 |
|
| 954 | + */ |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 956 | + |
|
| 957 | + // The Publisher Service and the AJAX adapter. |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 959 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 960 | + |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 962 | + |
|
| 963 | + /** |
|
| 964 | + * Load the WordLift key validation service. |
|
| 965 | + */ |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 967 | + |
|
| 968 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 970 | + |
|
| 971 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 973 | + |
|
| 974 | + /** Linked Data. */ |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 977 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 978 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 983 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 984 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 986 | + |
|
| 987 | + /** Linked Data Rendition. */ |
|
| 988 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 989 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 992 | + |
|
| 993 | + /** Services. */ |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 996 | + |
|
| 997 | + /** Adapters. */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1003 | + |
|
| 1004 | + /** Async Tasks. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1007 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1008 | + |
|
| 1009 | + /** Autocomplete. */ |
|
| 1010 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1011 | + |
|
| 1012 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1013 | + |
|
| 1014 | + /** Analytics */ |
|
| 1015 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1016 | + |
|
| 1017 | + /** |
|
| 1018 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1019 | + */ |
|
| 1020 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1021 | + |
|
| 1022 | + /** |
|
| 1023 | + * The class to customize the entity list admin page. |
|
| 1024 | + */ |
|
| 1025 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1026 | + |
|
| 1027 | + /** |
|
| 1028 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1029 | + */ |
|
| 1030 | + global $wp_version; |
|
| 1031 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1032 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1033 | + } else { |
|
| 1034 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1035 | + } |
|
| 1036 | + |
|
| 1037 | + /** |
|
| 1038 | + * The Notice service. |
|
| 1039 | + */ |
|
| 1040 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1041 | + |
|
| 1042 | + /** |
|
| 1043 | + * The PrimaShop adapter. |
|
| 1044 | + */ |
|
| 1045 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1046 | + |
|
| 1047 | + /** |
|
| 1048 | + * The WordLift Dashboard service. |
|
| 1049 | + */ |
|
| 1050 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1051 | + |
|
| 1052 | + /** |
|
| 1053 | + * The admin 'Install wizard' page. |
|
| 1054 | + */ |
|
| 1055 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1056 | + |
|
| 1057 | + /** |
|
| 1058 | + * The WordLift entity type list admin page controller. |
|
| 1059 | + */ |
|
| 1060 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1061 | + |
|
| 1062 | + /** |
|
| 1063 | + * The WordLift entity type settings admin page controller. |
|
| 1064 | + */ |
|
| 1065 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1066 | + |
|
| 1067 | + /** |
|
| 1068 | + * The admin 'Download Your Data' page. |
|
| 1069 | + */ |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1071 | + |
|
| 1072 | + /** |
|
| 1073 | + * The admin 'WordLift Settings' page. |
|
| 1074 | + */ |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1082 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1083 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1088 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1089 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1090 | + |
|
| 1091 | + /** Admin Pages */ |
|
| 1092 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1095 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1096 | + |
|
| 1097 | + /** |
|
| 1098 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1099 | + * side of the site. |
|
| 1100 | + */ |
|
| 1101 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1102 | + |
|
| 1103 | + /** |
|
| 1104 | + * The shortcode abstract class. |
|
| 1105 | + */ |
|
| 1106 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1107 | + |
|
| 1108 | + /** |
|
| 1109 | + * The Timeline shortcode. |
|
| 1110 | + */ |
|
| 1111 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1112 | + |
|
| 1113 | + /** |
|
| 1114 | + * The Navigator shortcode. |
|
| 1115 | + */ |
|
| 1116 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1117 | + |
|
| 1118 | + /** |
|
| 1119 | + * The Products Navigator shortcode. |
|
| 1120 | + */ |
|
| 1121 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1122 | + |
|
| 1123 | + /** |
|
| 1124 | + * The chord shortcode. |
|
| 1125 | + */ |
|
| 1126 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * The geomap shortcode. |
|
| 1130 | + */ |
|
| 1131 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1132 | + |
|
| 1133 | + /** |
|
| 1134 | + * The entity cloud shortcode. |
|
| 1135 | + */ |
|
| 1136 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1137 | + |
|
| 1138 | + /** |
|
| 1139 | + * The entity glossary shortcode. |
|
| 1140 | + */ |
|
| 1141 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1142 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1143 | + |
|
| 1144 | + /** |
|
| 1145 | + * Faceted Search shortcode. |
|
| 1146 | + */ |
|
| 1147 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1148 | + |
|
| 1149 | + /** |
|
| 1150 | + * The ShareThis service. |
|
| 1151 | + */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1153 | + |
|
| 1154 | + /** |
|
| 1155 | + * The SEO service. |
|
| 1156 | + */ |
|
| 1157 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1158 | + |
|
| 1159 | + /** |
|
| 1160 | + * The AMP service. |
|
| 1161 | + */ |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1163 | + |
|
| 1164 | + /** Widgets */ |
|
| 1165 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1166 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1167 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1168 | + |
|
| 1169 | + /* |
|
| 1170 | 1170 | * Schema.org Services. |
| 1171 | 1171 | * |
| 1172 | 1172 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1173 | 1173 | */ |
| 1174 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1175 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1176 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1177 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1178 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1179 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1180 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1181 | - } else { |
|
| 1182 | - $schemaorg_property_service = null; |
|
| 1183 | - } |
|
| 1174 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1175 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1176 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1177 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1178 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1179 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1180 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1181 | + } else { |
|
| 1182 | + $schemaorg_property_service = null; |
|
| 1183 | + } |
|
| 1184 | 1184 | |
| 1185 | - $this->loader = new Wordlift_Loader(); |
|
| 1185 | + $this->loader = new Wordlift_Loader(); |
|
| 1186 | 1186 | |
| 1187 | - // Instantiate a global logger. |
|
| 1188 | - global $wl_logger; |
|
| 1189 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1187 | + // Instantiate a global logger. |
|
| 1188 | + global $wl_logger; |
|
| 1189 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1190 | 1190 | |
| 1191 | - // Load the `wl-api` end-point. |
|
| 1192 | - new Wordlift_Http_Api(); |
|
| 1191 | + // Load the `wl-api` end-point. |
|
| 1192 | + new Wordlift_Http_Api(); |
|
| 1193 | 1193 | |
| 1194 | - // Load the Install Service. |
|
| 1195 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1196 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1194 | + // Load the Install Service. |
|
| 1195 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1196 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1197 | 1197 | |
| 1198 | - /** Services. */ |
|
| 1199 | - // Create the configuration service. |
|
| 1200 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1201 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1198 | + /** Services. */ |
|
| 1199 | + // Create the configuration service. |
|
| 1200 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1201 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1202 | 1202 | |
| 1203 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1204 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1203 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1204 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1205 | 1205 | |
| 1206 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1207 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1206 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1207 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1208 | 1208 | |
| 1209 | - // Create an instance of the UI service. |
|
| 1210 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1209 | + // Create an instance of the UI service. |
|
| 1210 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1211 | 1211 | |
| 1212 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1213 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1212 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1213 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1214 | 1214 | |
| 1215 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1216 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1217 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1218 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1215 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1216 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1217 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1218 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1219 | 1219 | |
| 1220 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1221 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1222 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1223 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1220 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1221 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1222 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1223 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1224 | 1224 | |
| 1225 | - // Instantiate the JSON-LD service. |
|
| 1226 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1225 | + // Instantiate the JSON-LD service. |
|
| 1226 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1227 | 1227 | |
| 1228 | - /** Linked Data. */ |
|
| 1229 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1230 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1228 | + /** Linked Data. */ |
|
| 1229 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1230 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1231 | 1231 | |
| 1232 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1232 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1233 | 1233 | |
| 1234 | - // Create a new instance of the Redirect service. |
|
| 1235 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1236 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1234 | + // Create a new instance of the Redirect service. |
|
| 1235 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1236 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1237 | 1237 | |
| 1238 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1239 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1238 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1239 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1240 | 1240 | |
| 1241 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1241 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1242 | 1242 | |
| 1243 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1244 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1243 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1244 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1245 | 1245 | |
| 1246 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1247 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1246 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1247 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1248 | 1248 | |
| 1249 | - // Create an instance of the PrimaShop adapter. |
|
| 1250 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1249 | + // Create an instance of the PrimaShop adapter. |
|
| 1250 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1251 | 1251 | |
| 1252 | - // Create an import service instance to hook later to WP's import function. |
|
| 1253 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1252 | + // Create an import service instance to hook later to WP's import function. |
|
| 1253 | + $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1254 | 1254 | |
| 1255 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1255 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1256 | 1256 | |
| 1257 | - // Create the entity rating service. |
|
| 1258 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1257 | + // Create the entity rating service. |
|
| 1258 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1259 | 1259 | |
| 1260 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1261 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1260 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1261 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1262 | 1262 | |
| 1263 | - // Create a new instance of the Redirect service. |
|
| 1264 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1263 | + // Create a new instance of the Redirect service. |
|
| 1264 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1265 | 1265 | |
| 1266 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1267 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1268 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1269 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1266 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1267 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1268 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1269 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1270 | 1270 | |
| 1271 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1271 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1272 | 1272 | |
| 1273 | - // Instantiate the JSON-LD service. |
|
| 1274 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1275 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1276 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter ); |
|
| 1277 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1278 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1273 | + // Instantiate the JSON-LD service. |
|
| 1274 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1275 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1276 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter ); |
|
| 1277 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1278 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1279 | 1279 | |
| 1280 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1281 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1282 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1280 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1281 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1282 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1283 | 1283 | |
| 1284 | - /* |
|
| 1284 | + /* |
|
| 1285 | 1285 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1286 | 1286 | * |
| 1287 | 1287 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1288 | 1288 | * |
| 1289 | 1289 | * @since 3.20.0 |
| 1290 | 1290 | */ |
| 1291 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1292 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1293 | - $jsonld_service = new Jsonld_Service( |
|
| 1294 | - $this->jsonld_service, |
|
| 1295 | - $term_jsonld_adapter, |
|
| 1296 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1297 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1298 | - |
|
| 1299 | - // Prints the JSON-LD in the head. |
|
| 1300 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1301 | - |
|
| 1302 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1303 | - |
|
| 1304 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1305 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1306 | - // Creating Faq Content filter service. |
|
| 1307 | - $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1308 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1309 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1310 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1311 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1312 | - |
|
| 1313 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1314 | - |
|
| 1315 | - /** |
|
| 1316 | - * Filter: wl_feature__enable__blocks. |
|
| 1317 | - * |
|
| 1318 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1319 | - * |
|
| 1320 | - * @return bool |
|
| 1321 | - * @since 3.27.6 |
|
| 1322 | - */ |
|
| 1323 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1324 | - // Initialize the short-codes. |
|
| 1325 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1326 | - new Wordlift_Chord_Shortcode(); |
|
| 1327 | - new Wordlift_Geomap_Shortcode(); |
|
| 1328 | - new Wordlift_Timeline_Shortcode(); |
|
| 1329 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1330 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1331 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1332 | - } |
|
| 1333 | - |
|
| 1334 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1335 | - |
|
| 1336 | - |
|
| 1337 | - // Initialize the Context Cards Service |
|
| 1338 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1339 | - |
|
| 1340 | - // Initialize the SEO service. |
|
| 1341 | - new Wordlift_Seo_Service(); |
|
| 1342 | - |
|
| 1343 | - // Initialize the AMP service. |
|
| 1344 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1345 | - |
|
| 1346 | - /** Services. */ |
|
| 1347 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1348 | - new Wordlift_Image_Service(); |
|
| 1349 | - |
|
| 1350 | - /** Adapters. */ |
|
| 1351 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1352 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1353 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1354 | - //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1355 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1356 | - |
|
| 1357 | - /* |
|
| 1291 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1292 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1293 | + $jsonld_service = new Jsonld_Service( |
|
| 1294 | + $this->jsonld_service, |
|
| 1295 | + $term_jsonld_adapter, |
|
| 1296 | + new Jsonld_User_Service( $this->user_service ) ); |
|
| 1297 | + new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1298 | + |
|
| 1299 | + // Prints the JSON-LD in the head. |
|
| 1300 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1301 | + |
|
| 1302 | + new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1303 | + |
|
| 1304 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1305 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1306 | + // Creating Faq Content filter service. |
|
| 1307 | + $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1308 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1309 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1310 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1311 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1312 | + |
|
| 1313 | + $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1314 | + |
|
| 1315 | + /** |
|
| 1316 | + * Filter: wl_feature__enable__blocks. |
|
| 1317 | + * |
|
| 1318 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1319 | + * |
|
| 1320 | + * @return bool |
|
| 1321 | + * @since 3.27.6 |
|
| 1322 | + */ |
|
| 1323 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1324 | + // Initialize the short-codes. |
|
| 1325 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1326 | + new Wordlift_Chord_Shortcode(); |
|
| 1327 | + new Wordlift_Geomap_Shortcode(); |
|
| 1328 | + new Wordlift_Timeline_Shortcode(); |
|
| 1329 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1330 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1331 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1332 | + } |
|
| 1333 | + |
|
| 1334 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1335 | + |
|
| 1336 | + |
|
| 1337 | + // Initialize the Context Cards Service |
|
| 1338 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1339 | + |
|
| 1340 | + // Initialize the SEO service. |
|
| 1341 | + new Wordlift_Seo_Service(); |
|
| 1342 | + |
|
| 1343 | + // Initialize the AMP service. |
|
| 1344 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1345 | + |
|
| 1346 | + /** Services. */ |
|
| 1347 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1348 | + new Wordlift_Image_Service(); |
|
| 1349 | + |
|
| 1350 | + /** Adapters. */ |
|
| 1351 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1352 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1353 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1354 | + //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1355 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1356 | + |
|
| 1357 | + /* |
|
| 1358 | 1358 | * Exclude our public js from WP-Rocket. |
| 1359 | 1359 | * |
| 1360 | 1360 | * @since 3.19.4 |
| 1361 | 1361 | * |
| 1362 | 1362 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1363 | 1363 | */ |
| 1364 | - new Wordlift_WpRocket_Adapter(); |
|
| 1365 | - |
|
| 1366 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1367 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1368 | - $this->sparql_service, |
|
| 1369 | - $uri_service |
|
| 1370 | - ); |
|
| 1371 | - |
|
| 1372 | - $that = $this; |
|
| 1373 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1374 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1376 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1377 | - new Wordlift_Push_References_Async_Task(); |
|
| 1378 | - } |
|
| 1379 | - } ); |
|
| 1380 | - |
|
| 1381 | - /** WordPress Admin UI. */ |
|
| 1382 | - |
|
| 1383 | - // UI elements. |
|
| 1384 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1385 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1386 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1387 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1388 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1389 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1390 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1391 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1392 | - |
|
| 1393 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1394 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1395 | - |
|
| 1396 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1397 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1398 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1399 | - |
|
| 1400 | - // Pages. |
|
| 1401 | - /* |
|
| 1364 | + new Wordlift_WpRocket_Adapter(); |
|
| 1365 | + |
|
| 1366 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1367 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1368 | + $this->sparql_service, |
|
| 1369 | + $uri_service |
|
| 1370 | + ); |
|
| 1371 | + |
|
| 1372 | + $that = $this; |
|
| 1373 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1374 | + if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1375 | + new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1376 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1377 | + new Wordlift_Push_References_Async_Task(); |
|
| 1378 | + } |
|
| 1379 | + } ); |
|
| 1380 | + |
|
| 1381 | + /** WordPress Admin UI. */ |
|
| 1382 | + |
|
| 1383 | + // UI elements. |
|
| 1384 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1385 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1386 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1387 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1388 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1389 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1390 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1391 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1392 | + |
|
| 1393 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1394 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1395 | + |
|
| 1396 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1397 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1398 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1399 | + |
|
| 1400 | + // Pages. |
|
| 1401 | + /* |
|
| 1402 | 1402 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1403 | 1403 | * |
| 1404 | 1404 | * @since 3.20.3 |
| 1405 | 1405 | * |
| 1406 | 1406 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1407 | 1407 | */ |
| 1408 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1410 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1411 | - } |
|
| 1412 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1408 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1409 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1410 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1411 | + } |
|
| 1412 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1413 | 1413 | |
| 1414 | - // create an instance of the entity type list admin page controller. |
|
| 1415 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1414 | + // create an instance of the entity type list admin page controller. |
|
| 1415 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1416 | 1416 | |
| 1417 | - // create an instance of the entity type setting admin page controller. |
|
| 1418 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1417 | + // create an instance of the entity type setting admin page controller. |
|
| 1418 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1419 | 1419 | |
| 1420 | - /** Widgets */ |
|
| 1421 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1420 | + /** Widgets */ |
|
| 1421 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1422 | 1422 | |
| 1423 | - /* WordPress Admin. */ |
|
| 1424 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1425 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1423 | + /* WordPress Admin. */ |
|
| 1424 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1425 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1426 | 1426 | |
| 1427 | - // Create an instance of the install wizard. |
|
| 1428 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1427 | + // Create an instance of the install wizard. |
|
| 1428 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1429 | 1429 | |
| 1430 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1430 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1431 | 1431 | |
| 1432 | - // User Profile. |
|
| 1433 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1432 | + // User Profile. |
|
| 1433 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1434 | 1434 | |
| 1435 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1435 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1436 | 1436 | |
| 1437 | - // Load the debug service if WP is in debug mode. |
|
| 1438 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1439 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1440 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1441 | - } |
|
| 1437 | + // Load the debug service if WP is in debug mode. |
|
| 1438 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1439 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1440 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1441 | + } |
|
| 1442 | 1442 | |
| 1443 | - // Remote Image Service. |
|
| 1444 | - new Wordlift_Remote_Image_Service(); |
|
| 1443 | + // Remote Image Service. |
|
| 1444 | + new Wordlift_Remote_Image_Service(); |
|
| 1445 | 1445 | |
| 1446 | - /* |
|
| 1446 | + /* |
|
| 1447 | 1447 | * Provides mappings between post types and entity types. |
| 1448 | 1448 | * |
| 1449 | 1449 | * @since 3.20.0 |
| 1450 | 1450 | * |
| 1451 | 1451 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1452 | 1452 | */ |
| 1453 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1454 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1455 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1453 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1454 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1455 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1456 | 1456 | |
| 1457 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1458 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1457 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1458 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1459 | 1459 | |
| 1460 | - /* |
|
| 1460 | + /* |
|
| 1461 | 1461 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1462 | 1462 | * |
| 1463 | 1463 | * Eventually Batch Actions will become Batch Operations. |
| 1464 | 1464 | * |
| 1465 | 1465 | * @since 3.20.0 |
| 1466 | 1466 | */ |
| 1467 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1468 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1467 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1468 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1469 | 1469 | |
| 1470 | - /* |
|
| 1470 | + /* |
|
| 1471 | 1471 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1472 | 1472 | * |
| 1473 | 1473 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1474 | 1474 | * |
| 1475 | 1475 | * @since 3.20.0 |
| 1476 | 1476 | */ |
| 1477 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1478 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1477 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1478 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1479 | 1479 | |
| 1480 | - /* |
|
| 1480 | + /* |
|
| 1481 | 1481 | * Load the Mappings JSON-LD post processing. |
| 1482 | 1482 | * |
| 1483 | 1483 | * @since 3.25.0 |
| 1484 | 1484 | */ |
| 1485 | 1485 | |
| 1486 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1487 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1488 | - new Post_Type_Rule_Validator(); |
|
| 1489 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1490 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1486 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1487 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1488 | + new Post_Type_Rule_Validator(); |
|
| 1489 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1490 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1491 | 1491 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1492 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1493 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1494 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1495 | - |
|
| 1496 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1497 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1498 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1499 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1500 | - |
|
| 1501 | - /** |
|
| 1502 | - * @since 3.27.1 |
|
| 1503 | - * Intiailize the acf group data formatter. |
|
| 1504 | - */ |
|
| 1505 | - new Acf_Group_Formatter(); |
|
| 1506 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1507 | - |
|
| 1508 | - /** |
|
| 1509 | - * @since 3.26.0 |
|
| 1510 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1511 | - */ |
|
| 1512 | - // new Faq_To_Jsonld_Converter(); |
|
| 1513 | - /* |
|
| 1492 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1493 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1494 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1495 | + |
|
| 1496 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1497 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1498 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1499 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1500 | + |
|
| 1501 | + /** |
|
| 1502 | + * @since 3.27.1 |
|
| 1503 | + * Intiailize the acf group data formatter. |
|
| 1504 | + */ |
|
| 1505 | + new Acf_Group_Formatter(); |
|
| 1506 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1507 | + |
|
| 1508 | + /** |
|
| 1509 | + * @since 3.26.0 |
|
| 1510 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1511 | + */ |
|
| 1512 | + // new Faq_To_Jsonld_Converter(); |
|
| 1513 | + /* |
|
| 1514 | 1514 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1515 | 1515 | * end-point. |
| 1516 | 1516 | * |
| 1517 | 1517 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1518 | 1518 | * @since 3.24.4 |
| 1519 | 1519 | */ |
| 1520 | - new Templates_Ajax_Endpoint(); |
|
| 1521 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1522 | - //Faq_Rest_Controller::register_routes(); |
|
| 1520 | + new Templates_Ajax_Endpoint(); |
|
| 1521 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1522 | + //Faq_Rest_Controller::register_routes(); |
|
| 1523 | 1523 | |
| 1524 | - /* |
|
| 1524 | + /* |
|
| 1525 | 1525 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1526 | 1526 | */ |
| 1527 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1528 | - new Analysis_Response_Ops_Factory( |
|
| 1529 | - $this->entity_uri_service, |
|
| 1530 | - $this->entity_service, |
|
| 1531 | - $this->entity_type_service, |
|
| 1532 | - $this->storage_factory->post_images(), |
|
| 1533 | - $entity_helper |
|
| 1534 | - ); |
|
| 1535 | - |
|
| 1536 | - /** WL Autocomplete. */ |
|
| 1537 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1538 | - new Local_Autocomplete_Service(), |
|
| 1539 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1540 | - ) ); |
|
| 1541 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1542 | - |
|
| 1543 | - /** |
|
| 1544 | - * @since 3.27.2 |
|
| 1545 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1546 | - * as default entity type to the wprm_recipe CPT. |
|
| 1547 | - */ |
|
| 1548 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1549 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1550 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1551 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1552 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1553 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1554 | - |
|
| 1555 | - /** |
|
| 1556 | - * @since 3.27.4 |
|
| 1557 | - * Add the faq duplicate markup hook. |
|
| 1558 | - */ |
|
| 1559 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1560 | - /** |
|
| 1561 | - * @since 3.27.8 |
|
| 1562 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1563 | - */ |
|
| 1564 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1565 | - } |
|
| 1566 | - |
|
| 1567 | - /** |
|
| 1568 | - * Define the locale for this plugin for internationalization. |
|
| 1569 | - * |
|
| 1570 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1571 | - * with WordPress. |
|
| 1572 | - * |
|
| 1573 | - * @since 1.0.0 |
|
| 1574 | - * @access private |
|
| 1575 | - */ |
|
| 1576 | - private function set_locale() { |
|
| 1577 | - |
|
| 1578 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1579 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1580 | - |
|
| 1581 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1582 | - |
|
| 1583 | - } |
|
| 1584 | - |
|
| 1585 | - /** |
|
| 1586 | - * Register all of the hooks related to the admin area functionality |
|
| 1587 | - * of the plugin. |
|
| 1588 | - * |
|
| 1589 | - * @since 1.0.0 |
|
| 1590 | - * @access private |
|
| 1591 | - */ |
|
| 1592 | - private function define_admin_hooks() { |
|
| 1593 | - |
|
| 1594 | - $plugin_admin = new Wordlift_Admin( |
|
| 1595 | - $this->get_plugin_name(), |
|
| 1596 | - $this->get_version(), |
|
| 1597 | - $this->configuration_service, |
|
| 1598 | - $this->notice_service, |
|
| 1599 | - $this->user_service |
|
| 1600 | - ); |
|
| 1601 | - |
|
| 1602 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1604 | - |
|
| 1605 | - // Hook the init action to taxonomy services. |
|
| 1606 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1608 | - |
|
| 1609 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1610 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1611 | - |
|
| 1612 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1613 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1614 | - |
|
| 1615 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1616 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1617 | - |
|
| 1618 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1619 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1620 | - |
|
| 1621 | - // Register custom allowed redirect hosts. |
|
| 1622 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1623 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1624 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1625 | - |
|
| 1626 | - /* |
|
| 1527 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1528 | + new Analysis_Response_Ops_Factory( |
|
| 1529 | + $this->entity_uri_service, |
|
| 1530 | + $this->entity_service, |
|
| 1531 | + $this->entity_type_service, |
|
| 1532 | + $this->storage_factory->post_images(), |
|
| 1533 | + $entity_helper |
|
| 1534 | + ); |
|
| 1535 | + |
|
| 1536 | + /** WL Autocomplete. */ |
|
| 1537 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1538 | + new Local_Autocomplete_Service(), |
|
| 1539 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1540 | + ) ); |
|
| 1541 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1542 | + |
|
| 1543 | + /** |
|
| 1544 | + * @since 3.27.2 |
|
| 1545 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1546 | + * as default entity type to the wprm_recipe CPT. |
|
| 1547 | + */ |
|
| 1548 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1549 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1550 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1551 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1552 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1553 | + new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1554 | + |
|
| 1555 | + /** |
|
| 1556 | + * @since 3.27.4 |
|
| 1557 | + * Add the faq duplicate markup hook. |
|
| 1558 | + */ |
|
| 1559 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1560 | + /** |
|
| 1561 | + * @since 3.27.8 |
|
| 1562 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1563 | + */ |
|
| 1564 | + new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1565 | + } |
|
| 1566 | + |
|
| 1567 | + /** |
|
| 1568 | + * Define the locale for this plugin for internationalization. |
|
| 1569 | + * |
|
| 1570 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1571 | + * with WordPress. |
|
| 1572 | + * |
|
| 1573 | + * @since 1.0.0 |
|
| 1574 | + * @access private |
|
| 1575 | + */ |
|
| 1576 | + private function set_locale() { |
|
| 1577 | + |
|
| 1578 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1579 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1580 | + |
|
| 1581 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1582 | + |
|
| 1583 | + } |
|
| 1584 | + |
|
| 1585 | + /** |
|
| 1586 | + * Register all of the hooks related to the admin area functionality |
|
| 1587 | + * of the plugin. |
|
| 1588 | + * |
|
| 1589 | + * @since 1.0.0 |
|
| 1590 | + * @access private |
|
| 1591 | + */ |
|
| 1592 | + private function define_admin_hooks() { |
|
| 1593 | + |
|
| 1594 | + $plugin_admin = new Wordlift_Admin( |
|
| 1595 | + $this->get_plugin_name(), |
|
| 1596 | + $this->get_version(), |
|
| 1597 | + $this->configuration_service, |
|
| 1598 | + $this->notice_service, |
|
| 1599 | + $this->user_service |
|
| 1600 | + ); |
|
| 1601 | + |
|
| 1602 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1603 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1604 | + |
|
| 1605 | + // Hook the init action to taxonomy services. |
|
| 1606 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1607 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1608 | + |
|
| 1609 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1610 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1611 | + |
|
| 1612 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1613 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1614 | + |
|
| 1615 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1616 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1617 | + |
|
| 1618 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1619 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1620 | + |
|
| 1621 | + // Register custom allowed redirect hosts. |
|
| 1622 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1623 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1624 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1625 | + |
|
| 1626 | + /* |
|
| 1627 | 1627 | * The old dashboard is replaced with dashboard v2. |
| 1628 | 1628 | * |
| 1629 | 1629 | * The old dashboard service is still loaded because its functions are used. |
@@ -1632,389 +1632,389 @@ discard block |
||
| 1632 | 1632 | * |
| 1633 | 1633 | * @since 3.20.0 |
| 1634 | 1634 | */ |
| 1635 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1636 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1637 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1638 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1639 | - |
|
| 1640 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1641 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1642 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1644 | - |
|
| 1645 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1647 | - |
|
| 1648 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1649 | - // Add custom columns. |
|
| 1650 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1651 | - // no explicit entity as it prevents handling of other post types. |
|
| 1652 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1653 | - // Add 4W selection. |
|
| 1654 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1658 | - |
|
| 1659 | - /* |
|
| 1635 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1636 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1637 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1638 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1639 | + |
|
| 1640 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1641 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1642 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1643 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1644 | + |
|
| 1645 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1646 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1647 | + |
|
| 1648 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1649 | + // Add custom columns. |
|
| 1650 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1651 | + // no explicit entity as it prevents handling of other post types. |
|
| 1652 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1653 | + // Add 4W selection. |
|
| 1654 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1655 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1656 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1657 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1658 | + |
|
| 1659 | + /* |
|
| 1660 | 1660 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1661 | 1661 | * |
| 1662 | 1662 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1663 | 1663 | */ |
| 1664 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1666 | - } |
|
| 1667 | - |
|
| 1668 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1669 | - // entities. |
|
| 1670 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1671 | - |
|
| 1672 | - // Filter imported post meta. |
|
| 1673 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1674 | - |
|
| 1675 | - // Notify the import service when an import starts and ends. |
|
| 1676 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1678 | - |
|
| 1679 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1680 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1682 | - |
|
| 1683 | - /** |
|
| 1684 | - * Filter: wl_feature__enable__screens. |
|
| 1685 | - * |
|
| 1686 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1687 | - * |
|
| 1688 | - * @return bool |
|
| 1689 | - * @since 3.27.6 |
|
| 1690 | - */ |
|
| 1691 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1692 | - // Hook the menu to the Download Your Data page. |
|
| 1693 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1696 | - } |
|
| 1697 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1698 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1699 | - |
|
| 1700 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1701 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | - |
|
| 1705 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1706 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1707 | - |
|
| 1708 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1709 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1710 | - |
|
| 1711 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1712 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1713 | - |
|
| 1714 | - // Hook the admin_init to the settings page. |
|
| 1715 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1717 | - |
|
| 1718 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1719 | - |
|
| 1720 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1721 | - /** |
|
| 1722 | - * Filter: wl_feature__enable__screens. |
|
| 1723 | - * |
|
| 1724 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1725 | - * |
|
| 1726 | - * @return bool |
|
| 1727 | - * @since 3.27.6 |
|
| 1728 | - */ |
|
| 1729 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1731 | - } |
|
| 1732 | - /* |
|
| 1664 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1665 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1666 | + } |
|
| 1667 | + |
|
| 1668 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1669 | + // entities. |
|
| 1670 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1671 | + |
|
| 1672 | + // Filter imported post meta. |
|
| 1673 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1674 | + |
|
| 1675 | + // Notify the import service when an import starts and ends. |
|
| 1676 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1677 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1678 | + |
|
| 1679 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1680 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1681 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1682 | + |
|
| 1683 | + /** |
|
| 1684 | + * Filter: wl_feature__enable__screens. |
|
| 1685 | + * |
|
| 1686 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1687 | + * |
|
| 1688 | + * @return bool |
|
| 1689 | + * @since 3.27.6 |
|
| 1690 | + */ |
|
| 1691 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1692 | + // Hook the menu to the Download Your Data page. |
|
| 1693 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1694 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1695 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1696 | + } |
|
| 1697 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1698 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1699 | + |
|
| 1700 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1701 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1702 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | + |
|
| 1705 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1706 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1707 | + |
|
| 1708 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1709 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1710 | + |
|
| 1711 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1712 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1713 | + |
|
| 1714 | + // Hook the admin_init to the settings page. |
|
| 1715 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1716 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1717 | + |
|
| 1718 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1719 | + |
|
| 1720 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1721 | + /** |
|
| 1722 | + * Filter: wl_feature__enable__screens. |
|
| 1723 | + * |
|
| 1724 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1725 | + * |
|
| 1726 | + * @return bool |
|
| 1727 | + * @since 3.27.6 |
|
| 1728 | + */ |
|
| 1729 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1730 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1731 | + } |
|
| 1732 | + /* |
|
| 1733 | 1733 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1734 | 1734 | * |
| 1735 | 1735 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1736 | 1736 | * |
| 1737 | 1737 | * @since 3.20.0 |
| 1738 | 1738 | */ |
| 1739 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1740 | - /** |
|
| 1741 | - * Filter: wl_feature__enable__screens. |
|
| 1742 | - * |
|
| 1743 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1744 | - * |
|
| 1745 | - * @return bool |
|
| 1746 | - * @since 3.27.6 |
|
| 1747 | - */ |
|
| 1748 | - if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1749 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1750 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - // Hook key update. |
|
| 1755 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1757 | - |
|
| 1758 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1759 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | - |
|
| 1761 | - /* |
|
| 1739 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1740 | + /** |
|
| 1741 | + * Filter: wl_feature__enable__screens. |
|
| 1742 | + * |
|
| 1743 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1744 | + * |
|
| 1745 | + * @return bool |
|
| 1746 | + * @since 3.27.6 |
|
| 1747 | + */ |
|
| 1748 | + if ( apply_filters( 'wl_feature__enable__screens', true ) ) { |
|
| 1749 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1750 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + // Hook key update. |
|
| 1755 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1756 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1757 | + |
|
| 1758 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1759 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1760 | + |
|
| 1761 | + /* |
|
| 1762 | 1762 | * Remove the Analytics Settings link from the plugin page. |
| 1763 | 1763 | * |
| 1764 | 1764 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1765 | 1765 | * @since 3.21.1 |
| 1766 | 1766 | */ |
| 1767 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1768 | - |
|
| 1769 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1770 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1771 | - |
|
| 1772 | - // Hook row actions for the entity type list admin. |
|
| 1773 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1774 | - |
|
| 1775 | - /** Ajax actions. */ |
|
| 1776 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1777 | - |
|
| 1778 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1779 | - // page on WordPress versions before 4.7. |
|
| 1780 | - global $wp_version; |
|
| 1781 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1783 | - } |
|
| 1784 | - |
|
| 1785 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1786 | - |
|
| 1787 | - /** Adapters. */ |
|
| 1788 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1789 | - /** |
|
| 1790 | - * Disabling Faq temporarily. |
|
| 1791 | - * Load the tinymce editor button on the tool bar. |
|
| 1792 | - * @since 3.26.0 |
|
| 1793 | - */ |
|
| 1794 | - //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1795 | - //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1796 | - //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1797 | - |
|
| 1798 | - |
|
| 1799 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1802 | - /** |
|
| 1803 | - * @since 3.26.0 |
|
| 1804 | - */ |
|
| 1805 | - if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1806 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1807 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1808 | - // Adding Rest route for the post excerpt |
|
| 1809 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1810 | - } |
|
| 1811 | - |
|
| 1812 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1813 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1814 | - |
|
| 1815 | - // Handle the autocomplete request. |
|
| 1816 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1817 | - $this->autocomplete_adapter, |
|
| 1818 | - 'wl_autocomplete', |
|
| 1819 | - ) ); |
|
| 1820 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1821 | - $this->autocomplete_adapter, |
|
| 1822 | - 'wl_autocomplete', |
|
| 1823 | - ) ); |
|
| 1824 | - |
|
| 1825 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1826 | - if ( is_multisite() ) { |
|
| 1827 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1828 | - } |
|
| 1829 | - |
|
| 1830 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1831 | - |
|
| 1832 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1833 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1834 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1835 | - |
|
| 1836 | - /** |
|
| 1837 | - * Always allow the `wordlift/classification` block. |
|
| 1838 | - * |
|
| 1839 | - * @since 3.23.0 |
|
| 1840 | - */ |
|
| 1841 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1842 | - |
|
| 1843 | - if ( true === $value ) { |
|
| 1844 | - return $value; |
|
| 1845 | - } |
|
| 1846 | - |
|
| 1847 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1848 | - }, PHP_INT_MAX ); |
|
| 1849 | - |
|
| 1850 | - /** |
|
| 1851 | - * @since 3.27.7 |
|
| 1852 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1853 | - */ |
|
| 1854 | - new Top_Entities(); |
|
| 1855 | - } |
|
| 1856 | - |
|
| 1857 | - /** |
|
| 1858 | - * Register all of the hooks related to the public-facing functionality |
|
| 1859 | - * of the plugin. |
|
| 1860 | - * |
|
| 1861 | - * @since 1.0.0 |
|
| 1862 | - * @access private |
|
| 1863 | - */ |
|
| 1864 | - private function define_public_hooks() { |
|
| 1865 | - |
|
| 1866 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1867 | - |
|
| 1868 | - // Register the entity post type. |
|
| 1869 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1870 | - |
|
| 1871 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1872 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1873 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1874 | - // $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1875 | - // $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1876 | - |
|
| 1877 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1878 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1879 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1880 | - |
|
| 1881 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1882 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1883 | - // Hook the content filter service to add entity links. |
|
| 1884 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1885 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1886 | - } |
|
| 1887 | - |
|
| 1888 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1889 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1890 | - |
|
| 1891 | - // Hook the ShareThis service. |
|
| 1892 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1893 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1894 | - |
|
| 1895 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1896 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1897 | - |
|
| 1898 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1899 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1900 | - // to categories. |
|
| 1901 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1902 | - |
|
| 1903 | - /* |
|
| 1767 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1768 | + |
|
| 1769 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1770 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1771 | + |
|
| 1772 | + // Hook row actions for the entity type list admin. |
|
| 1773 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1774 | + |
|
| 1775 | + /** Ajax actions. */ |
|
| 1776 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1777 | + |
|
| 1778 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1779 | + // page on WordPress versions before 4.7. |
|
| 1780 | + global $wp_version; |
|
| 1781 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1782 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1783 | + } |
|
| 1784 | + |
|
| 1785 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1786 | + |
|
| 1787 | + /** Adapters. */ |
|
| 1788 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1789 | + /** |
|
| 1790 | + * Disabling Faq temporarily. |
|
| 1791 | + * Load the tinymce editor button on the tool bar. |
|
| 1792 | + * @since 3.26.0 |
|
| 1793 | + */ |
|
| 1794 | + //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1795 | + //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1796 | + //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1797 | + |
|
| 1798 | + |
|
| 1799 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1800 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1801 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1802 | + /** |
|
| 1803 | + * @since 3.26.0 |
|
| 1804 | + */ |
|
| 1805 | + if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) { |
|
| 1806 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1807 | + $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1808 | + // Adding Rest route for the post excerpt |
|
| 1809 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1810 | + } |
|
| 1811 | + |
|
| 1812 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1813 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1814 | + |
|
| 1815 | + // Handle the autocomplete request. |
|
| 1816 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1817 | + $this->autocomplete_adapter, |
|
| 1818 | + 'wl_autocomplete', |
|
| 1819 | + ) ); |
|
| 1820 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1821 | + $this->autocomplete_adapter, |
|
| 1822 | + 'wl_autocomplete', |
|
| 1823 | + ) ); |
|
| 1824 | + |
|
| 1825 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1826 | + if ( is_multisite() ) { |
|
| 1827 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1828 | + } |
|
| 1829 | + |
|
| 1830 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1831 | + |
|
| 1832 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1833 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1834 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1835 | + |
|
| 1836 | + /** |
|
| 1837 | + * Always allow the `wordlift/classification` block. |
|
| 1838 | + * |
|
| 1839 | + * @since 3.23.0 |
|
| 1840 | + */ |
|
| 1841 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1842 | + |
|
| 1843 | + if ( true === $value ) { |
|
| 1844 | + return $value; |
|
| 1845 | + } |
|
| 1846 | + |
|
| 1847 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1848 | + }, PHP_INT_MAX ); |
|
| 1849 | + |
|
| 1850 | + /** |
|
| 1851 | + * @since 3.27.7 |
|
| 1852 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1853 | + */ |
|
| 1854 | + new Top_Entities(); |
|
| 1855 | + } |
|
| 1856 | + |
|
| 1857 | + /** |
|
| 1858 | + * Register all of the hooks related to the public-facing functionality |
|
| 1859 | + * of the plugin. |
|
| 1860 | + * |
|
| 1861 | + * @since 1.0.0 |
|
| 1862 | + * @access private |
|
| 1863 | + */ |
|
| 1864 | + private function define_public_hooks() { |
|
| 1865 | + |
|
| 1866 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1867 | + |
|
| 1868 | + // Register the entity post type. |
|
| 1869 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1870 | + |
|
| 1871 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1872 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1873 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1874 | + // $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1875 | + // $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1876 | + |
|
| 1877 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1878 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1879 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1880 | + |
|
| 1881 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1882 | + $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1883 | + // Hook the content filter service to add entity links. |
|
| 1884 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1885 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1886 | + } |
|
| 1887 | + |
|
| 1888 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1889 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1890 | + |
|
| 1891 | + // Hook the ShareThis service. |
|
| 1892 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1893 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1894 | + |
|
| 1895 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1896 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1897 | + |
|
| 1898 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1899 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1900 | + // to categories. |
|
| 1901 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1902 | + |
|
| 1903 | + /* |
|
| 1904 | 1904 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1905 | 1905 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1906 | 1906 | * order of start time. |
| 1907 | 1907 | */ |
| 1908 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1909 | - |
|
| 1910 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1911 | - |
|
| 1912 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1913 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1914 | - |
|
| 1915 | - // Analytics Script Frontend. |
|
| 1916 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1917 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1918 | - } |
|
| 1919 | - |
|
| 1920 | - } |
|
| 1921 | - |
|
| 1922 | - /** |
|
| 1923 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1924 | - * |
|
| 1925 | - * @since 1.0.0 |
|
| 1926 | - */ |
|
| 1927 | - public function run() { |
|
| 1928 | - $this->loader->run(); |
|
| 1929 | - } |
|
| 1930 | - |
|
| 1931 | - /** |
|
| 1932 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1933 | - * WordPress and to define internationalization functionality. |
|
| 1934 | - * |
|
| 1935 | - * @return string The name of the plugin. |
|
| 1936 | - * @since 1.0.0 |
|
| 1937 | - */ |
|
| 1938 | - public function get_plugin_name() { |
|
| 1939 | - return $this->plugin_name; |
|
| 1940 | - } |
|
| 1941 | - |
|
| 1942 | - /** |
|
| 1943 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1944 | - * |
|
| 1945 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1946 | - * @since 1.0.0 |
|
| 1947 | - */ |
|
| 1948 | - public function get_loader() { |
|
| 1949 | - return $this->loader; |
|
| 1950 | - } |
|
| 1951 | - |
|
| 1952 | - /** |
|
| 1953 | - * Retrieve the version number of the plugin. |
|
| 1954 | - * |
|
| 1955 | - * @return string The version number of the plugin. |
|
| 1956 | - * @since 1.0.0 |
|
| 1957 | - */ |
|
| 1958 | - public function get_version() { |
|
| 1959 | - return $this->version; |
|
| 1960 | - } |
|
| 1961 | - |
|
| 1962 | - /** |
|
| 1963 | - * Load dependencies for WP-CLI. |
|
| 1964 | - * |
|
| 1965 | - * @throws Exception |
|
| 1966 | - * @since 3.18.0 |
|
| 1967 | - */ |
|
| 1968 | - private function load_cli_dependencies() { |
|
| 1969 | - |
|
| 1970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1971 | - |
|
| 1972 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1973 | - |
|
| 1974 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1975 | - |
|
| 1976 | - } |
|
| 1977 | - |
|
| 1978 | - /** |
|
| 1979 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1980 | - * |
|
| 1981 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1982 | - * @since 3.20.0 |
|
| 1983 | - */ |
|
| 1984 | - public function get_dashboard_service() { |
|
| 1985 | - |
|
| 1986 | - return $this->dashboard_service; |
|
| 1987 | - } |
|
| 1988 | - |
|
| 1989 | - public function add_wl_enabled_blocks() { |
|
| 1990 | - /** |
|
| 1991 | - * Filter: wl_feature__enable__blocks. |
|
| 1992 | - * |
|
| 1993 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1994 | - * |
|
| 1995 | - * @return bool |
|
| 1996 | - * @since 3.27.6 |
|
| 1997 | - */ |
|
| 1998 | - |
|
| 1999 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2000 | - |
|
| 2001 | - $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 2002 | - |
|
| 2003 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2004 | - // To intimate JS |
|
| 2005 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2006 | - 'wordlift/navigator', |
|
| 2007 | - 'wordlift/chord', |
|
| 2008 | - 'wordlift/geomap', |
|
| 2009 | - 'wordlift/timeline', |
|
| 2010 | - 'wordlift/cloud', |
|
| 2011 | - 'wordlift/vocabulary', |
|
| 2012 | - 'wordlift/faceted-search' |
|
| 2013 | - ) ); |
|
| 2014 | - } |
|
| 2015 | - |
|
| 2016 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2017 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2018 | - } |
|
| 1908 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1909 | + |
|
| 1910 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1911 | + |
|
| 1912 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1913 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1914 | + |
|
| 1915 | + // Analytics Script Frontend. |
|
| 1916 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1917 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1918 | + } |
|
| 1919 | + |
|
| 1920 | + } |
|
| 1921 | + |
|
| 1922 | + /** |
|
| 1923 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1924 | + * |
|
| 1925 | + * @since 1.0.0 |
|
| 1926 | + */ |
|
| 1927 | + public function run() { |
|
| 1928 | + $this->loader->run(); |
|
| 1929 | + } |
|
| 1930 | + |
|
| 1931 | + /** |
|
| 1932 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1933 | + * WordPress and to define internationalization functionality. |
|
| 1934 | + * |
|
| 1935 | + * @return string The name of the plugin. |
|
| 1936 | + * @since 1.0.0 |
|
| 1937 | + */ |
|
| 1938 | + public function get_plugin_name() { |
|
| 1939 | + return $this->plugin_name; |
|
| 1940 | + } |
|
| 1941 | + |
|
| 1942 | + /** |
|
| 1943 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1944 | + * |
|
| 1945 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1946 | + * @since 1.0.0 |
|
| 1947 | + */ |
|
| 1948 | + public function get_loader() { |
|
| 1949 | + return $this->loader; |
|
| 1950 | + } |
|
| 1951 | + |
|
| 1952 | + /** |
|
| 1953 | + * Retrieve the version number of the plugin. |
|
| 1954 | + * |
|
| 1955 | + * @return string The version number of the plugin. |
|
| 1956 | + * @since 1.0.0 |
|
| 1957 | + */ |
|
| 1958 | + public function get_version() { |
|
| 1959 | + return $this->version; |
|
| 1960 | + } |
|
| 1961 | + |
|
| 1962 | + /** |
|
| 1963 | + * Load dependencies for WP-CLI. |
|
| 1964 | + * |
|
| 1965 | + * @throws Exception |
|
| 1966 | + * @since 3.18.0 |
|
| 1967 | + */ |
|
| 1968 | + private function load_cli_dependencies() { |
|
| 1969 | + |
|
| 1970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1971 | + |
|
| 1972 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1973 | + |
|
| 1974 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1975 | + |
|
| 1976 | + } |
|
| 1977 | + |
|
| 1978 | + /** |
|
| 1979 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1980 | + * |
|
| 1981 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1982 | + * @since 3.20.0 |
|
| 1983 | + */ |
|
| 1984 | + public function get_dashboard_service() { |
|
| 1985 | + |
|
| 1986 | + return $this->dashboard_service; |
|
| 1987 | + } |
|
| 1988 | + |
|
| 1989 | + public function add_wl_enabled_blocks() { |
|
| 1990 | + /** |
|
| 1991 | + * Filter: wl_feature__enable__blocks. |
|
| 1992 | + * |
|
| 1993 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1994 | + * |
|
| 1995 | + * @return bool |
|
| 1996 | + * @since 3.27.6 |
|
| 1997 | + */ |
|
| 1998 | + |
|
| 1999 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2000 | + |
|
| 2001 | + $enabled_blocks = array( 'wordlift/products-navigator' ); |
|
| 2002 | + |
|
| 2003 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2004 | + // To intimate JS |
|
| 2005 | + $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2006 | + 'wordlift/navigator', |
|
| 2007 | + 'wordlift/chord', |
|
| 2008 | + 'wordlift/geomap', |
|
| 2009 | + 'wordlift/timeline', |
|
| 2010 | + 'wordlift/cloud', |
|
| 2011 | + 'wordlift/vocabulary', |
|
| 2012 | + 'wordlift/faceted-search' |
|
| 2013 | + ) ); |
|
| 2014 | + } |
|
| 2015 | + |
|
| 2016 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2017 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2018 | + } |
|
| 2019 | 2019 | |
| 2020 | 2020 | } |