@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | function wl_register_metaboxes() { |
| 12 | 12 | |
| 13 | - // Load metabox classes. |
|
| 14 | - require_once( 'WL_Metabox/class-wl-metabox.php' ); |
|
| 13 | + // Load metabox classes. |
|
| 14 | + require_once( 'WL_Metabox/class-wl-metabox.php' ); |
|
| 15 | 15 | |
| 16 | - $wl_metabox = new WL_Metabox(); // Everything is done inside here with the correct timing. |
|
| 16 | + $wl_metabox = new WL_Metabox(); // Everything is done inside here with the correct timing. |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if ( is_admin() ) { |
| 20 | - add_action( 'load-post.php', 'wl_register_metaboxes' ); |
|
| 21 | - add_action( 'load-post-new.php', 'wl_register_metaboxes' ); |
|
| 20 | + add_action( 'load-post.php', 'wl_register_metaboxes' ); |
|
| 21 | + add_action( 'load-post-new.php', 'wl_register_metaboxes' ); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -29,31 +29,31 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | function wl_admin_add_entities_meta_box( $post_type ) { |
| 31 | 31 | |
| 32 | - /* |
|
| 32 | + /* |
|
| 33 | 33 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 34 | 34 | * |
| 35 | 35 | * @since 3.20.3 |
| 36 | 36 | * |
| 37 | 37 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 38 | 38 | */ |
| 39 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 40 | - return; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - // Bail out if the post type doesn't support a TinyMCE editor. |
|
| 44 | - if ( ! wl_post_type_supports_editor( $post_type ) ) { |
|
| 45 | - return; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - if ( ! Wordlift_Admin::is_gutenberg() ) { |
|
| 49 | - // Add main meta box for related entities and 4W only if not Gutenberg |
|
| 50 | - add_meta_box( |
|
| 51 | - 'wordlift_entities_box', __( 'WordLift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high' |
|
| 52 | - ); |
|
| 53 | - } else { |
|
| 54 | - // Call wl_entities_box_content for the other things that it does. |
|
| 55 | - wl_entities_box_content( get_post(), false ); |
|
| 56 | - } |
|
| 39 | + if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + // Bail out if the post type doesn't support a TinyMCE editor. |
|
| 44 | + if ( ! wl_post_type_supports_editor( $post_type ) ) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + if ( ! Wordlift_Admin::is_gutenberg() ) { |
|
| 49 | + // Add main meta box for related entities and 4W only if not Gutenberg |
|
| 50 | + add_meta_box( |
|
| 51 | + 'wordlift_entities_box', __( 'WordLift', 'wordlift' ), 'wl_entities_box_content', $post_type, 'side', 'high' |
|
| 52 | + ); |
|
| 53 | + } else { |
|
| 54 | + // Call wl_entities_box_content for the other things that it does. |
|
| 55 | + wl_entities_box_content( get_post(), false ); |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | add_action( 'add_meta_boxes', 'wl_admin_add_entities_meta_box' ); |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | function wl_post_type_supports_editor( $post_type ) { |
| 71 | 71 | |
| 72 | - $default = post_type_supports( $post_type, 'editor' ); |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Allow 3rd parties to force the classification to load. |
|
| 76 | - * |
|
| 77 | - * @param bool $default The preset value as gathered by the `post_type_supports` call. |
|
| 78 | - * |
|
| 79 | - * @see https://github.com/insideout10/wordlift-plugin/issues/847. |
|
| 80 | - * |
|
| 81 | - * @since 3.19.4 |
|
| 82 | - * |
|
| 83 | - */ |
|
| 84 | - return apply_filters( 'wl_post_type_supports_editor', $default, $post_type ); |
|
| 72 | + $default = post_type_supports( $post_type, 'editor' ); |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Allow 3rd parties to force the classification to load. |
|
| 76 | + * |
|
| 77 | + * @param bool $default The preset value as gathered by the `post_type_supports` call. |
|
| 78 | + * |
|
| 79 | + * @see https://github.com/insideout10/wordlift-plugin/issues/847. |
|
| 80 | + * |
|
| 81 | + * @since 3.19.4 |
|
| 82 | + * |
|
| 83 | + */ |
|
| 84 | + return apply_filters( 'wl_post_type_supports_editor', $default, $post_type ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -91,105 +91,105 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | function wl_entities_box_content( $post, $wrapper = true ) { |
| 93 | 93 | |
| 94 | - // Angularjs edit-post widget wrapper. |
|
| 95 | - if ( $wrapper ) { |
|
| 96 | - echo '<div id="wordlift-edit-post-outer-wrapper"></div>'; |
|
| 97 | - } |
|
| 94 | + // Angularjs edit-post widget wrapper. |
|
| 95 | + if ( $wrapper ) { |
|
| 96 | + echo '<div id="wordlift-edit-post-outer-wrapper"></div>'; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - // Angularjs edit-post widget classification boxes configuration. |
|
| 100 | - $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES ); |
|
| 99 | + // Angularjs edit-post widget classification boxes configuration. |
|
| 100 | + $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES ); |
|
| 101 | 101 | |
| 102 | - // Array to store all related entities ids. |
|
| 103 | - $all_referenced_entities_ids = array(); |
|
| 102 | + // Array to store all related entities ids. |
|
| 103 | + $all_referenced_entities_ids = array(); |
|
| 104 | 104 | |
| 105 | - // Add selected entities to classification_boxes. |
|
| 106 | - foreach ( $classification_boxes as $i => $box ) { |
|
| 107 | - // Build the proper relation name. |
|
| 108 | - $relation_name = $box['id']; |
|
| 105 | + // Add selected entities to classification_boxes. |
|
| 106 | + foreach ( $classification_boxes as $i => $box ) { |
|
| 107 | + // Build the proper relation name. |
|
| 108 | + $relation_name = $box['id']; |
|
| 109 | 109 | |
| 110 | - // Get the entity referenced from the post content. |
|
| 111 | - /* |
|
| 110 | + // Get the entity referenced from the post content. |
|
| 111 | + /* |
|
| 112 | 112 | * Allow 3rd parties to provide another post content. |
| 113 | 113 | * |
| 114 | 114 | * @since 3.20.0 |
| 115 | 115 | */ |
| 116 | - $post_content = apply_filters( 'wl_post_content', $post->post_content, $post ); |
|
| 117 | - $entity_uris = Wordlift_Content_Filter_Service::get_instance()->get_entity_uris( $post_content ); |
|
| 118 | - |
|
| 119 | - // Enhance current box selected entities. |
|
| 120 | - $classification_boxes[ $i ]['selectedEntities'] = $entity_uris; |
|
| 121 | - |
|
| 122 | - // Maps the URIs to entity posts. |
|
| 123 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 124 | - |
|
| 125 | - // Replace all entity URI's with post ID's if found or null if there is no related post. |
|
| 126 | - $entity_ids = array_map( function ( $item ) use ( $entity_service ) { |
|
| 127 | - // Return entity post by the entity URI or null. |
|
| 128 | - $post = $entity_service->get_entity_post_by_uri( $item ); |
|
| 129 | - |
|
| 130 | - // Check that the post object is not null. |
|
| 131 | - if ( ! empty( $post ) ) { |
|
| 132 | - return $post->ID; |
|
| 133 | - } |
|
| 134 | - }, $entity_uris ); |
|
| 135 | - // Store the entity ids for all the 4W. |
|
| 136 | - $all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids ); |
|
| 137 | - |
|
| 138 | - } |
|
| 139 | - // Json encoding for classification boxes structure. |
|
| 140 | - $classification_boxes = wp_json_encode( $classification_boxes ); |
|
| 141 | - |
|
| 142 | - // Ensure there are no repetitions of the referenced entities. |
|
| 143 | - $all_referenced_entities_ids = array_unique( $all_referenced_entities_ids ); |
|
| 144 | - |
|
| 145 | - // Remove all null, false and empty strings. |
|
| 146 | - // NULL is being returned in some cases, when there is not related post, so we need to remove it. |
|
| 147 | - $all_referenced_entities_ids = array_filter( $all_referenced_entities_ids ); |
|
| 148 | - |
|
| 149 | - // Build the entity storage object. |
|
| 150 | - $referenced_entities_obj = array(); |
|
| 151 | - foreach ( $all_referenced_entities_ids as $referenced_entity ) { |
|
| 152 | - $entity = wl_serialize_entity( $referenced_entity ); |
|
| 153 | - // Set a default confidence of `PHP_INT_MAX` for already annotated entities. |
|
| 154 | - $referenced_entities_obj[ $entity['id'] ] = $entity |
|
| 155 | - + array( 'confidence' => PHP_INT_MAX ); |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - $referenced_entities_obj = empty( $referenced_entities_obj ) ? |
|
| 159 | - '{}' : wp_json_encode( $referenced_entities_obj ); |
|
| 160 | - |
|
| 161 | - $published_place_id = get_post_meta( |
|
| 162 | - $post->ID, Wordlift_Schema_Service::FIELD_LOCATION_CREATED, true |
|
| 163 | - ); |
|
| 164 | - $published_place_obj = ( $published_place_id ) ? |
|
| 165 | - wp_json_encode( wl_serialize_entity( $published_place_id ) ) : |
|
| 166 | - 'undefined'; |
|
| 167 | - |
|
| 168 | - $topic_id = get_post_meta( |
|
| 169 | - $post->ID, Wordlift_Schema_Service::FIELD_TOPIC, true |
|
| 170 | - ); |
|
| 171 | - $topic_obj = ( $topic_id ) ? |
|
| 172 | - wp_json_encode( wl_serialize_entity( $topic_id ) ) : |
|
| 173 | - 'undefined'; |
|
| 174 | - |
|
| 175 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 176 | - |
|
| 177 | - $default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH; |
|
| 178 | - $default_path = WL_DEFAULT_PATH; |
|
| 179 | - $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 180 | - $current_post_uri = wl_get_entity_uri( $post->ID ); |
|
| 181 | - |
|
| 182 | - // Retrieve the current post author. |
|
| 183 | - $post_author = get_userdata( $post->post_author )->display_name; |
|
| 184 | - // Retrive the published date. |
|
| 185 | - $published_date = get_the_time( 'Y-m-d', $post->ID ); |
|
| 186 | - // Current language. |
|
| 187 | - $current_language = $configuration_service->get_language_code(); |
|
| 188 | - $wordlift_timeline_shortcode = new Wordlift_Timeline_Shortcode(); |
|
| 189 | - $timelinejs_default_options = json_encode($wordlift_timeline_shortcode->get_timelinejs_default_options(), JSON_PRETTY_PRINT); |
|
| 190 | - $addslashes_post_author = addslashes($post_author); |
|
| 191 | - |
|
| 192 | - $js_code = <<<JS |
|
| 116 | + $post_content = apply_filters( 'wl_post_content', $post->post_content, $post ); |
|
| 117 | + $entity_uris = Wordlift_Content_Filter_Service::get_instance()->get_entity_uris( $post_content ); |
|
| 118 | + |
|
| 119 | + // Enhance current box selected entities. |
|
| 120 | + $classification_boxes[ $i ]['selectedEntities'] = $entity_uris; |
|
| 121 | + |
|
| 122 | + // Maps the URIs to entity posts. |
|
| 123 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 124 | + |
|
| 125 | + // Replace all entity URI's with post ID's if found or null if there is no related post. |
|
| 126 | + $entity_ids = array_map( function ( $item ) use ( $entity_service ) { |
|
| 127 | + // Return entity post by the entity URI or null. |
|
| 128 | + $post = $entity_service->get_entity_post_by_uri( $item ); |
|
| 129 | + |
|
| 130 | + // Check that the post object is not null. |
|
| 131 | + if ( ! empty( $post ) ) { |
|
| 132 | + return $post->ID; |
|
| 133 | + } |
|
| 134 | + }, $entity_uris ); |
|
| 135 | + // Store the entity ids for all the 4W. |
|
| 136 | + $all_referenced_entities_ids = array_merge( $all_referenced_entities_ids, $entity_ids ); |
|
| 137 | + |
|
| 138 | + } |
|
| 139 | + // Json encoding for classification boxes structure. |
|
| 140 | + $classification_boxes = wp_json_encode( $classification_boxes ); |
|
| 141 | + |
|
| 142 | + // Ensure there are no repetitions of the referenced entities. |
|
| 143 | + $all_referenced_entities_ids = array_unique( $all_referenced_entities_ids ); |
|
| 144 | + |
|
| 145 | + // Remove all null, false and empty strings. |
|
| 146 | + // NULL is being returned in some cases, when there is not related post, so we need to remove it. |
|
| 147 | + $all_referenced_entities_ids = array_filter( $all_referenced_entities_ids ); |
|
| 148 | + |
|
| 149 | + // Build the entity storage object. |
|
| 150 | + $referenced_entities_obj = array(); |
|
| 151 | + foreach ( $all_referenced_entities_ids as $referenced_entity ) { |
|
| 152 | + $entity = wl_serialize_entity( $referenced_entity ); |
|
| 153 | + // Set a default confidence of `PHP_INT_MAX` for already annotated entities. |
|
| 154 | + $referenced_entities_obj[ $entity['id'] ] = $entity |
|
| 155 | + + array( 'confidence' => PHP_INT_MAX ); |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + $referenced_entities_obj = empty( $referenced_entities_obj ) ? |
|
| 159 | + '{}' : wp_json_encode( $referenced_entities_obj ); |
|
| 160 | + |
|
| 161 | + $published_place_id = get_post_meta( |
|
| 162 | + $post->ID, Wordlift_Schema_Service::FIELD_LOCATION_CREATED, true |
|
| 163 | + ); |
|
| 164 | + $published_place_obj = ( $published_place_id ) ? |
|
| 165 | + wp_json_encode( wl_serialize_entity( $published_place_id ) ) : |
|
| 166 | + 'undefined'; |
|
| 167 | + |
|
| 168 | + $topic_id = get_post_meta( |
|
| 169 | + $post->ID, Wordlift_Schema_Service::FIELD_TOPIC, true |
|
| 170 | + ); |
|
| 171 | + $topic_obj = ( $topic_id ) ? |
|
| 172 | + wp_json_encode( wl_serialize_entity( $topic_id ) ) : |
|
| 173 | + 'undefined'; |
|
| 174 | + |
|
| 175 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 176 | + |
|
| 177 | + $default_thumbnail_path = WL_DEFAULT_THUMBNAIL_PATH; |
|
| 178 | + $default_path = WL_DEFAULT_PATH; |
|
| 179 | + $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 180 | + $current_post_uri = wl_get_entity_uri( $post->ID ); |
|
| 181 | + |
|
| 182 | + // Retrieve the current post author. |
|
| 183 | + $post_author = get_userdata( $post->post_author )->display_name; |
|
| 184 | + // Retrive the published date. |
|
| 185 | + $published_date = get_the_time( 'Y-m-d', $post->ID ); |
|
| 186 | + // Current language. |
|
| 187 | + $current_language = $configuration_service->get_language_code(); |
|
| 188 | + $wordlift_timeline_shortcode = new Wordlift_Timeline_Shortcode(); |
|
| 189 | + $timelinejs_default_options = json_encode($wordlift_timeline_shortcode->get_timelinejs_default_options(), JSON_PRETTY_PRINT); |
|
| 190 | + $addslashes_post_author = addslashes($post_author); |
|
| 191 | + |
|
| 192 | + $js_code = <<<JS |
|
| 193 | 193 | if ('undefined' == typeof window.wordlift) { |
| 194 | 194 | window.wordlift = {}; |
| 195 | 195 | window.wordlift.entities = {}; |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | window.wordlift.timelinejsDefaultOptions = $timelinejs_default_options; |
| 212 | 212 | JS; |
| 213 | 213 | |
| 214 | - if ( $wrapper ) { |
|
| 215 | - echo '<script type="text/javascript">' . PHP_EOL . $js_code . PHP_EOL . '</script>'; |
|
| 216 | - } |
|
| 217 | - wp_add_inline_script( 'wl-entity-metabox-utility', $js_code ); |
|
| 214 | + if ( $wrapper ) { |
|
| 215 | + echo '<script type="text/javascript">' . PHP_EOL . $js_code . PHP_EOL . '</script>'; |
|
| 216 | + } |
|
| 217 | + wp_add_inline_script( 'wl-entity-metabox-utility', $js_code ); |
|
| 218 | 218 | } |
| 219 | 219 | |
@@ -1,62 +1,62 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | $too_complicate_reason_label = sprintf( |
| 3 | - '<a target="_blank" href="%s">%s</a>', |
|
| 4 | - /* translators: the link https://wordlift.io/contact-us/ should be changed to language version of the page */ |
|
| 5 | - esc_attr__( 'https://wordlift.io/contact-us/', 'wordlift' ), |
|
| 6 | - esc_html__( 'Contact Us', 'wordlift' ) |
|
| 3 | + '<a target="_blank" href="%s">%s</a>', |
|
| 4 | + /* translators: the link https://wordlift.io/contact-us/ should be changed to language version of the page */ |
|
| 5 | + esc_attr__( 'https://wordlift.io/contact-us/', 'wordlift' ), |
|
| 6 | + esc_html__( 'Contact Us', 'wordlift' ) |
|
| 7 | 7 | ); |
| 8 | 8 | |
| 9 | 9 | $reasons = array( |
| 10 | - array( |
|
| 11 | - 'id' => 'TOO_COMPLICATED', |
|
| 12 | - 'text' => esc_html__( 'It was too complicated and unclear to me', 'wordlift' ), |
|
| 13 | - 'message' => array( |
|
| 14 | - 'text' => sprintf( |
|
| 15 | - esc_html__( 'Need help? We are ready to answer your questions. %s', 'wordlift' ), |
|
| 16 | - $too_complicate_reason_label |
|
| 17 | - ), |
|
| 18 | - ), |
|
| 19 | - ), |
|
| 20 | - array( |
|
| 21 | - 'id' => 'NOT_ENOUGH_FEATURES', |
|
| 22 | - 'text' => esc_html__( 'It misses some important feature to me', 'wordlift' ), |
|
| 23 | - 'message' => array( |
|
| 24 | - 'field' => 'text', |
|
| 25 | - 'text' => esc_html__( 'Tell us what this feature is.', 'wordlift' ), |
|
| 26 | - ), |
|
| 27 | - ), |
|
| 28 | - array( |
|
| 29 | - 'id' => 'COSTS_TOO_MUCH', |
|
| 30 | - 'text' => esc_html__( 'It costs too much', 'wordlift' ), |
|
| 31 | - 'message' => array( |
|
| 32 | - 'field' => 'text', |
|
| 33 | - 'text' => esc_html__( 'How much you would like to pay?', 'wordlift' ), |
|
| 34 | - ), |
|
| 35 | - ), |
|
| 36 | - array( |
|
| 37 | - 'id' => 'FOUND_ANOTHER_TOOL', |
|
| 38 | - 'text' => esc_html__( 'I found another tool that I like better', 'wordlift' ), |
|
| 39 | - 'message' => array( |
|
| 40 | - 'field' => 'text', |
|
| 41 | - 'text' => esc_html__( 'Please tell us some more details.', 'wordlift' ), |
|
| 42 | - ), |
|
| 43 | - ), |
|
| 44 | - array( |
|
| 45 | - 'id' => 'I_DONT_USE_IT', |
|
| 46 | - 'text' => esc_html__( 'I\'m not using it right now', 'wordlift' ), |
|
| 47 | - ), |
|
| 48 | - array( |
|
| 49 | - 'id' => 'SOMETHING_DIDNT_WORK', |
|
| 50 | - 'text' => esc_html__( 'Something didn\'t work right', 'wordlift' ), |
|
| 51 | - ), |
|
| 52 | - array( |
|
| 53 | - 'id' => 'ANOTHER_REASON', |
|
| 54 | - 'text' => esc_html__( 'Another reason', 'wordlift' ), |
|
| 55 | - 'message' => array( |
|
| 56 | - 'field' => 'textarea', |
|
| 57 | - 'text' => esc_html__( 'Please tell us the reason so we can improve it.', 'wordlift' ), |
|
| 58 | - ), |
|
| 59 | - ), |
|
| 10 | + array( |
|
| 11 | + 'id' => 'TOO_COMPLICATED', |
|
| 12 | + 'text' => esc_html__( 'It was too complicated and unclear to me', 'wordlift' ), |
|
| 13 | + 'message' => array( |
|
| 14 | + 'text' => sprintf( |
|
| 15 | + esc_html__( 'Need help? We are ready to answer your questions. %s', 'wordlift' ), |
|
| 16 | + $too_complicate_reason_label |
|
| 17 | + ), |
|
| 18 | + ), |
|
| 19 | + ), |
|
| 20 | + array( |
|
| 21 | + 'id' => 'NOT_ENOUGH_FEATURES', |
|
| 22 | + 'text' => esc_html__( 'It misses some important feature to me', 'wordlift' ), |
|
| 23 | + 'message' => array( |
|
| 24 | + 'field' => 'text', |
|
| 25 | + 'text' => esc_html__( 'Tell us what this feature is.', 'wordlift' ), |
|
| 26 | + ), |
|
| 27 | + ), |
|
| 28 | + array( |
|
| 29 | + 'id' => 'COSTS_TOO_MUCH', |
|
| 30 | + 'text' => esc_html__( 'It costs too much', 'wordlift' ), |
|
| 31 | + 'message' => array( |
|
| 32 | + 'field' => 'text', |
|
| 33 | + 'text' => esc_html__( 'How much you would like to pay?', 'wordlift' ), |
|
| 34 | + ), |
|
| 35 | + ), |
|
| 36 | + array( |
|
| 37 | + 'id' => 'FOUND_ANOTHER_TOOL', |
|
| 38 | + 'text' => esc_html__( 'I found another tool that I like better', 'wordlift' ), |
|
| 39 | + 'message' => array( |
|
| 40 | + 'field' => 'text', |
|
| 41 | + 'text' => esc_html__( 'Please tell us some more details.', 'wordlift' ), |
|
| 42 | + ), |
|
| 43 | + ), |
|
| 44 | + array( |
|
| 45 | + 'id' => 'I_DONT_USE_IT', |
|
| 46 | + 'text' => esc_html__( 'I\'m not using it right now', 'wordlift' ), |
|
| 47 | + ), |
|
| 48 | + array( |
|
| 49 | + 'id' => 'SOMETHING_DIDNT_WORK', |
|
| 50 | + 'text' => esc_html__( 'Something didn\'t work right', 'wordlift' ), |
|
| 51 | + ), |
|
| 52 | + array( |
|
| 53 | + 'id' => 'ANOTHER_REASON', |
|
| 54 | + 'text' => esc_html__( 'Another reason', 'wordlift' ), |
|
| 55 | + 'message' => array( |
|
| 56 | + 'field' => 'textarea', |
|
| 57 | + 'text' => esc_html__( 'Please tell us the reason so we can improve it.', 'wordlift' ), |
|
| 58 | + ), |
|
| 59 | + ), |
|
| 60 | 60 | ); |
| 61 | 61 | ?> |
| 62 | 62 | <div class="wl-modal-deactivation-feedback" style="display: none"> |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | <?php if ( ! empty( $reason['message'] ) ) : ?> |
| 92 | 92 | <div class="additional-info <?php echo ( ! empty( $reason['message']['field'] ) ) ? 'has-field' : ''; ?>"> |
| 93 | 93 | <?php |
| 94 | - if ( ! empty( $reason['message']['field'] ) ) { |
|
| 95 | - if ( $reason['message']['field'] === 'text' ) { |
|
| 96 | - echo '<input type="text" name="wl-details" class="wl-details"/>'; |
|
| 97 | - } else { |
|
| 98 | - echo '<textarea name="wl-details" class="wl-details"></textarea>'; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - echo wpautop( $reason['message']['text'] ) |
|
| 102 | - ?> |
|
| 94 | + if ( ! empty( $reason['message']['field'] ) ) { |
|
| 95 | + if ( $reason['message']['field'] === 'text' ) { |
|
| 96 | + echo '<input type="text" name="wl-details" class="wl-details"/>'; |
|
| 97 | + } else { |
|
| 98 | + echo '<textarea name="wl-details" class="wl-details"></textarea>'; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + echo wpautop( $reason['message']['text'] ) |
|
| 102 | + ?> |
|
| 103 | 103 | </div> |
| 104 | 104 | <?php endif ?> |
| 105 | 105 | </li> |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | <div class="notes"> |
| 111 | 111 | <p> |
| 112 | 112 | <?php |
| 113 | - printf( |
|
| 114 | - __( 'Important notice: Uninstalling the plugin will delete your vocabulary.<br>Maybe you would like to <a href="%s" target="_blank">download your data</a> first.', 'wordlift' ), |
|
| 115 | - add_query_arg( array( 'page' => 'wl_download_your_data' ), admin_url( 'admin.php' ) ) |
|
| 116 | - ); |
|
| 117 | - ?> |
|
| 113 | + printf( |
|
| 114 | + __( 'Important notice: Uninstalling the plugin will delete your vocabulary.<br>Maybe you would like to <a href="%s" target="_blank">download your data</a> first.', 'wordlift' ), |
|
| 115 | + add_query_arg( array( 'page' => 'wl_download_your_data' ), admin_url( 'admin.php' ) ) |
|
| 116 | + ); |
|
| 117 | + ?> |
|
| 118 | 118 | </p> |
| 119 | 119 | </div> |
| 120 | 120 | |
@@ -18,35 +18,35 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) { |
| 20 | 20 | |
| 21 | - // Get the entity service instance. |
|
| 22 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 21 | + // Get the entity service instance. |
|
| 22 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 23 | 23 | |
| 24 | - // Show the View Linked Data button only for entities. |
|
| 25 | - // |
|
| 26 | - // See https://github.com/insideout10/wordlift-plugin/issues/668. |
|
| 27 | - if ( 'publish' === get_post_status( $post_id ) |
|
| 28 | - && $uri = $entity_service->get_uri( $post_id ) ) { |
|
| 24 | + // Show the View Linked Data button only for entities. |
|
| 25 | + // |
|
| 26 | + // See https://github.com/insideout10/wordlift-plugin/issues/668. |
|
| 27 | + if ( 'publish' === get_post_status( $post_id ) |
|
| 28 | + && $uri = $entity_service->get_uri( $post_id ) ) { |
|
| 29 | 29 | |
| 30 | - $lod_view_href = esc_attr( $uri ); |
|
| 31 | - /* |
|
| 30 | + $lod_view_href = esc_attr( $uri ); |
|
| 31 | + /* |
|
| 32 | 32 | * Add the `.html` extension to the link to have Chrome open the html version instead of RDF one. |
| 33 | 33 | * |
| 34 | 34 | * @see https://github.com/insideout10/wordlift-plugin/issues/931 |
| 35 | 35 | * @since 3.21.1 |
| 36 | 36 | */ |
| 37 | - $html .= "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>" . |
|
| 38 | - esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 39 | - "</a></span>\n"; |
|
| 37 | + $html .= "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>" . |
|
| 38 | + esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 39 | + "</a></span>\n"; |
|
| 40 | 40 | |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 44 | - urlencode( get_permalink( $post_id ) ) . |
|
| 45 | - "' class='button button-small wl-button' target='_blank'>" . |
|
| 46 | - esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 47 | - "</a></span>\n"; |
|
| 43 | + $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 44 | + urlencode( get_permalink( $post_id ) ) . |
|
| 45 | + "' class='button button-small wl-button' target='_blank'>" . |
|
| 46 | + esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 47 | + "</a></span>\n"; |
|
| 48 | 48 | |
| 49 | - return $html; |
|
| 49 | + return $html; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4 ); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return string The enhanced html. |
| 18 | 18 | */ |
| 19 | -function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) { |
|
| 19 | +function wl_admin_permalink_html($html, $post_id, $new_title, $new_slug) { |
|
| 20 | 20 | |
| 21 | 21 | // Get the entity service instance. |
| 22 | 22 | $entity_service = Wordlift_Entity_Service::get_instance(); |
@@ -24,29 +24,29 @@ discard block |
||
| 24 | 24 | // Show the View Linked Data button only for entities. |
| 25 | 25 | // |
| 26 | 26 | // See https://github.com/insideout10/wordlift-plugin/issues/668. |
| 27 | - if ( 'publish' === get_post_status( $post_id ) |
|
| 28 | - && $uri = $entity_service->get_uri( $post_id ) ) { |
|
| 27 | + if ('publish' === get_post_status($post_id) |
|
| 28 | + && $uri = $entity_service->get_uri($post_id)) { |
|
| 29 | 29 | |
| 30 | - $lod_view_href = esc_attr( $uri ); |
|
| 30 | + $lod_view_href = esc_attr($uri); |
|
| 31 | 31 | /* |
| 32 | 32 | * Add the `.html` extension to the link to have Chrome open the html version instead of RDF one. |
| 33 | 33 | * |
| 34 | 34 | * @see https://github.com/insideout10/wordlift-plugin/issues/931 |
| 35 | 35 | * @since 3.21.1 |
| 36 | 36 | */ |
| 37 | - $html .= "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>" . |
|
| 38 | - esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 37 | + $html .= "<span id='view-post-btn'><a href='$lod_view_href.html' class='button button-small wl-button' target='_blank'>". |
|
| 38 | + esc_html__('View Linked Data', 'wordlift'). |
|
| 39 | 39 | "</a></span>\n"; |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 44 | - urlencode( get_permalink( $post_id ) ) . |
|
| 45 | - "' class='button button-small wl-button' target='_blank'>" . |
|
| 46 | - esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 43 | + $html .= "<span id='view-post-btn'><a href='".WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL. |
|
| 44 | + urlencode(get_permalink($post_id)). |
|
| 45 | + "' class='button button-small wl-button' target='_blank'>". |
|
| 46 | + esc_html__('Test Google Rich Snippets', 'wordlift'). |
|
| 47 | 47 | "</a></span>\n"; |
| 48 | 48 | |
| 49 | 49 | return $html; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4 ); |
|
| 52 | +add_filter('get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4); |
|
@@ -22,107 +22,107 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class Wordlift_Public { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The ID of this plugin. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var string $plugin_name The ID of this plugin. |
|
| 31 | - */ |
|
| 32 | - private $plugin_name; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * The version of this plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access private |
|
| 39 | - * @var string $version The current version of this plugin. |
|
| 40 | - */ |
|
| 41 | - private $version; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Initialize the class and set its properties. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * |
|
| 48 | - * @param string $plugin_name The name of the plugin. |
|
| 49 | - * @param string $version The version of this plugin. |
|
| 50 | - */ |
|
| 51 | - public function __construct( $plugin_name, $version ) { |
|
| 52 | - |
|
| 53 | - $this->plugin_name = $plugin_name; |
|
| 54 | - $this->version = $version; |
|
| 55 | - |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Register the stylesheets for the public-facing side of the site. |
|
| 60 | - * |
|
| 61 | - * @since 3.19.3 Register the `wordlift-ui` css. |
|
| 62 | - * @since 3.19.2 The call to this function is commented out in `class-wordlift.php` because `wordlift-public.css` |
|
| 63 | - * is empty. |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function enqueue_styles() { |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * An instance of this class should be passed to the run() function |
|
| 70 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 71 | - * in that particular class. |
|
| 72 | - * |
|
| 73 | - * The Wordlift_Loader will then create the relationship |
|
| 74 | - * between the defined hooks and the functions defined in this |
|
| 75 | - * class. |
|
| 76 | - */ |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Add the `wordlift-font-awesome` unless some 3rd party sets the flag to false. |
|
| 80 | - * |
|
| 81 | - * @since 3.19.3 |
|
| 82 | - * |
|
| 83 | - * @param bool $include Whether to include or not font-awesome (default true). |
|
| 84 | - */ |
|
| 85 | - $deps = apply_filters( 'wl_include_font_awesome', true ) |
|
| 86 | - ? array( 'wordlift-font-awesome' ) |
|
| 87 | - : array(); |
|
| 88 | - wp_register_style( 'wordlift-font-awesome', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-font-awesome' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), $this->version, 'all' ); |
|
| 89 | - wp_register_style( 'wordlift-ui', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', $deps, $this->version, 'all' ); |
|
| 90 | - |
|
| 91 | - // You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective. |
|
| 92 | - // |
|
| 93 | - // @see https://github.com/insideout10/wordlift-plugin/issues/821 |
|
| 94 | - // |
|
| 95 | - // wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' ); |
|
| 96 | - |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * Register the stylesheets for the public-facing side of the site. |
|
| 101 | - * |
|
| 102 | - * @since 1.0.0 |
|
| 103 | - */ |
|
| 104 | - public function enqueue_scripts() { |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * This function is provided for demonstration purposes only. |
|
| 108 | - * |
|
| 109 | - * An instance of this class should be passed to the run() function |
|
| 110 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 111 | - * in that particular class. |
|
| 112 | - * |
|
| 113 | - * The Wordlift_Loader will then create the relationship |
|
| 114 | - * between the defined hooks and the functions defined in this |
|
| 115 | - * class. |
|
| 116 | - */ |
|
| 117 | - |
|
| 118 | - $settings = self::get_settings(); |
|
| 119 | - |
|
| 120 | - // Note that we switched the js to be loaded in footer, since it is loading |
|
| 121 | - // the json-ld representation. |
|
| 122 | - wp_enqueue_script( $this->plugin_name, self::get_public_js_url(), array(), $this->version, true ); |
|
| 123 | - wp_localize_script( $this->plugin_name, 'wlSettings', $settings ); |
|
| 124 | - |
|
| 125 | - /* |
|
| 25 | + /** |
|
| 26 | + * The ID of this plugin. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var string $plugin_name The ID of this plugin. |
|
| 31 | + */ |
|
| 32 | + private $plugin_name; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * The version of this plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access private |
|
| 39 | + * @var string $version The current version of this plugin. |
|
| 40 | + */ |
|
| 41 | + private $version; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Initialize the class and set its properties. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * |
|
| 48 | + * @param string $plugin_name The name of the plugin. |
|
| 49 | + * @param string $version The version of this plugin. |
|
| 50 | + */ |
|
| 51 | + public function __construct( $plugin_name, $version ) { |
|
| 52 | + |
|
| 53 | + $this->plugin_name = $plugin_name; |
|
| 54 | + $this->version = $version; |
|
| 55 | + |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Register the stylesheets for the public-facing side of the site. |
|
| 60 | + * |
|
| 61 | + * @since 3.19.3 Register the `wordlift-ui` css. |
|
| 62 | + * @since 3.19.2 The call to this function is commented out in `class-wordlift.php` because `wordlift-public.css` |
|
| 63 | + * is empty. |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function enqueue_styles() { |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * An instance of this class should be passed to the run() function |
|
| 70 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 71 | + * in that particular class. |
|
| 72 | + * |
|
| 73 | + * The Wordlift_Loader will then create the relationship |
|
| 74 | + * between the defined hooks and the functions defined in this |
|
| 75 | + * class. |
|
| 76 | + */ |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Add the `wordlift-font-awesome` unless some 3rd party sets the flag to false. |
|
| 80 | + * |
|
| 81 | + * @since 3.19.3 |
|
| 82 | + * |
|
| 83 | + * @param bool $include Whether to include or not font-awesome (default true). |
|
| 84 | + */ |
|
| 85 | + $deps = apply_filters( 'wl_include_font_awesome', true ) |
|
| 86 | + ? array( 'wordlift-font-awesome' ) |
|
| 87 | + : array(); |
|
| 88 | + wp_register_style( 'wordlift-font-awesome', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-font-awesome' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), $this->version, 'all' ); |
|
| 89 | + wp_register_style( 'wordlift-ui', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', $deps, $this->version, 'all' ); |
|
| 90 | + |
|
| 91 | + // You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective. |
|
| 92 | + // |
|
| 93 | + // @see https://github.com/insideout10/wordlift-plugin/issues/821 |
|
| 94 | + // |
|
| 95 | + // wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' ); |
|
| 96 | + |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * Register the stylesheets for the public-facing side of the site. |
|
| 101 | + * |
|
| 102 | + * @since 1.0.0 |
|
| 103 | + */ |
|
| 104 | + public function enqueue_scripts() { |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * This function is provided for demonstration purposes only. |
|
| 108 | + * |
|
| 109 | + * An instance of this class should be passed to the run() function |
|
| 110 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 111 | + * in that particular class. |
|
| 112 | + * |
|
| 113 | + * The Wordlift_Loader will then create the relationship |
|
| 114 | + * between the defined hooks and the functions defined in this |
|
| 115 | + * class. |
|
| 116 | + */ |
|
| 117 | + |
|
| 118 | + $settings = self::get_settings(); |
|
| 119 | + |
|
| 120 | + // Note that we switched the js to be loaded in footer, since it is loading |
|
| 121 | + // the json-ld representation. |
|
| 122 | + wp_enqueue_script( $this->plugin_name, self::get_public_js_url(), array(), $this->version, true ); |
|
| 123 | + wp_localize_script( $this->plugin_name, 'wlSettings', $settings ); |
|
| 124 | + |
|
| 125 | + /* |
|
| 126 | 126 | * Add WordLift's version. |
| 127 | 127 | * Can be disabled via filter 'wl_disable_version_js' since 3.21.1 |
| 128 | 128 | * |
@@ -131,72 +131,72 @@ discard block |
||
| 131 | 131 | * @see https://github.com/insideout10/wordlift-plugin/issues/843. |
| 132 | 132 | * @see https://github.com/insideout10/wordlift-plugin/issues/926. |
| 133 | 133 | */ |
| 134 | - $show_version_default = false; |
|
| 135 | - $show_version = apply_filters( 'wl_disable_version_js', $show_version_default ); |
|
| 136 | - |
|
| 137 | - if($show_version) { |
|
| 138 | - wp_localize_script( $this->plugin_name, 'wordlift', array( |
|
| 139 | - 'version' => $this->version, |
|
| 140 | - ) ); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Get the settings array. |
|
| 147 | - * |
|
| 148 | - * @since 3.19.1 |
|
| 149 | - * |
|
| 150 | - * @return array An array with the settings. |
|
| 151 | - */ |
|
| 152 | - public static function get_settings() { |
|
| 153 | - |
|
| 154 | - // Prepare a settings array for client-side functions. |
|
| 155 | - $settings = array( |
|
| 156 | - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
|
| 157 | - 'apiUrl' => get_home_url( null, 'wl-api/' ), |
|
| 158 | - ); |
|
| 159 | - |
|
| 160 | - // If we're in a single page, then print out the post id. |
|
| 161 | - if ( is_singular() ) { |
|
| 162 | - $settings['postId'] = get_the_ID(); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - // Add flag that we are on home/blog page. |
|
| 166 | - if ( is_home() || is_front_page() ) { |
|
| 167 | - $settings['isHome'] = true; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - // By default only enable JSON-LD on supported entity pages (includes |
|
| 171 | - // `page`, `post` and `entity` by default) and on the home page. |
|
| 172 | - // |
|
| 173 | - // @see https://github.com/insideout10/wordlift-plugin/issues/733 |
|
| 174 | - $jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() ); |
|
| 175 | - |
|
| 176 | - // Add the JSON-LD enabled flag, when set to false, the JSON-lD won't |
|
| 177 | - // be loaded. |
|
| 178 | - // |
|
| 179 | - // @see https://github.com/insideout10/wordlift-plugin/issues/642. |
|
| 180 | - $settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled ); |
|
| 181 | - |
|
| 182 | - return $settings; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Get the public JavaScript URL. |
|
| 187 | - * |
|
| 188 | - * Using this function is encouraged, since the public JavaScript is also used by the {@link Wordlift_WpRocket_Adapter} |
|
| 189 | - * in order to avoid breaking optimizations. |
|
| 190 | - * |
|
| 191 | - * @since 3.19.4 |
|
| 192 | - * |
|
| 193 | - * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
|
| 194 | - * |
|
| 195 | - * @return string The URL to the public JavaScript. |
|
| 196 | - */ |
|
| 197 | - public static function get_public_js_url() { |
|
| 198 | - |
|
| 199 | - return plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js'; |
|
| 200 | - } |
|
| 134 | + $show_version_default = false; |
|
| 135 | + $show_version = apply_filters( 'wl_disable_version_js', $show_version_default ); |
|
| 136 | + |
|
| 137 | + if($show_version) { |
|
| 138 | + wp_localize_script( $this->plugin_name, 'wordlift', array( |
|
| 139 | + 'version' => $this->version, |
|
| 140 | + ) ); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Get the settings array. |
|
| 147 | + * |
|
| 148 | + * @since 3.19.1 |
|
| 149 | + * |
|
| 150 | + * @return array An array with the settings. |
|
| 151 | + */ |
|
| 152 | + public static function get_settings() { |
|
| 153 | + |
|
| 154 | + // Prepare a settings array for client-side functions. |
|
| 155 | + $settings = array( |
|
| 156 | + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
|
| 157 | + 'apiUrl' => get_home_url( null, 'wl-api/' ), |
|
| 158 | + ); |
|
| 159 | + |
|
| 160 | + // If we're in a single page, then print out the post id. |
|
| 161 | + if ( is_singular() ) { |
|
| 162 | + $settings['postId'] = get_the_ID(); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + // Add flag that we are on home/blog page. |
|
| 166 | + if ( is_home() || is_front_page() ) { |
|
| 167 | + $settings['isHome'] = true; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + // By default only enable JSON-LD on supported entity pages (includes |
|
| 171 | + // `page`, `post` and `entity` by default) and on the home page. |
|
| 172 | + // |
|
| 173 | + // @see https://github.com/insideout10/wordlift-plugin/issues/733 |
|
| 174 | + $jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() ); |
|
| 175 | + |
|
| 176 | + // Add the JSON-LD enabled flag, when set to false, the JSON-lD won't |
|
| 177 | + // be loaded. |
|
| 178 | + // |
|
| 179 | + // @see https://github.com/insideout10/wordlift-plugin/issues/642. |
|
| 180 | + $settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled ); |
|
| 181 | + |
|
| 182 | + return $settings; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Get the public JavaScript URL. |
|
| 187 | + * |
|
| 188 | + * Using this function is encouraged, since the public JavaScript is also used by the {@link Wordlift_WpRocket_Adapter} |
|
| 189 | + * in order to avoid breaking optimizations. |
|
| 190 | + * |
|
| 191 | + * @since 3.19.4 |
|
| 192 | + * |
|
| 193 | + * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
|
| 194 | + * |
|
| 195 | + * @return string The URL to the public JavaScript. |
|
| 196 | + */ |
|
| 197 | + public static function get_public_js_url() { |
|
| 198 | + |
|
| 199 | + return plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js'; |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | 202 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $plugin_name The name of the plugin. |
| 49 | 49 | * @param string $version The version of this plugin. |
| 50 | 50 | */ |
| 51 | - public function __construct( $plugin_name, $version ) { |
|
| 51 | + public function __construct($plugin_name, $version) { |
|
| 52 | 52 | |
| 53 | 53 | $this->plugin_name = $plugin_name; |
| 54 | 54 | $this->version = $version; |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @param bool $include Whether to include or not font-awesome (default true). |
| 84 | 84 | */ |
| 85 | - $deps = apply_filters( 'wl_include_font_awesome', true ) |
|
| 86 | - ? array( 'wordlift-font-awesome' ) |
|
| 85 | + $deps = apply_filters('wl_include_font_awesome', true) |
|
| 86 | + ? array('wordlift-font-awesome') |
|
| 87 | 87 | : array(); |
| 88 | - wp_register_style( 'wordlift-font-awesome', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-font-awesome' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), $this->version, 'all' ); |
|
| 89 | - wp_register_style( 'wordlift-ui', plugin_dir_url( dirname( __FILE__ ) ) . 'css/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', $deps, $this->version, 'all' ); |
|
| 88 | + wp_register_style('wordlift-font-awesome', plugin_dir_url(dirname(__FILE__)).'css/wordlift-font-awesome'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.css', array(), $this->version, 'all'); |
|
| 89 | + wp_register_style('wordlift-ui', plugin_dir_url(dirname(__FILE__)).'css/wordlift-ui'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.css', $deps, $this->version, 'all'); |
|
| 90 | 90 | |
| 91 | 91 | // You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective. |
| 92 | 92 | // |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // Note that we switched the js to be loaded in footer, since it is loading |
| 121 | 121 | // the json-ld representation. |
| 122 | - wp_enqueue_script( $this->plugin_name, self::get_public_js_url(), array(), $this->version, true ); |
|
| 123 | - wp_localize_script( $this->plugin_name, 'wlSettings', $settings ); |
|
| 122 | + wp_enqueue_script($this->plugin_name, self::get_public_js_url(), array(), $this->version, true); |
|
| 123 | + wp_localize_script($this->plugin_name, 'wlSettings', $settings); |
|
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | 126 | * Add WordLift's version. |
@@ -132,12 +132,12 @@ discard block |
||
| 132 | 132 | * @see https://github.com/insideout10/wordlift-plugin/issues/926. |
| 133 | 133 | */ |
| 134 | 134 | $show_version_default = false; |
| 135 | - $show_version = apply_filters( 'wl_disable_version_js', $show_version_default ); |
|
| 135 | + $show_version = apply_filters('wl_disable_version_js', $show_version_default); |
|
| 136 | 136 | |
| 137 | - if($show_version) { |
|
| 138 | - wp_localize_script( $this->plugin_name, 'wordlift', array( |
|
| 137 | + if ($show_version) { |
|
| 138 | + wp_localize_script($this->plugin_name, 'wordlift', array( |
|
| 139 | 139 | 'version' => $this->version, |
| 140 | - ) ); |
|
| 140 | + )); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | } |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | // Prepare a settings array for client-side functions. |
| 155 | 155 | $settings = array( |
| 156 | - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
|
| 157 | - 'apiUrl' => get_home_url( null, 'wl-api/' ), |
|
| 156 | + 'ajaxUrl' => admin_url('admin-ajax.php'), |
|
| 157 | + 'apiUrl' => get_home_url(null, 'wl-api/'), |
|
| 158 | 158 | ); |
| 159 | 159 | |
| 160 | 160 | // If we're in a single page, then print out the post id. |
| 161 | - if ( is_singular() ) { |
|
| 161 | + if (is_singular()) { |
|
| 162 | 162 | $settings['postId'] = get_the_ID(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Add flag that we are on home/blog page. |
| 166 | - if ( is_home() || is_front_page() ) { |
|
| 166 | + if (is_home() || is_front_page()) { |
|
| 167 | 167 | $settings['isHome'] = true; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | // `page`, `post` and `entity` by default) and on the home page. |
| 172 | 172 | // |
| 173 | 173 | // @see https://github.com/insideout10/wordlift-plugin/issues/733 |
| 174 | - $jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() ); |
|
| 174 | + $jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type(get_post_type()); |
|
| 175 | 175 | |
| 176 | 176 | // Add the JSON-LD enabled flag, when set to false, the JSON-lD won't |
| 177 | 177 | // be loaded. |
| 178 | 178 | // |
| 179 | 179 | // @see https://github.com/insideout10/wordlift-plugin/issues/642. |
| 180 | - $settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled ); |
|
| 180 | + $settings['jsonld_enabled'] = apply_filters('wl_jsonld_enabled', $jsonld_enabled); |
|
| 181 | 181 | |
| 182 | 182 | return $settings; |
| 183 | 183 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public static function get_public_js_url() { |
| 198 | 198 | |
| 199 | - return plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js'; |
|
| 199 | + return plugin_dir_url(dirname(__FILE__)).'js/dist/bundle.js'; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | } |
@@ -18,1687 +18,1687 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Schema_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The 'location created' field name. |
|
| 23 | - * |
|
| 24 | - * @since 3.5.0 |
|
| 25 | - */ |
|
| 26 | - const FIELD_LOCATION_CREATED = 'wl_location_created'; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * The 'topic' field name. |
|
| 30 | - * |
|
| 31 | - * @since 3.5.0 |
|
| 32 | - */ |
|
| 33 | - const FIELD_TOPIC = 'wl_topic'; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * The 'author' field name. |
|
| 37 | - * |
|
| 38 | - * @since 3.1.0 |
|
| 39 | - */ |
|
| 40 | - const FIELD_AUTHOR = 'wl_author'; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * The 'same as' field name. |
|
| 44 | - * |
|
| 45 | - * @since 3.1.0 |
|
| 46 | - */ |
|
| 47 | - const FIELD_SAME_AS = 'entity_same_as'; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * The 'date start' field name. |
|
| 51 | - * |
|
| 52 | - * @since 3.1.0 |
|
| 53 | - */ |
|
| 54 | - const FIELD_DATE_START = 'wl_cal_date_start'; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * The 'date end' field name. |
|
| 58 | - * |
|
| 59 | - * @since 3.1.0 |
|
| 60 | - */ |
|
| 61 | - const FIELD_DATE_END = 'wl_cal_date_end'; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * The 'location' field name. |
|
| 65 | - * |
|
| 66 | - * @since 3.1.0 |
|
| 67 | - */ |
|
| 68 | - const FIELD_LOCATION = 'wl_location'; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The 'founder' field name. |
|
| 72 | - * |
|
| 73 | - * @since 3.1.0 |
|
| 74 | - */ |
|
| 75 | - const FIELD_FOUNDER = 'wl_founder'; |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * The 'knows' field name. |
|
| 79 | - * |
|
| 80 | - * @since 3.1.0 |
|
| 81 | - */ |
|
| 82 | - const FIELD_KNOWS = 'wl_knows'; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * The 'birth date' field name. |
|
| 86 | - * |
|
| 87 | - * @since 3.1.0 |
|
| 88 | - */ |
|
| 89 | - const FIELD_BIRTH_DATE = 'wl_birth_date'; |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * The 'birth place' field name. |
|
| 93 | - * |
|
| 94 | - * @since 3.1.0 |
|
| 95 | - */ |
|
| 96 | - const FIELD_BIRTH_PLACE = 'wl_birth_place'; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * The 'latitude' field name. |
|
| 100 | - * |
|
| 101 | - * @since 3.1.0 |
|
| 102 | - */ |
|
| 103 | - const FIELD_GEO_LATITUDE = 'wl_geo_latitude'; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The 'longitude' field name. |
|
| 107 | - * |
|
| 108 | - * @since 3.1.0 |
|
| 109 | - */ |
|
| 110 | - const FIELD_GEO_LONGITUDE = 'wl_geo_longitude'; |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * The 'streetAddress' field name. |
|
| 114 | - * |
|
| 115 | - * @since 3.1.0 |
|
| 116 | - */ |
|
| 117 | - const FIELD_ADDRESS = 'wl_address'; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The 'postOfficeBoxNumber' field name. |
|
| 121 | - * |
|
| 122 | - * @since 3.3.0 |
|
| 123 | - */ |
|
| 124 | - const FIELD_ADDRESS_PO_BOX = 'wl_address_post_office_box'; |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * The 'postalCode' field name. |
|
| 128 | - * |
|
| 129 | - * @since 3.3.0 |
|
| 130 | - */ |
|
| 131 | - const FIELD_ADDRESS_POSTAL_CODE = 'wl_address_postal_code'; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * The 'addressLocality' field name. |
|
| 135 | - * |
|
| 136 | - * @since 3.3.0 |
|
| 137 | - */ |
|
| 138 | - const FIELD_ADDRESS_LOCALITY = 'wl_address_locality'; |
|
| 139 | - /** |
|
| 140 | - * The 'addressRegion' field name. |
|
| 141 | - * |
|
| 142 | - * @since 3.3.0 |
|
| 143 | - */ |
|
| 144 | - const FIELD_ADDRESS_REGION = 'wl_address_region'; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * The 'addressCountry' field name. |
|
| 148 | - * |
|
| 149 | - * @since 3.3.0 |
|
| 150 | - */ |
|
| 151 | - const FIELD_ADDRESS_COUNTRY = 'wl_address_country'; |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * The 'entity type' field name. |
|
| 155 | - * |
|
| 156 | - * @since 3.1.0 |
|
| 157 | - */ |
|
| 158 | - const FIELD_ENTITY_TYPE = 'wl_entity_type_uri'; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The 'email' field name. |
|
| 162 | - * |
|
| 163 | - * @since 3.2.0 |
|
| 164 | - */ |
|
| 165 | - const FIELD_EMAIL = 'wl_email'; |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * The 'affiliation' field name. |
|
| 169 | - * |
|
| 170 | - * @since 3.2.0 |
|
| 171 | - */ |
|
| 172 | - const FIELD_AFFILIATION = 'wl_affiliation'; |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * The 'telephone' field name. |
|
| 176 | - * |
|
| 177 | - * @since 3.8.0 |
|
| 178 | - */ |
|
| 179 | - const FIELD_TELEPHONE = 'wl_schema_telephone'; |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * The 'legalName' field name. |
|
| 183 | - * |
|
| 184 | - * @since 3.12.0 |
|
| 185 | - */ |
|
| 186 | - const FIELD_LEGAL_NAME = 'wl_schema_legal_name'; |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * The 'recipeCuisine' field name. |
|
| 190 | - * |
|
| 191 | - * @since 3.14.0 |
|
| 192 | - */ |
|
| 193 | - const FIELD_RECIPE_CUISINE = 'wl_schema_recipe_cuisine'; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The 'recipeIngredient' field name. |
|
| 197 | - * |
|
| 198 | - * @since 3.14.0 |
|
| 199 | - */ |
|
| 200 | - const FIELD_RECIPE_INGREDIENT = 'wl_schema_recipe_ingredient'; |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * The 'calories' field name. |
|
| 204 | - * |
|
| 205 | - * @since 3.14.0 |
|
| 206 | - */ |
|
| 207 | - const FIELD_NUTRITION_INFO_CALORIES = 'wl_schema_nutrition_information_calories'; |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * The 'recipeInstructions' field name. |
|
| 211 | - * |
|
| 212 | - * @since 3.14.0 |
|
| 213 | - */ |
|
| 214 | - const FIELD_RECIPE_INSTRUCTIONS = 'wl_schema_recipe_instructions'; |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * The 'recipeYield' field name. |
|
| 218 | - * |
|
| 219 | - * @since 3.14.0 |
|
| 220 | - */ |
|
| 221 | - const FIELD_RECIPE_YIELD = 'wl_schema_recipe_yield'; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * The 'prepTime' field name. |
|
| 225 | - * |
|
| 226 | - * @since 3.14.0 |
|
| 227 | - */ |
|
| 228 | - const FIELD_PREP_TIME = 'wl_schema_prep_time'; |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * The 'cookTime' field name. |
|
| 232 | - * |
|
| 233 | - * @since 3.14.0 |
|
| 234 | - */ |
|
| 235 | - const FIELD_COOK_TIME = 'wl_schema_cook_time'; |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * The 'totalTime' field name. |
|
| 239 | - * |
|
| 240 | - * @since 3.14.0 |
|
| 241 | - */ |
|
| 242 | - const FIELD_TOTAL_TIME = 'wl_schema_total_time'; |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * The 'performer' field name. |
|
| 246 | - * |
|
| 247 | - * @since 3.18.0 |
|
| 248 | - */ |
|
| 249 | - const FIELD_PERFORMER = 'wl_schema_performer'; |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * The 'offers' field name. |
|
| 253 | - * |
|
| 254 | - * @since 3.18.0 |
|
| 255 | - */ |
|
| 256 | - const FIELD_OFFERS = 'wl_schema_offers'; |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * The 'availablity' field name. |
|
| 260 | - * |
|
| 261 | - * @since 3.18.0 |
|
| 262 | - */ |
|
| 263 | - const FIELD_AVAILABILITY = 'wl_schema_availability'; |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * The 'inventoryLevel' field name. |
|
| 267 | - * |
|
| 268 | - * @since 3.18.0 |
|
| 269 | - */ |
|
| 270 | - const FIELD_INVENTORY_LEVEL = 'wl_schema_inventory_level'; |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * The 'price' field name. |
|
| 274 | - * |
|
| 275 | - * @since 3.18.0 |
|
| 276 | - */ |
|
| 277 | - const FIELD_PRICE = 'wl_schema_price'; |
|
| 278 | - |
|
| 279 | - /** |
|
| 280 | - * The 'priceCurrency' field name. |
|
| 281 | - * |
|
| 282 | - * @since 3.18.0 |
|
| 283 | - */ |
|
| 284 | - const FIELD_PRICE_CURRENCY = 'wl_schema_price_currency'; |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * The 'availabilityStarts' field name. |
|
| 288 | - * |
|
| 289 | - * @since 3.18.0 |
|
| 290 | - */ |
|
| 291 | - const FIELD_AVAILABILITY_STARTS = 'wl_schema_availability_starts'; |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * The 'availabilityEnds' field name. |
|
| 295 | - * |
|
| 296 | - * @since 3.18.0 |
|
| 297 | - */ |
|
| 298 | - const FIELD_AVAILABILITY_ENDS = 'wl_schema_availability_ends'; |
|
| 299 | - |
|
| 300 | - /** |
|
| 301 | - * The 'validFrom' field name. |
|
| 302 | - * |
|
| 303 | - * @since 3.18.0 |
|
| 304 | - */ |
|
| 305 | - const FIELD_VALID_FROM = 'wl_schema_valid_from'; |
|
| 306 | - |
|
| 307 | - /** |
|
| 308 | - * The 'priceValidUntil' field name. |
|
| 309 | - * |
|
| 310 | - * @since 3.18.0 |
|
| 311 | - */ |
|
| 312 | - const FIELD_PRICE_VALID_UNTIL = 'wl_schema_valid_until'; |
|
| 313 | - |
|
| 314 | - /** |
|
| 315 | - * The 'itemOffered' field name. |
|
| 316 | - * |
|
| 317 | - * @since 3.18.0 |
|
| 318 | - */ |
|
| 319 | - const FIELD_ITEM_OFFERED = 'wl_schema_item_offered'; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * The 'URI' data type name. |
|
| 323 | - * |
|
| 324 | - * @since 3.1.0 |
|
| 325 | - */ |
|
| 326 | - const DATA_TYPE_URI = 'uri'; |
|
| 327 | - |
|
| 328 | - /** |
|
| 329 | - * The 'date' data type name. |
|
| 330 | - * |
|
| 331 | - * @since 3.1.0 |
|
| 332 | - */ |
|
| 333 | - const DATA_TYPE_DATE = 'date'; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * The 'dateTime' data type name. |
|
| 337 | - * |
|
| 338 | - * @since 3.15.0 |
|
| 339 | - */ |
|
| 340 | - const DATA_TYPE_DATE_TIME = 'dateTime'; |
|
| 341 | - |
|
| 342 | - /** |
|
| 343 | - * The 'time' data type name. |
|
| 344 | - * |
|
| 345 | - * @since 3.14.0 |
|
| 346 | - */ |
|
| 347 | - const DATA_TYPE_DURATION = 'duration'; |
|
| 348 | - |
|
| 349 | - /** |
|
| 350 | - * The 'double' data type name. |
|
| 351 | - * |
|
| 352 | - * @since 3.1.0 |
|
| 353 | - */ |
|
| 354 | - const DATA_TYPE_DOUBLE = 'double'; |
|
| 355 | - |
|
| 356 | - /** |
|
| 357 | - * The 'string' data type name. |
|
| 358 | - * |
|
| 359 | - * @since 3.1.0 |
|
| 360 | - */ |
|
| 361 | - const DATA_TYPE_STRING = 'string'; |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * The multiline text data type name. |
|
| 365 | - * |
|
| 366 | - * @since 3.14.0 |
|
| 367 | - */ |
|
| 368 | - const DATA_TYPE_MULTILINE = 'multiline'; |
|
| 369 | - |
|
| 370 | - /** |
|
| 371 | - * The 'integer' data type name. |
|
| 372 | - * |
|
| 373 | - * @since 3.1.0 |
|
| 374 | - */ |
|
| 375 | - const DATA_TYPE_INTEGER = 'int'; |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * The 'boolean' data type name. |
|
| 379 | - * |
|
| 380 | - * @since 3.1.0 |
|
| 381 | - */ |
|
| 382 | - const DATA_TYPE_BOOLEAN = 'bool'; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * The schema.org Event type URI. |
|
| 386 | - * |
|
| 387 | - * @since 3.1.0 |
|
| 388 | - */ |
|
| 389 | - const SCHEMA_EVENT_TYPE = 'http://schema.org/Event'; |
|
| 390 | - |
|
| 391 | - /** |
|
| 392 | - * The schema.org Offer type URI. |
|
| 393 | - * |
|
| 394 | - * @since 3.18.0 |
|
| 395 | - */ |
|
| 396 | - const SCHEMA_OFFER_TYPE = 'http://schema.org/Offer'; |
|
| 397 | - |
|
| 398 | - /** |
|
| 399 | - * The Schema service singleton instance. |
|
| 400 | - * |
|
| 401 | - * @since 3.1.0 |
|
| 402 | - * @access private |
|
| 403 | - * @var \Wordlift_Schema_Service $instance The Schema service singleton instance. |
|
| 404 | - */ |
|
| 405 | - private static $instance; |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * WordLift's schema. |
|
| 409 | - * |
|
| 410 | - * @since 3.1.0 |
|
| 411 | - * @access private |
|
| 412 | - * @var array $schema WordLift's schema. |
|
| 413 | - */ |
|
| 414 | - private $schema; |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * The Log service. |
|
| 418 | - * |
|
| 419 | - * @since 3.1.0 |
|
| 420 | - * @access private |
|
| 421 | - * @var \Wordlift_Log_Service $log The Log service. |
|
| 422 | - */ |
|
| 423 | - private $log; |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * The {@link Wordlift_Post_Property_Storage_Factory} instance. |
|
| 427 | - * |
|
| 428 | - * @since 3.15.0 |
|
| 429 | - * @access private |
|
| 430 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Post_Property_Storage_Factory} instance. |
|
| 431 | - */ |
|
| 432 | - private $storage_factory; |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 436 | - * |
|
| 437 | - * @since 3.15.0 |
|
| 438 | - * @access private |
|
| 439 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 440 | - */ |
|
| 441 | - private $rendition_factory; |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * The {@link Wordlift_Configuration_Service} instance. |
|
| 445 | - * |
|
| 446 | - * @since 3.15.0 |
|
| 447 | - * @access private |
|
| 448 | - * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 449 | - */ |
|
| 450 | - private $configuration_service; |
|
| 451 | - |
|
| 452 | - /** |
|
| 453 | - * The web site configured language code. |
|
| 454 | - * |
|
| 455 | - * @since 3.15.0 |
|
| 456 | - * @access private |
|
| 457 | - * @var string $language_code The web site configured language code. |
|
| 458 | - */ |
|
| 459 | - private $language_code; |
|
| 460 | - |
|
| 461 | - /** |
|
| 462 | - * Wordlift_Schema_Service constructor. |
|
| 463 | - * |
|
| 464 | - * @since 3.1.0 |
|
| 465 | - * |
|
| 466 | - * @param \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Post_Property_Storage_Factory} instance. |
|
| 467 | - * @param \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 468 | - * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 469 | - */ |
|
| 470 | - public function __construct( $storage_factory, $rendition_factory, $configuration_service ) { |
|
| 471 | - |
|
| 472 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Schema_Service' ); |
|
| 473 | - |
|
| 474 | - $this->storage_factory = $storage_factory; |
|
| 475 | - $this->rendition_factory = $rendition_factory; |
|
| 476 | - $this->configuration_service = $configuration_service; |
|
| 477 | - $this->language_code = $this->configuration_service->get_language_code(); |
|
| 478 | - |
|
| 479 | - $schemas = array( |
|
| 480 | - 'article' => $this->get_article_schema(), |
|
| 481 | - 'thing' => $this->get_thing_schema(), |
|
| 482 | - 'creative-work' => $this->get_creative_work_schema(), |
|
| 483 | - 'event' => $this->get_event_schema(), |
|
| 484 | - 'organization' => $this->get_organization_schema(), |
|
| 485 | - 'person' => $this->get_person_schema(), |
|
| 486 | - 'place' => $this->get_place_schema(), |
|
| 487 | - 'local-business' => $this->get_local_business_schema(), |
|
| 488 | - 'recipe' => $this->get_recipe_schema(), |
|
| 489 | - 'web-page' => $this->get_web_page_schema(), |
|
| 490 | - 'offer' => $this->get_offer_schema(), |
|
| 491 | - ); |
|
| 492 | - |
|
| 493 | - // Set the taxonomy data. |
|
| 494 | - // Note: parent types must be defined before child types. |
|
| 495 | - /** |
|
| 496 | - * Alter the configured schemas. |
|
| 497 | - * |
|
| 498 | - * Enable 3rd parties to alter WordLift's schemas array. |
|
| 499 | - * |
|
| 500 | - * @since 3.19.1 |
|
| 501 | - * |
|
| 502 | - * @param array $schemas The array of schemas. |
|
| 503 | - */ |
|
| 504 | - $this->schema = apply_filters( 'wl_schemas', $schemas ); |
|
| 505 | - |
|
| 506 | - // Create a singleton instance of the Schema service, useful to provide static functions to global functions. |
|
| 507 | - self::$instance = $this; |
|
| 508 | - |
|
| 509 | - // Hook the `init` to allow plugins to add their schemas. |
|
| 510 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 511 | - |
|
| 512 | - } |
|
| 513 | - |
|
| 514 | - /** |
|
| 515 | - * Hook to the `init`, allow late binding plugins to add their schema. |
|
| 516 | - * |
|
| 517 | - * @since 3.19.2 |
|
| 518 | - */ |
|
| 519 | - public function init() { |
|
| 520 | - |
|
| 521 | - $this->schema = apply_filters( 'wl_schemas_init', $this->schema ); |
|
| 522 | - |
|
| 523 | - } |
|
| 524 | - |
|
| 525 | - /** |
|
| 526 | - * Get a reference to the Schema service. |
|
| 527 | - * |
|
| 528 | - * @since 3.1.0 |
|
| 529 | - * |
|
| 530 | - * @return Wordlift_Schema_Service A reference to the Schema service. |
|
| 531 | - */ |
|
| 532 | - public static function get_instance() { |
|
| 533 | - |
|
| 534 | - return self::$instance; |
|
| 535 | - } |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * Get the properties for a field with the specified key. The key is used as |
|
| 539 | - * meta key when the field's value is stored in WordPress meta data table. |
|
| 540 | - * |
|
| 541 | - * @since 3.6.0 |
|
| 542 | - * |
|
| 543 | - * @param string $key The field's key. |
|
| 544 | - * |
|
| 545 | - * @return null|array An array of field's properties or null if the field is not found. |
|
| 546 | - */ |
|
| 547 | - public function get_field( $key ) { |
|
| 548 | - |
|
| 549 | - // Parse each schema's fields until we find the one we're looking for, then |
|
| 550 | - // return its properties. |
|
| 551 | - foreach ( $this->schema as $_ => $schema ) { |
|
| 552 | - |
|
| 553 | - if ( ! isset( $schema['custom_fields'] ) ) { |
|
| 554 | - break; |
|
| 555 | - } |
|
| 556 | - |
|
| 557 | - foreach ( $schema['custom_fields'] as $field => $props ) { |
|
| 558 | - if ( $key === $field ) { |
|
| 559 | - return $props; |
|
| 560 | - } |
|
| 561 | - } |
|
| 562 | - } |
|
| 563 | - |
|
| 564 | - return null; |
|
| 565 | - } |
|
| 566 | - |
|
| 567 | - /** |
|
| 568 | - * Get all renditions for each WordLift's schema. |
|
| 569 | - * |
|
| 570 | - * @since 3.18.0 |
|
| 571 | - * |
|
| 572 | - * @return array An array with the schema renditions. |
|
| 573 | - */ |
|
| 574 | - public function get_renditions() { |
|
| 575 | - // Get the custom fields. |
|
| 576 | - $renditions = array_reduce( |
|
| 577 | - $this->schema, |
|
| 578 | - function ( $carry, $item ) { |
|
| 579 | - return array_merge( $carry, $item['linked_data'] ); |
|
| 580 | - }, |
|
| 581 | - array() |
|
| 582 | - ); |
|
| 583 | - |
|
| 584 | - // Return the schemas. |
|
| 585 | - return $renditions; |
|
| 586 | - } |
|
| 587 | - |
|
| 588 | - /** |
|
| 589 | - * Get the WordLift's schema. |
|
| 590 | - * |
|
| 591 | - * @param string $name The schema name. |
|
| 592 | - * |
|
| 593 | - * @return array|null An array with the schema configuration or NULL if the schema is not found. |
|
| 594 | - * |
|
| 595 | - * @since 3.1.0 |
|
| 596 | - */ |
|
| 597 | - public function get_schema( $name ) { |
|
| 598 | - // Check if the schema exists and, if not, return NULL. |
|
| 599 | - if ( ! isset( $this->schema[ $name ] ) ) { |
|
| 600 | - return null; |
|
| 601 | - } |
|
| 602 | - |
|
| 603 | - // Return the requested schema. |
|
| 604 | - return $this->schema[ $name ]; |
|
| 605 | - } |
|
| 606 | - |
|
| 607 | - /** |
|
| 608 | - * Get the WordLift's schema trough schema type uri. |
|
| 609 | - * |
|
| 610 | - * @param string $uri The schema uri. |
|
| 611 | - * |
|
| 612 | - * @return array|null An array with the schema configuration or NULL if the schema is not found. |
|
| 613 | - * |
|
| 614 | - * @since 3.3.0 |
|
| 615 | - */ |
|
| 616 | - public function get_schema_by_uri( $uri ) { |
|
| 617 | - |
|
| 618 | - foreach ( $this->schema as $name => $schema ) { |
|
| 619 | - if ( $schema['uri'] === $uri ) { |
|
| 620 | - return $schema; |
|
| 621 | - } |
|
| 622 | - } |
|
| 623 | - |
|
| 624 | - return null; |
|
| 625 | - } |
|
| 626 | - |
|
| 627 | - /** |
|
| 628 | - * Get the 'thing' schema. |
|
| 629 | - * |
|
| 630 | - * @return array An array with the schema configuration. |
|
| 631 | - * |
|
| 632 | - * @since 3.1.0 |
|
| 633 | - */ |
|
| 634 | - private function get_thing_schema() { |
|
| 635 | - |
|
| 636 | - return array( |
|
| 637 | - 'css_class' => 'wl-thing', |
|
| 638 | - 'uri' => 'http://schema.org/Thing', |
|
| 639 | - 'same_as' => array( '*' ), |
|
| 640 | - // set as default. |
|
| 641 | - 'custom_fields' => array( |
|
| 642 | - self::FIELD_SAME_AS => array( |
|
| 643 | - 'predicate' => 'http://schema.org/sameAs', |
|
| 644 | - 'type' => self::DATA_TYPE_URI, |
|
| 645 | - 'export_type' => 'http://schema.org/Thing', |
|
| 646 | - 'constraints' => array( |
|
| 647 | - 'cardinality' => INF, |
|
| 648 | - ), |
|
| 649 | - // We need a custom metabox. |
|
| 650 | - 'input_field' => 'sameas', |
|
| 651 | - ), |
|
| 652 | - // Add the schema:url property. |
|
| 653 | - Wordlift_Schema_Url_Property_Service::META_KEY => Wordlift_Schema_Url_Property_Service::get_instance() |
|
| 654 | - ->get_compat_definition(), |
|
| 655 | - ), |
|
| 656 | - // {{sameAs}} not present in the microdata template, |
|
| 657 | - // because it is treated separately in *wl_content_embed_item_microdata* |
|
| 658 | - 'templates' => array( |
|
| 659 | - 'subtitle' => '{{id}}', |
|
| 660 | - ), |
|
| 661 | - 'linked_data' => array( |
|
| 662 | - // ### Title to rdfs:label. |
|
| 663 | - $this->rendition_factory->create( |
|
| 664 | - $this->storage_factory->post_title(), |
|
| 665 | - Wordlift_Query_Builder::RDFS_LABEL_URI, |
|
| 666 | - null, |
|
| 667 | - $this->language_code |
|
| 668 | - ), |
|
| 669 | - // ### Title to dct:title. |
|
| 670 | - $this->rendition_factory->create( |
|
| 671 | - $this->storage_factory->post_title(), |
|
| 672 | - 'http://purl.org/dc/terms/title', |
|
| 673 | - null, |
|
| 674 | - $this->language_code |
|
| 675 | - ), |
|
| 676 | - // ### Alternative title to rdfs:label. |
|
| 677 | - $this->rendition_factory->create( |
|
| 678 | - $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 679 | - Wordlift_Query_Builder::RDFS_LABEL_URI, |
|
| 680 | - null, |
|
| 681 | - $this->language_code |
|
| 682 | - ), |
|
| 683 | - // ### Alternative title to dct:title. |
|
| 684 | - $this->rendition_factory->create( |
|
| 685 | - $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 686 | - 'http://purl.org/dc/terms/title', |
|
| 687 | - null, |
|
| 688 | - $this->language_code |
|
| 689 | - ), |
|
| 690 | - // ### Title to schema:name. |
|
| 691 | - $this->rendition_factory->create( |
|
| 692 | - $this->storage_factory->post_title(), |
|
| 693 | - 'http://schema.org/name', |
|
| 694 | - null, |
|
| 695 | - $this->language_code |
|
| 696 | - ), |
|
| 697 | - // ### Alternative title to schema:alterName. |
|
| 698 | - $this->rendition_factory->create( |
|
| 699 | - $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 700 | - 'http://schema.org/alternateName', |
|
| 701 | - null, |
|
| 702 | - $this->language_code |
|
| 703 | - ), |
|
| 704 | - // ### schema:url. |
|
| 705 | - $this->rendition_factory->create( |
|
| 706 | - $this->storage_factory->url_property(), |
|
| 707 | - Wordlift_Query_Builder::SCHEMA_URL_URI, |
|
| 708 | - self::DATA_TYPE_URI |
|
| 709 | - ), |
|
| 710 | - // ### schema:description. |
|
| 711 | - $this->rendition_factory->create( |
|
| 712 | - $this->storage_factory->post_description_no_tags_no_shortcodes(), |
|
| 713 | - 'http://schema.org/description', |
|
| 714 | - null, |
|
| 715 | - $this->language_code |
|
| 716 | - ), |
|
| 717 | - // ### owl:sameAs. |
|
| 718 | - $this->rendition_factory->create( |
|
| 719 | - $this->storage_factory->post_meta( self::FIELD_SAME_AS ), |
|
| 720 | - 'http://www.w3.org/2002/07/owl#sameAs', |
|
| 721 | - self::DATA_TYPE_URI |
|
| 722 | - ), |
|
| 723 | - // ### schema:sameAs. |
|
| 724 | - $this->rendition_factory->create( |
|
| 725 | - $this->storage_factory->post_meta( self::FIELD_SAME_AS ), |
|
| 726 | - 'http://schema.org/sameAs', |
|
| 727 | - self::DATA_TYPE_URI |
|
| 728 | - ), |
|
| 729 | - // ### rdf:type. |
|
| 730 | - $this->rendition_factory->create( |
|
| 731 | - $this->storage_factory->schema_class(), |
|
| 732 | - Wordlift_Query_Builder::RDFS_TYPE_URI, |
|
| 733 | - self::DATA_TYPE_URI |
|
| 734 | - ), |
|
| 735 | - // ### schema:image. |
|
| 736 | - $this->rendition_factory->create( |
|
| 737 | - $this->storage_factory->post_images(), |
|
| 738 | - Wordlift_Query_Builder::SCHEMA_IMAGE_URI, |
|
| 739 | - self::DATA_TYPE_URI |
|
| 740 | - ), |
|
| 741 | - // ### dct:relation. |
|
| 742 | - $this->rendition_factory->create( |
|
| 743 | - $this->storage_factory->relations(), |
|
| 744 | - Wordlift_Query_Builder::DCTERMS_RELATION_URI, |
|
| 745 | - self::DATA_TYPE_URI |
|
| 746 | - ), |
|
| 747 | - ), |
|
| 748 | - ); |
|
| 749 | - |
|
| 750 | - } |
|
| 751 | - |
|
| 752 | - /** |
|
| 753 | - * Get the 'web-page' schema. |
|
| 754 | - * |
|
| 755 | - * @return array An array with the schema configuration. |
|
| 756 | - * |
|
| 757 | - * @since 3.18.0 |
|
| 758 | - */ |
|
| 759 | - private function get_web_page_schema() { |
|
| 760 | - |
|
| 761 | - return array( |
|
| 762 | - 'css_class' => 'wl-webpage', |
|
| 763 | - 'uri' => 'http://schema.org/WebPage', |
|
| 764 | - 'linked_data' => array( |
|
| 765 | - // ### schema:headline. |
|
| 766 | - $this->rendition_factory->create( |
|
| 767 | - $this->storage_factory->post_title(), |
|
| 768 | - 'http://schema.org/headline', |
|
| 769 | - null, |
|
| 770 | - $this->language_code |
|
| 771 | - ), |
|
| 772 | - // ### schema:url. |
|
| 773 | - $this->rendition_factory->create( |
|
| 774 | - $this->storage_factory->url_property(), |
|
| 775 | - Wordlift_Query_Builder::SCHEMA_URL_URI, |
|
| 776 | - self::DATA_TYPE_URI |
|
| 777 | - ), |
|
| 778 | - // ### rdf:type. |
|
| 779 | - $this->rendition_factory->create( |
|
| 780 | - $this->storage_factory->schema_class(), |
|
| 781 | - Wordlift_Query_Builder::RDFS_TYPE_URI, |
|
| 782 | - self::DATA_TYPE_URI |
|
| 783 | - ), |
|
| 784 | - // ### dcterms:references. |
|
| 785 | - $this->rendition_factory->create( |
|
| 786 | - $this->storage_factory->relations(), |
|
| 787 | - Wordlift_Query_Builder::DCTERMS_REFERENCES_URI, |
|
| 788 | - self::DATA_TYPE_URI, |
|
| 789 | - $this->language_code |
|
| 790 | - ), |
|
| 791 | - ), |
|
| 792 | - ); |
|
| 793 | - |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - /** |
|
| 797 | - * Get the 'creative work' schema. |
|
| 798 | - * |
|
| 799 | - * @return array An array with the schema configuration. |
|
| 800 | - * |
|
| 801 | - * @since 3.1.0 |
|
| 802 | - */ |
|
| 803 | - private function get_creative_work_schema() { |
|
| 804 | - |
|
| 805 | - $schema = array( |
|
| 806 | - 'label' => 'CreativeWork', |
|
| 807 | - 'description' => 'A creative work (or a Music Album).', |
|
| 808 | - 'parents' => array( 'thing' ), |
|
| 809 | - // Give term slug as parent. |
|
| 810 | - 'css_class' => 'wl-creative-work', |
|
| 811 | - 'uri' => 'http://schema.org/CreativeWork', |
|
| 812 | - 'same_as' => array( |
|
| 813 | - 'http://schema.org/MusicAlbum', |
|
| 814 | - 'http://schema.org/Product', |
|
| 815 | - ), |
|
| 816 | - 'custom_fields' => array( |
|
| 817 | - self::FIELD_AUTHOR => array( |
|
| 818 | - 'predicate' => 'http://schema.org/author', |
|
| 819 | - 'type' => self::DATA_TYPE_URI, |
|
| 820 | - 'export_type' => 'http://schema.org/Person', |
|
| 821 | - 'constraints' => array( |
|
| 822 | - 'uri_type' => array( 'Person', 'Organization' ), |
|
| 823 | - 'cardinality' => INF, |
|
| 824 | - ), |
|
| 825 | - ), |
|
| 826 | - ), |
|
| 827 | - 'linked_data' => array( |
|
| 828 | - // ### schema:author. |
|
| 829 | - $this->rendition_factory->create( |
|
| 830 | - $this->storage_factory->author_uri(), |
|
| 831 | - Wordlift_Query_Builder::SCHEMA_AUTHOR_URI, |
|
| 832 | - self::DATA_TYPE_URI |
|
| 833 | - ), |
|
| 834 | - ), |
|
| 835 | - 'templates' => array( |
|
| 836 | - 'subtitle' => '{{id}}', |
|
| 837 | - ), |
|
| 838 | - ); |
|
| 839 | - |
|
| 840 | - // Merge the custom fields with those provided by the thing schema. |
|
| 841 | - $parent_schema = $this->get_thing_schema(); |
|
| 842 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 843 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 844 | - |
|
| 845 | - return $schema; |
|
| 846 | - } |
|
| 847 | - |
|
| 848 | - /** |
|
| 849 | - * Get the 'event' schema. |
|
| 850 | - * |
|
| 851 | - * @return array An array with the schema configuration. |
|
| 852 | - * |
|
| 853 | - * @since 3.1.0 |
|
| 854 | - */ |
|
| 855 | - private function get_event_schema() { |
|
| 856 | - |
|
| 857 | - $schema = array( |
|
| 858 | - 'label' => 'Event', |
|
| 859 | - 'description' => 'An event . ', |
|
| 860 | - 'parents' => array( 'thing' ), |
|
| 861 | - 'css_class' => 'wl-event', |
|
| 862 | - 'uri' => self::SCHEMA_EVENT_TYPE, |
|
| 863 | - 'same_as' => array( 'http://dbpedia.org/ontology/Event' ), |
|
| 864 | - 'custom_fields' => array( |
|
| 865 | - self::FIELD_DATE_START => array( |
|
| 866 | - 'predicate' => 'http://schema.org/startDate', |
|
| 867 | - 'type' => self::DATA_TYPE_DATE, |
|
| 868 | - 'export_type' => 'xsd:dateTime', |
|
| 869 | - 'constraints' => '', |
|
| 870 | - ), |
|
| 871 | - self::FIELD_DATE_END => array( |
|
| 872 | - 'predicate' => 'http://schema.org/endDate', |
|
| 873 | - 'type' => self::DATA_TYPE_DATE, |
|
| 874 | - 'export_type' => 'xsd:dateTime', |
|
| 875 | - 'constraints' => '', |
|
| 876 | - ), |
|
| 877 | - self::FIELD_LOCATION => array( |
|
| 878 | - 'predicate' => 'http://schema.org/location', |
|
| 879 | - 'type' => self::DATA_TYPE_URI, |
|
| 880 | - 'export_type' => 'http://schema.org/PostalAddress', |
|
| 881 | - 'constraints' => array( |
|
| 882 | - 'uri_type' => array( 'Place', 'LocalBusiness' ), |
|
| 883 | - 'cardinality' => INF, |
|
| 884 | - ), |
|
| 885 | - ), |
|
| 886 | - self::FIELD_PERFORMER => array( |
|
| 887 | - 'predicate' => 'http://schema.org/performer', |
|
| 888 | - 'type' => self::DATA_TYPE_URI, |
|
| 889 | - 'export_type' => 'http://schema.org/Person', |
|
| 890 | - 'constraints' => array( |
|
| 891 | - 'uri_type' => array( 'Person', 'Organization' ), |
|
| 892 | - 'cardinality' => INF, |
|
| 893 | - ), |
|
| 894 | - ), |
|
| 895 | - self::FIELD_OFFERS => array( |
|
| 896 | - 'predicate' => 'http://schema.org/offers', |
|
| 897 | - 'type' => self::DATA_TYPE_URI, |
|
| 898 | - 'export_type' => 'http://schema.org/Offer', |
|
| 899 | - 'constraints' => array( |
|
| 900 | - 'uri_type' => array( 'Offer' ), |
|
| 901 | - 'cardinality' => INF, |
|
| 902 | - ), |
|
| 903 | - ), |
|
| 904 | - ), |
|
| 905 | - 'linked_data' => array( |
|
| 906 | - // ### schema:startDate. |
|
| 907 | - $this->rendition_factory->create( |
|
| 908 | - $this->storage_factory->post_meta( self::FIELD_DATE_START ), |
|
| 909 | - 'http://schema.org/startDate', |
|
| 910 | - self::DATA_TYPE_DATE_TIME |
|
| 911 | - ), |
|
| 912 | - // ### schema:endDate. |
|
| 913 | - $this->rendition_factory->create( |
|
| 914 | - $this->storage_factory->post_meta( self::FIELD_DATE_END ), |
|
| 915 | - 'http://schema.org/endDate', |
|
| 916 | - self::DATA_TYPE_DATE_TIME |
|
| 917 | - ), |
|
| 918 | - // ### schema:location. |
|
| 919 | - $this->rendition_factory->create( |
|
| 920 | - $this->storage_factory->post_meta_to_uri( self::FIELD_LOCATION ), |
|
| 921 | - 'http://schema.org/location', |
|
| 922 | - self::DATA_TYPE_URI |
|
| 923 | - ), |
|
| 924 | - // ### schema:performer. |
|
| 925 | - $this->rendition_factory->create( |
|
| 926 | - $this->storage_factory->post_meta_to_uri( self::FIELD_PERFORMER ), |
|
| 927 | - 'http://schema.org/performer', |
|
| 928 | - self::DATA_TYPE_URI |
|
| 929 | - ), |
|
| 930 | - // ### schema:offers. |
|
| 931 | - $this->rendition_factory->create( |
|
| 932 | - $this->storage_factory->post_meta_to_uri( self::FIELD_OFFERS ), |
|
| 933 | - 'http://schema.org/offers', |
|
| 934 | - self::DATA_TYPE_URI |
|
| 935 | - ), |
|
| 936 | - ), |
|
| 937 | - 'templates' => array( |
|
| 938 | - 'subtitle' => '{{id}}', |
|
| 939 | - ), |
|
| 940 | - ); |
|
| 941 | - |
|
| 942 | - // Merge the custom fields with those provided by the thing schema. |
|
| 943 | - $parent_schema = $this->get_thing_schema(); |
|
| 944 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 945 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 946 | - |
|
| 947 | - return $schema; |
|
| 948 | - } |
|
| 949 | - |
|
| 950 | - /** |
|
| 951 | - * Get the 'organization' schema. |
|
| 952 | - * |
|
| 953 | - * @return array An array with the schema configuration. |
|
| 954 | - * |
|
| 955 | - * @since 3.1.0 |
|
| 956 | - */ |
|
| 957 | - private function get_organization_schema() { |
|
| 958 | - |
|
| 959 | - $schema = array( |
|
| 960 | - 'label' => 'Organization', |
|
| 961 | - 'description' => 'An organization, including a government or a newspaper.', |
|
| 962 | - 'parents' => array( 'thing' ), |
|
| 963 | - 'css_class' => 'wl-organization', |
|
| 964 | - 'uri' => 'http://schema.org/Organization', |
|
| 965 | - 'same_as' => array( |
|
| 966 | - 'http://rdf.freebase.com/ns/organization.organization', |
|
| 967 | - 'http://rdf.freebase.com/ns/government.government', |
|
| 968 | - 'http://schema.org/Newspaper', |
|
| 969 | - ), |
|
| 970 | - 'custom_fields' => array( |
|
| 971 | - self::FIELD_LEGAL_NAME => array( |
|
| 972 | - 'predicate' => 'http://schema.org/legalName', |
|
| 973 | - 'type' => self::DATA_TYPE_STRING, |
|
| 974 | - 'export_type' => 'xsd:string', |
|
| 975 | - 'constraints' => '', |
|
| 976 | - ), |
|
| 977 | - self::FIELD_FOUNDER => array( |
|
| 978 | - 'predicate' => 'http://schema.org/founder', |
|
| 979 | - 'type' => self::DATA_TYPE_URI, |
|
| 980 | - 'export_type' => 'http://schema.org/Person', |
|
| 981 | - 'constraints' => array( |
|
| 982 | - 'uri_type' => 'Person', |
|
| 983 | - 'cardinality' => INF, |
|
| 984 | - ), |
|
| 985 | - ), |
|
| 986 | - self::FIELD_ADDRESS => array( |
|
| 987 | - 'predicate' => 'http://schema.org/streetAddress', |
|
| 988 | - 'type' => self::DATA_TYPE_STRING, |
|
| 989 | - 'export_type' => 'xsd:string', |
|
| 990 | - 'constraints' => '', |
|
| 991 | - // To build custom metabox. |
|
| 992 | - 'input_field' => 'address', |
|
| 993 | - ), |
|
| 994 | - self::FIELD_ADDRESS_PO_BOX => array( |
|
| 995 | - 'predicate' => 'http://schema.org/postOfficeBoxNumber', |
|
| 996 | - 'type' => self::DATA_TYPE_STRING, |
|
| 997 | - 'export_type' => 'xsd:string', |
|
| 998 | - 'constraints' => '', |
|
| 999 | - // To build custom metabox. |
|
| 1000 | - 'input_field' => 'address', |
|
| 1001 | - ), |
|
| 1002 | - self::FIELD_ADDRESS_POSTAL_CODE => array( |
|
| 1003 | - 'predicate' => 'http://schema.org/postalCode', |
|
| 1004 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1005 | - 'export_type' => 'xsd:string', |
|
| 1006 | - 'constraints' => '', |
|
| 1007 | - // To build custom metabox. |
|
| 1008 | - 'input_field' => 'address', |
|
| 1009 | - ), |
|
| 1010 | - self::FIELD_ADDRESS_LOCALITY => array( |
|
| 1011 | - 'predicate' => 'http://schema.org/addressLocality', |
|
| 1012 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1013 | - 'export_type' => 'xsd:string', |
|
| 1014 | - 'constraints' => '', |
|
| 1015 | - // To build custom metabox. |
|
| 1016 | - 'input_field' => 'address', |
|
| 1017 | - ), |
|
| 1018 | - self::FIELD_ADDRESS_REGION => array( |
|
| 1019 | - 'predicate' => 'http://schema.org/addressRegion', |
|
| 1020 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1021 | - 'export_type' => 'xsd:string', |
|
| 1022 | - 'constraints' => '', |
|
| 1023 | - // To build custom metabox. |
|
| 1024 | - 'input_field' => 'address', |
|
| 1025 | - ), |
|
| 1026 | - self::FIELD_ADDRESS_COUNTRY => array( |
|
| 1027 | - 'predicate' => 'http://schema.org/addressCountry', |
|
| 1028 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1029 | - 'export_type' => 'xsd:string', |
|
| 1030 | - 'constraints' => '', |
|
| 1031 | - // To build custom metabox. |
|
| 1032 | - 'input_field' => 'address', |
|
| 1033 | - ), |
|
| 1034 | - self::FIELD_EMAIL => array( |
|
| 1035 | - 'predicate' => 'http://schema.org/email', |
|
| 1036 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1037 | - 'export_type' => 'xsd:string', |
|
| 1038 | - 'constraints' => '', |
|
| 1039 | - ), |
|
| 1040 | - self::FIELD_TELEPHONE => array( |
|
| 1041 | - 'predicate' => 'http://schema.org/telephone', |
|
| 1042 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1043 | - 'export_type' => 'xsd:string', |
|
| 1044 | - 'constraints' => '', |
|
| 1045 | - ), |
|
| 1046 | - ), |
|
| 1047 | - 'linked_data' => array( |
|
| 1048 | - // ### schema:legalName. |
|
| 1049 | - $this->rendition_factory->create( |
|
| 1050 | - $this->storage_factory->post_meta( self::FIELD_LEGAL_NAME ), |
|
| 1051 | - 'http://schema.org/legalName' |
|
| 1052 | - ), |
|
| 1053 | - // ### schema:founder. |
|
| 1054 | - $this->rendition_factory->create( |
|
| 1055 | - $this->storage_factory->post_meta_to_uri( self::FIELD_FOUNDER ), |
|
| 1056 | - 'http://schema.org/founder', |
|
| 1057 | - self::DATA_TYPE_URI |
|
| 1058 | - ), |
|
| 1059 | - // ### schema:email. |
|
| 1060 | - $this->rendition_factory->create( |
|
| 1061 | - $this->storage_factory->post_meta( self::FIELD_EMAIL ), |
|
| 1062 | - 'http://schema.org/email' |
|
| 1063 | - ), |
|
| 1064 | - // ### schema:telephone. |
|
| 1065 | - $this->rendition_factory->create( |
|
| 1066 | - $this->storage_factory->post_meta( self::FIELD_TELEPHONE ), |
|
| 1067 | - 'http://schema.org/telephone' |
|
| 1068 | - ), |
|
| 1069 | - ), |
|
| 1070 | - 'templates' => array( |
|
| 1071 | - 'subtitle' => '{{id}}', |
|
| 1072 | - ), |
|
| 1073 | - ); |
|
| 1074 | - |
|
| 1075 | - // Merge the custom fields with those provided by the thing schema. |
|
| 1076 | - $parent_schema = $this->get_thing_schema(); |
|
| 1077 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1078 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1079 | - |
|
| 1080 | - return $schema; |
|
| 1081 | - } |
|
| 1082 | - |
|
| 1083 | - /** |
|
| 1084 | - * Get the 'person' schema. |
|
| 1085 | - * |
|
| 1086 | - * @return array An array with the schema configuration. |
|
| 1087 | - * |
|
| 1088 | - * @since 3.1.0 |
|
| 1089 | - */ |
|
| 1090 | - private function get_person_schema() { |
|
| 1091 | - |
|
| 1092 | - $schema = array( |
|
| 1093 | - 'label' => 'Person', |
|
| 1094 | - 'description' => 'A person (or a music artist).', |
|
| 1095 | - 'parents' => array( 'thing' ), |
|
| 1096 | - 'css_class' => 'wl-person', |
|
| 1097 | - 'uri' => 'http://schema.org/Person', |
|
| 1098 | - 'same_as' => array( |
|
| 1099 | - 'http://rdf.freebase.com/ns/people.person', |
|
| 1100 | - 'http://rdf.freebase.com/ns/music.artist', |
|
| 1101 | - 'http://dbpedia.org/class/yago/LivingPeople', |
|
| 1102 | - ), |
|
| 1103 | - 'custom_fields' => array( |
|
| 1104 | - self::FIELD_KNOWS => array( |
|
| 1105 | - 'predicate' => 'http://schema.org/knows', |
|
| 1106 | - 'type' => self::DATA_TYPE_URI, |
|
| 1107 | - 'export_type' => 'http://schema.org/Person', |
|
| 1108 | - 'constraints' => array( |
|
| 1109 | - 'uri_type' => 'Person', |
|
| 1110 | - 'cardinality' => INF, |
|
| 1111 | - ), |
|
| 1112 | - ), |
|
| 1113 | - self::FIELD_BIRTH_DATE => array( |
|
| 1114 | - 'predicate' => 'http://schema.org/birthDate', |
|
| 1115 | - 'type' => self::DATA_TYPE_DATE, |
|
| 1116 | - 'export_type' => 'xsd:date', |
|
| 1117 | - 'constraints' => '', |
|
| 1118 | - ), |
|
| 1119 | - self::FIELD_BIRTH_PLACE => array( |
|
| 1120 | - 'predicate' => 'http://schema.org/birthPlace', |
|
| 1121 | - 'type' => self::DATA_TYPE_URI, |
|
| 1122 | - 'export_type' => 'http://schema.org/Place', |
|
| 1123 | - 'constraints' => array( |
|
| 1124 | - 'uri_type' => 'Place', |
|
| 1125 | - ), |
|
| 1126 | - ), |
|
| 1127 | - self::FIELD_AFFILIATION => array( |
|
| 1128 | - 'predicate' => 'http://schema.org/affiliation', |
|
| 1129 | - 'type' => self::DATA_TYPE_URI, |
|
| 1130 | - 'export_type' => 'http://schema.org/Organization', |
|
| 1131 | - 'constraints' => array( |
|
| 1132 | - 'uri_type' => array( |
|
| 1133 | - 'Organization', |
|
| 1134 | - 'LocalBusiness', |
|
| 1135 | - ), |
|
| 1136 | - 'cardinality' => INF, |
|
| 1137 | - ), |
|
| 1138 | - ), |
|
| 1139 | - self::FIELD_EMAIL => array( |
|
| 1140 | - 'predicate' => 'http://schema.org/email', |
|
| 1141 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1142 | - 'export_type' => 'xsd:string', |
|
| 1143 | - 'constraints' => array( |
|
| 1144 | - 'cardinality' => INF, |
|
| 1145 | - ), |
|
| 1146 | - ), |
|
| 1147 | - ), |
|
| 1148 | - 'linked_data' => array( |
|
| 1149 | - // ### schema:knows. |
|
| 1150 | - $this->rendition_factory->create( |
|
| 1151 | - $this->storage_factory->post_meta_to_uri( self::FIELD_KNOWS ), |
|
| 1152 | - 'http://schema.org/knows', |
|
| 1153 | - self::DATA_TYPE_URI |
|
| 1154 | - ), |
|
| 1155 | - // ### schema:birthDate. |
|
| 1156 | - $this->rendition_factory->create( |
|
| 1157 | - $this->storage_factory->post_meta( self::FIELD_BIRTH_DATE ), |
|
| 1158 | - 'http://schema.org/birthDate', |
|
| 1159 | - self::DATA_TYPE_DATE |
|
| 1160 | - ), |
|
| 1161 | - // ### schema:birthPlace. |
|
| 1162 | - $this->rendition_factory->create( |
|
| 1163 | - $this->storage_factory->post_meta_to_uri( self::FIELD_BIRTH_PLACE ), |
|
| 1164 | - 'http://schema.org/birthPlace', |
|
| 1165 | - self::DATA_TYPE_URI |
|
| 1166 | - ), |
|
| 1167 | - // ### schema:affiliation. |
|
| 1168 | - $this->rendition_factory->create( |
|
| 1169 | - $this->storage_factory->post_meta_to_uri( self::FIELD_AFFILIATION ), |
|
| 1170 | - 'http://schema.org/affiliation', |
|
| 1171 | - self::DATA_TYPE_URI |
|
| 1172 | - ), |
|
| 1173 | - // ### schema:email. |
|
| 1174 | - $this->rendition_factory->create( |
|
| 1175 | - $this->storage_factory->post_meta( self::FIELD_EMAIL ), |
|
| 1176 | - 'http://schema.org/email' |
|
| 1177 | - ), |
|
| 1178 | - ), |
|
| 1179 | - 'templates' => array( |
|
| 1180 | - 'subtitle' => '{{id}}', |
|
| 1181 | - ), |
|
| 1182 | - ); |
|
| 1183 | - |
|
| 1184 | - // Merge the custom fields with those provided by the thing schema. |
|
| 1185 | - $parent_schema = $this->get_thing_schema(); |
|
| 1186 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1187 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1188 | - |
|
| 1189 | - return $schema; |
|
| 1190 | - |
|
| 1191 | - } |
|
| 1192 | - |
|
| 1193 | - /** |
|
| 1194 | - * Get the 'place' schema. |
|
| 1195 | - * |
|
| 1196 | - * @return array An array with the schema configuration. |
|
| 1197 | - * |
|
| 1198 | - * @since 3.1.0 |
|
| 1199 | - */ |
|
| 1200 | - private function get_place_schema() { |
|
| 1201 | - |
|
| 1202 | - $schema = array( |
|
| 1203 | - 'label' => 'Place', |
|
| 1204 | - 'description' => 'A place.', |
|
| 1205 | - 'parents' => array( 'thing' ), |
|
| 1206 | - 'css_class' => 'wl-place', |
|
| 1207 | - 'uri' => 'http://schema.org/Place', |
|
| 1208 | - 'same_as' => array( |
|
| 1209 | - 'http://rdf.freebase.com/ns/location.location', |
|
| 1210 | - 'http://www.opengis.net/gml/_Feature', |
|
| 1211 | - ), |
|
| 1212 | - 'custom_fields' => array( |
|
| 1213 | - self::FIELD_GEO_LATITUDE => array( |
|
| 1214 | - 'predicate' => 'http://schema.org/latitude', |
|
| 1215 | - 'type' => self::DATA_TYPE_DOUBLE, |
|
| 1216 | - 'export_type' => 'xsd:double', |
|
| 1217 | - 'constraints' => '', |
|
| 1218 | - // To build custom metabox. |
|
| 1219 | - 'input_field' => 'coordinates', |
|
| 1220 | - ), |
|
| 1221 | - self::FIELD_GEO_LONGITUDE => array( |
|
| 1222 | - 'predicate' => 'http://schema.org/longitude', |
|
| 1223 | - 'type' => self::DATA_TYPE_DOUBLE, |
|
| 1224 | - 'export_type' => 'xsd:double', |
|
| 1225 | - 'constraints' => '', |
|
| 1226 | - // To build custom metabox. |
|
| 1227 | - 'input_field' => 'coordinates', |
|
| 1228 | - ), |
|
| 1229 | - self::FIELD_ADDRESS => array( |
|
| 1230 | - 'predicate' => 'http://schema.org/streetAddress', |
|
| 1231 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1232 | - 'export_type' => 'xsd:string', |
|
| 1233 | - 'constraints' => '', |
|
| 1234 | - // To build custom metabox. |
|
| 1235 | - 'input_field' => 'address', |
|
| 1236 | - ), |
|
| 1237 | - self::FIELD_ADDRESS_PO_BOX => array( |
|
| 1238 | - 'predicate' => 'http://schema.org/postOfficeBoxNumber', |
|
| 1239 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1240 | - 'export_type' => 'xsd:string', |
|
| 1241 | - 'constraints' => '', |
|
| 1242 | - // To build custom metabox. |
|
| 1243 | - 'input_field' => 'address', |
|
| 1244 | - ), |
|
| 1245 | - self::FIELD_ADDRESS_POSTAL_CODE => array( |
|
| 1246 | - 'predicate' => 'http://schema.org/postalCode', |
|
| 1247 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1248 | - 'export_type' => 'xsd:string', |
|
| 1249 | - 'constraints' => '', |
|
| 1250 | - // To build custom metabox. |
|
| 1251 | - 'input_field' => 'address', |
|
| 1252 | - ), |
|
| 1253 | - self::FIELD_ADDRESS_LOCALITY => array( |
|
| 1254 | - 'predicate' => 'http://schema.org/addressLocality', |
|
| 1255 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1256 | - 'export_type' => 'xsd:string', |
|
| 1257 | - 'constraints' => '', |
|
| 1258 | - // To build custom metabox. |
|
| 1259 | - 'input_field' => 'address', |
|
| 1260 | - ), |
|
| 1261 | - self::FIELD_ADDRESS_REGION => array( |
|
| 1262 | - 'predicate' => 'http://schema.org/addressRegion', |
|
| 1263 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1264 | - 'export_type' => 'xsd:string', |
|
| 1265 | - 'constraints' => '', |
|
| 1266 | - // To build custom metabox. |
|
| 1267 | - 'input_field' => 'address', |
|
| 1268 | - ), |
|
| 1269 | - self::FIELD_ADDRESS_COUNTRY => array( |
|
| 1270 | - 'predicate' => 'http://schema.org/addressCountry', |
|
| 1271 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1272 | - 'export_type' => 'xsd:string', |
|
| 1273 | - 'constraints' => '', |
|
| 1274 | - // To build custom metabox. |
|
| 1275 | - 'input_field' => 'address', |
|
| 1276 | - ), |
|
| 1277 | - ), |
|
| 1278 | - 'linked_data' => array( |
|
| 1279 | - $this->rendition_factory->create_address( |
|
| 1280 | - $this->storage_factory, |
|
| 1281 | - $this->language_code |
|
| 1282 | - ), |
|
| 1283 | - ), |
|
| 1284 | - 'templates' => array( |
|
| 1285 | - 'subtitle' => '{{id}}', |
|
| 1286 | - ), |
|
| 1287 | - ); |
|
| 1288 | - |
|
| 1289 | - // Merge the custom fields with those provided by the thing schema. |
|
| 1290 | - $parent_schema = $this->get_thing_schema(); |
|
| 1291 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1292 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1293 | - |
|
| 1294 | - return $schema; |
|
| 1295 | - } |
|
| 1296 | - |
|
| 1297 | - /** |
|
| 1298 | - * Get the 'local business' schema. |
|
| 1299 | - * |
|
| 1300 | - * @return array An array with the schema configuration. |
|
| 1301 | - * |
|
| 1302 | - * @since 3.1.0 |
|
| 1303 | - */ |
|
| 1304 | - private function get_local_business_schema() { |
|
| 1305 | - |
|
| 1306 | - $schema = array( |
|
| 1307 | - 'label' => 'LocalBusiness', |
|
| 1308 | - 'description' => 'A local business.', |
|
| 1309 | - 'parents' => array( 'place', 'organization' ), |
|
| 1310 | - 'css_class' => 'wl-local-business', |
|
| 1311 | - 'uri' => 'http://schema.org/LocalBusiness', |
|
| 1312 | - 'same_as' => array( |
|
| 1313 | - 'http://rdf.freebase.com/ns/business/business_location', |
|
| 1314 | - 'https://schema.org/Store', |
|
| 1315 | - ), |
|
| 1316 | - 'custom_fields' => array(), |
|
| 1317 | - 'linked_data' => array(), |
|
| 1318 | - 'templates' => array( |
|
| 1319 | - 'subtitle' => '{{id}}', |
|
| 1320 | - ), |
|
| 1321 | - ); |
|
| 1322 | - |
|
| 1323 | - // Merge the custom fields with those provided by the place and organization schema. |
|
| 1324 | - $place_schema = $this->get_place_schema(); |
|
| 1325 | - $organization_schema = $this->get_organization_schema(); |
|
| 1326 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $place_schema['custom_fields'], $organization_schema['custom_fields'] ); |
|
| 1327 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $place_schema['linked_data'], $organization_schema['linked_data'] ); |
|
| 1328 | - |
|
| 1329 | - return $schema; |
|
| 1330 | - } |
|
| 1331 | - |
|
| 1332 | - /** |
|
| 1333 | - * Get the 'recipe' schema. |
|
| 1334 | - * |
|
| 1335 | - * @return array An array with the schema configuration. |
|
| 1336 | - * |
|
| 1337 | - * @since 3.14.0 |
|
| 1338 | - */ |
|
| 1339 | - private function get_recipe_schema() { |
|
| 1340 | - |
|
| 1341 | - $schema = array( |
|
| 1342 | - 'label' => 'Recipe', |
|
| 1343 | - 'description' => 'A Recipe.', |
|
| 1344 | - 'parents' => array( 'CreativeWork' ), |
|
| 1345 | - 'css_class' => 'wl-recipe', |
|
| 1346 | - 'uri' => 'http://schema.org/Recipe', |
|
| 1347 | - 'same_as' => array(), |
|
| 1348 | - 'templates' => array( |
|
| 1349 | - 'subtitle' => '{{id}}', |
|
| 1350 | - ), |
|
| 1351 | - 'custom_fields' => array( |
|
| 1352 | - self::FIELD_RECIPE_CUISINE => array( |
|
| 1353 | - 'predicate' => 'http://schema.org/recipeCuisine', |
|
| 1354 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1355 | - 'export_type' => 'xsd:string', |
|
| 1356 | - 'constraints' => '', |
|
| 1357 | - 'metabox' => array( |
|
| 1358 | - 'label' => __( 'Recipe cuisine', 'wordlift' ), |
|
| 1359 | - ), |
|
| 1360 | - ), |
|
| 1361 | - self::FIELD_RECIPE_INGREDIENT => array( |
|
| 1362 | - 'predicate' => 'http://schema.org/recipeIngredient', |
|
| 1363 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1364 | - 'export_type' => 'xsd:string', |
|
| 1365 | - 'constraints' => array( |
|
| 1366 | - 'cardinality' => INF, |
|
| 1367 | - ), |
|
| 1368 | - 'metabox' => array( |
|
| 1369 | - 'label' => __( 'Recipe ingredient', 'wordlift' ), |
|
| 1370 | - ), |
|
| 1371 | - ), |
|
| 1372 | - self::FIELD_RECIPE_INSTRUCTIONS => array( |
|
| 1373 | - 'predicate' => 'http://schema.org/recipeInstructions', |
|
| 1374 | - 'type' => self::DATA_TYPE_MULTILINE, |
|
| 1375 | - 'export_type' => 'xsd:string', |
|
| 1376 | - 'constraints' => '', |
|
| 1377 | - 'metabox' => array( |
|
| 1378 | - 'class' => 'Wordlift_Metabox_Field_Multiline', |
|
| 1379 | - 'label' => __( 'Recipe instructions', 'wordlift' ), |
|
| 1380 | - ), |
|
| 1381 | - ), |
|
| 1382 | - self::FIELD_RECIPE_YIELD => array( |
|
| 1383 | - 'predicate' => 'http://schema.org/recipeYield', |
|
| 1384 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1385 | - 'export_type' => 'xsd:string', |
|
| 1386 | - 'constraints' => '', |
|
| 1387 | - 'metabox' => array( |
|
| 1388 | - 'label' => __( 'Recipe number of servings', 'wordlift' ), |
|
| 1389 | - ), |
|
| 1390 | - ), |
|
| 1391 | - self::FIELD_RECIPE_INGREDIENT => array( |
|
| 1392 | - 'predicate' => 'http://schema.org/recipeIngredient', |
|
| 1393 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1394 | - 'export_type' => 'xsd:string', |
|
| 1395 | - 'constraints' => array( |
|
| 1396 | - 'cardinality' => INF, |
|
| 1397 | - ), |
|
| 1398 | - 'metabox' => array( |
|
| 1399 | - 'label' => __( 'Recipe ingredient', 'wordlift' ), |
|
| 1400 | - ), |
|
| 1401 | - ), |
|
| 1402 | - self::FIELD_NUTRITION_INFO_CALORIES => array( |
|
| 1403 | - 'predicate' => 'http://schema.org/calories', |
|
| 1404 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1405 | - 'export_type' => 'xsd:string', |
|
| 1406 | - 'constraints' => '', |
|
| 1407 | - 'metabox' => array( |
|
| 1408 | - 'label' => __( 'Calories (e.g. 240 calories)', 'wordlift' ), |
|
| 1409 | - ), |
|
| 1410 | - ), |
|
| 1411 | - self::FIELD_PREP_TIME => array( |
|
| 1412 | - 'predicate' => 'http://schema.org/prepTime', |
|
| 1413 | - 'type' => self::DATA_TYPE_DURATION, |
|
| 1414 | - 'export_type' => 'xsd:time', |
|
| 1415 | - 'constraints' => '', |
|
| 1416 | - 'metabox' => array( |
|
| 1417 | - 'class' => 'Wordlift_Metabox_Field_Duration', |
|
| 1418 | - 'label' => __( 'Recipe preparation time (e.g. 1:30)', 'wordlift' ), |
|
| 1419 | - ), |
|
| 1420 | - ), |
|
| 1421 | - self::FIELD_COOK_TIME => array( |
|
| 1422 | - 'predicate' => 'http://schema.org/cookTime', |
|
| 1423 | - 'type' => self::DATA_TYPE_DURATION, |
|
| 1424 | - 'export_type' => 'xsd:time', |
|
| 1425 | - 'constraints' => '', |
|
| 1426 | - 'metabox' => array( |
|
| 1427 | - 'class' => 'Wordlift_Metabox_Field_Duration', |
|
| 1428 | - 'label' => __( 'Recipe cook time (e.g. 1:30)', 'wordlift' ), |
|
| 1429 | - ), |
|
| 1430 | - ), |
|
| 1431 | - self::FIELD_TOTAL_TIME => array( |
|
| 1432 | - 'predicate' => 'http://schema.org/totalTime', |
|
| 1433 | - 'type' => self::DATA_TYPE_DURATION, |
|
| 1434 | - 'export_type' => 'xsd:time', |
|
| 1435 | - 'constraints' => '', |
|
| 1436 | - 'metabox' => array( |
|
| 1437 | - 'class' => 'Wordlift_Metabox_Field_Duration', |
|
| 1438 | - 'label' => __( 'Recipe total time (e.g. 1:30)', 'wordlift' ), |
|
| 1439 | - ), |
|
| 1440 | - ), |
|
| 1441 | - ), |
|
| 1442 | - 'linked_data' => array( |
|
| 1443 | - // ### schema:recipeCuisine. |
|
| 1444 | - $this->rendition_factory->create( |
|
| 1445 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_CUISINE ), |
|
| 1446 | - 'http://schema.org/recipeCuisine' |
|
| 1447 | - ), |
|
| 1448 | - // ### schema:recipeIngredient. |
|
| 1449 | - $this->rendition_factory->create( |
|
| 1450 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_INGREDIENT ), |
|
| 1451 | - 'http://schema.org/recipeIngredient' |
|
| 1452 | - ), |
|
| 1453 | - // ### schema:recipeInstructions. |
|
| 1454 | - $this->rendition_factory->create( |
|
| 1455 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_INSTRUCTIONS ), |
|
| 1456 | - 'http://schema.org/recipeInstructions' |
|
| 1457 | - ), |
|
| 1458 | - // ### schema:recipeYield. |
|
| 1459 | - $this->rendition_factory->create( |
|
| 1460 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_YIELD ), |
|
| 1461 | - 'http://schema.org/recipeYield' |
|
| 1462 | - ), |
|
| 1463 | - // ### schema:prepTime. |
|
| 1464 | - $this->rendition_factory->create( |
|
| 1465 | - $this->storage_factory->post_meta( self::FIELD_PREP_TIME ), |
|
| 1466 | - 'http://schema.org/prepTime', |
|
| 1467 | - self::DATA_TYPE_DURATION |
|
| 1468 | - ), |
|
| 1469 | - // ### schema:cookTime. |
|
| 1470 | - $this->rendition_factory->create( |
|
| 1471 | - $this->storage_factory->post_meta( self::FIELD_COOK_TIME ), |
|
| 1472 | - 'http://schema.org/cookTime', |
|
| 1473 | - self::DATA_TYPE_DURATION |
|
| 1474 | - ), |
|
| 1475 | - // ### schema:totalTime. |
|
| 1476 | - $this->rendition_factory->create( |
|
| 1477 | - $this->storage_factory->post_meta( self::FIELD_TOTAL_TIME ), |
|
| 1478 | - 'http://schema.org/totalTime', |
|
| 1479 | - self::DATA_TYPE_DURATION |
|
| 1480 | - ), |
|
| 1481 | - ), |
|
| 1482 | - ); |
|
| 1483 | - |
|
| 1484 | - // Merge the custom fields with those provided by the parent schema. |
|
| 1485 | - $parent_schema = $this->get_creative_work_schema(); |
|
| 1486 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1487 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1488 | - |
|
| 1489 | - return $schema; |
|
| 1490 | - } |
|
| 1491 | - |
|
| 1492 | - /** |
|
| 1493 | - * Get the 'offer' schema. |
|
| 1494 | - * |
|
| 1495 | - * @return array An array with the schema configuration. |
|
| 1496 | - * |
|
| 1497 | - * @since 3.18.0 |
|
| 1498 | - */ |
|
| 1499 | - private function get_offer_schema() { |
|
| 1500 | - |
|
| 1501 | - $schema = array( |
|
| 1502 | - 'label' => 'Offer', |
|
| 1503 | - 'description' => 'An offer. ', |
|
| 1504 | - 'parents' => array( 'thing' ), |
|
| 1505 | - 'css_class' => 'wl-offer', |
|
| 1506 | - 'uri' => self::SCHEMA_OFFER_TYPE, |
|
| 1507 | - 'same_as' => array(), |
|
| 1508 | - 'templates' => array( |
|
| 1509 | - 'subtitle' => '{{id}}', |
|
| 1510 | - ), |
|
| 1511 | - 'custom_fields' => array( |
|
| 1512 | - self::FIELD_AVAILABILITY => array( |
|
| 1513 | - 'predicate' => 'http://schema.org/availability', |
|
| 1514 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1515 | - 'export_type' => 'xsd:string', |
|
| 1516 | - 'metabox' => array( |
|
| 1517 | - 'class' => 'Wordlift_Metabox_Field_Select', |
|
| 1518 | - ), |
|
| 1519 | - 'options' => array( |
|
| 1520 | - 'Discontinued' => esc_html__( 'Discontinued', 'wordlift' ), |
|
| 1521 | - 'InStock' => esc_html__( 'In Stock', 'wordlift' ), |
|
| 1522 | - 'InStoreOnly' => esc_html__( 'In Store Only', 'wordlift' ), |
|
| 1523 | - 'LimitedAvailability' => esc_html__( 'Limited Availability', 'wordlift' ), |
|
| 1524 | - 'OnlineOnly' => esc_html__( 'Online Only', 'wordlift' ), |
|
| 1525 | - 'OutOfStock' => esc_html__( 'Out of Stock', 'wordlift' ), |
|
| 1526 | - 'PreOrder' => esc_html__( 'Pre Order', 'wordlift' ), |
|
| 1527 | - 'PreSale' => esc_html__( 'Pre Sale', 'wordlift' ), |
|
| 1528 | - 'SoldOut' => esc_html__( 'Sold Out', 'wordlift' ), |
|
| 1529 | - ), |
|
| 1530 | - ), |
|
| 1531 | - self::FIELD_PRICE => array( |
|
| 1532 | - 'predicate' => 'http://schema.org/price', |
|
| 1533 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1534 | - 'export_type' => 'xsd:integer', |
|
| 1535 | - 'metabox' => array( |
|
| 1536 | - 'class' => 'Wordlift_Metabox_Field_Integer', |
|
| 1537 | - ), |
|
| 1538 | - ), |
|
| 1539 | - self::FIELD_PRICE_CURRENCY => array( |
|
| 1540 | - 'predicate' => 'http://schema.org/priceCurrency', |
|
| 1541 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1542 | - 'export_type' => 'xsd:string', |
|
| 1543 | - ), |
|
| 1544 | - self::FIELD_AVAILABILITY_STARTS => array( |
|
| 1545 | - 'predicate' => 'http://schema.org/availabilityStarts', |
|
| 1546 | - 'type' => self::DATA_TYPE_DATE, |
|
| 1547 | - 'export_type' => 'xsd:dateTime', |
|
| 1548 | - ), |
|
| 1549 | - self::FIELD_AVAILABILITY_ENDS => array( |
|
| 1550 | - 'predicate' => 'http://schema.org/availabilityEnds', |
|
| 1551 | - 'type' => self::DATA_TYPE_DATE, |
|
| 1552 | - 'export_type' => 'xsd:dateTime', |
|
| 1553 | - ), |
|
| 1554 | - self::FIELD_INVENTORY_LEVEL => array( |
|
| 1555 | - 'predicate' => 'http://schema.org/inventoryLevel', |
|
| 1556 | - 'type' => self::DATA_TYPE_STRING, |
|
| 1557 | - 'export_type' => 'xsd:integer', |
|
| 1558 | - 'metabox' => array( |
|
| 1559 | - 'class' => 'Wordlift_Metabox_Field_Integer', |
|
| 1560 | - ), |
|
| 1561 | - ), |
|
| 1562 | - self::FIELD_VALID_FROM => array( |
|
| 1563 | - 'predicate' => 'http://schema.org/validFrom', |
|
| 1564 | - 'type' => self::DATA_TYPE_DATE, |
|
| 1565 | - 'export_type' => 'xsd:dateTime', |
|
| 1566 | - ), |
|
| 1567 | - self::FIELD_PRICE_VALID_UNTIL => array( |
|
| 1568 | - 'predicate' => 'http://schema.org/priceValidUntil', |
|
| 1569 | - 'type' => self::DATA_TYPE_DATE, |
|
| 1570 | - 'export_type' => 'xsd:dateTime', |
|
| 1571 | - ), |
|
| 1572 | - self::FIELD_ITEM_OFFERED => array( |
|
| 1573 | - 'predicate' => 'http://schema.org/itemOffered', |
|
| 1574 | - 'type' => self::DATA_TYPE_URI, |
|
| 1575 | - 'export_type' => 'http://schema.org/Thing', |
|
| 1576 | - 'constraints' => array( |
|
| 1577 | - 'uri_type' => array( |
|
| 1578 | - 'Event', |
|
| 1579 | - 'Thing', |
|
| 1580 | - ), |
|
| 1581 | - 'cardinality' => INF, |
|
| 1582 | - ), |
|
| 1583 | - ), |
|
| 1584 | - ), |
|
| 1585 | - 'linked_data' => array( |
|
| 1586 | - // ### schema:availability. |
|
| 1587 | - $this->rendition_factory->create( |
|
| 1588 | - $this->storage_factory->post_meta( self::FIELD_AVAILABILITY ), |
|
| 1589 | - 'http://schema.org/availability', |
|
| 1590 | - null |
|
| 1591 | - ), |
|
| 1592 | - // ### schema:availabilityStarts. |
|
| 1593 | - $this->rendition_factory->create( |
|
| 1594 | - $this->storage_factory->post_meta( self::FIELD_AVAILABILITY_STARTS ), |
|
| 1595 | - 'http://schema.org/availabilityStarts', |
|
| 1596 | - self::DATA_TYPE_DATE_TIME |
|
| 1597 | - ), |
|
| 1598 | - // ### schema:availabilityEnds. |
|
| 1599 | - $this->rendition_factory->create( |
|
| 1600 | - $this->storage_factory->post_meta( self::FIELD_AVAILABILITY_ENDS ), |
|
| 1601 | - 'http://schema.org/availabilityEnds', |
|
| 1602 | - self::DATA_TYPE_DATE_TIME |
|
| 1603 | - ), |
|
| 1604 | - // ### schema:inventoryLevel. |
|
| 1605 | - $this->rendition_factory->create( |
|
| 1606 | - $this->storage_factory->post_meta( self::FIELD_INVENTORY_LEVEL ), |
|
| 1607 | - 'http://schema.org/inventoryLevel', |
|
| 1608 | - self::DATA_TYPE_INTEGER |
|
| 1609 | - ), |
|
| 1610 | - // ### schema:price. |
|
| 1611 | - $this->rendition_factory->create( |
|
| 1612 | - $this->storage_factory->post_meta( self::FIELD_PRICE ), |
|
| 1613 | - 'http://schema.org/price', |
|
| 1614 | - self::DATA_TYPE_INTEGER |
|
| 1615 | - ), |
|
| 1616 | - // ### schema:priceCurrency. |
|
| 1617 | - $this->rendition_factory->create( |
|
| 1618 | - $this->storage_factory->post_meta( self::FIELD_PRICE_CURRENCY ), |
|
| 1619 | - 'http://schema.org/priceCurrency', |
|
| 1620 | - null |
|
| 1621 | - ), |
|
| 1622 | - // ### schema:validFrom. |
|
| 1623 | - $this->rendition_factory->create( |
|
| 1624 | - $this->storage_factory->post_meta( self::FIELD_VALID_FROM ), |
|
| 1625 | - 'http://schema.org/validFrom', |
|
| 1626 | - null |
|
| 1627 | - ), |
|
| 1628 | - // ### schema:priceValidUntil. |
|
| 1629 | - $this->rendition_factory->create( |
|
| 1630 | - $this->storage_factory->post_meta( self::FIELD_PRICE_VALID_UNTIL ), |
|
| 1631 | - 'http://schema.org/priceValidUntil', |
|
| 1632 | - null |
|
| 1633 | - ), |
|
| 1634 | - // ### schema:itemOffered. |
|
| 1635 | - $this->rendition_factory->create( |
|
| 1636 | - $this->storage_factory->post_meta_to_uri( self::FIELD_ITEM_OFFERED ), |
|
| 1637 | - 'http://schema.org/itemOffered', |
|
| 1638 | - self::DATA_TYPE_URI |
|
| 1639 | - ), |
|
| 1640 | - ), |
|
| 1641 | - ); |
|
| 1642 | - |
|
| 1643 | - // Merge the custom fields with those provided by the thing schema. |
|
| 1644 | - $parent_schema = $this->get_thing_schema(); |
|
| 1645 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1646 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1647 | - |
|
| 1648 | - return $schema; |
|
| 1649 | - } |
|
| 1650 | - |
|
| 1651 | - /** |
|
| 1652 | - * Get the 'article' schema. |
|
| 1653 | - * |
|
| 1654 | - * @return array An array with the schema configuration. |
|
| 1655 | - * |
|
| 1656 | - * @since 3.15.0 |
|
| 1657 | - */ |
|
| 1658 | - private function get_article_schema() { |
|
| 1659 | - |
|
| 1660 | - $schema = array( |
|
| 1661 | - 'label' => 'Article', |
|
| 1662 | - 'description' => 'An Article.', |
|
| 1663 | - 'parents' => array(), |
|
| 1664 | - 'css_class' => 'wl-article', |
|
| 1665 | - 'uri' => 'http://schema.org/Article', |
|
| 1666 | - 'same_as' => array(), |
|
| 1667 | - 'templates' => array( |
|
| 1668 | - 'subtitle' => '{{id}}', |
|
| 1669 | - ), |
|
| 1670 | - 'custom_fields' => array(), |
|
| 1671 | - 'linked_data' => array( |
|
| 1672 | - // ### schema:headline. |
|
| 1673 | - $this->rendition_factory->create( |
|
| 1674 | - $this->storage_factory->post_title(), |
|
| 1675 | - 'http://schema.org/headline', |
|
| 1676 | - null, |
|
| 1677 | - $this->language_code |
|
| 1678 | - ), |
|
| 1679 | - // ### schema:url. |
|
| 1680 | - $this->rendition_factory->create( |
|
| 1681 | - $this->storage_factory->url_property(), |
|
| 1682 | - Wordlift_Query_Builder::SCHEMA_URL_URI, |
|
| 1683 | - self::DATA_TYPE_URI |
|
| 1684 | - ), |
|
| 1685 | - // ### rdf:type. |
|
| 1686 | - $this->rendition_factory->create( |
|
| 1687 | - $this->storage_factory->schema_class(), |
|
| 1688 | - Wordlift_Query_Builder::RDFS_TYPE_URI, |
|
| 1689 | - self::DATA_TYPE_URI |
|
| 1690 | - ), |
|
| 1691 | - // ### dcterms:references. |
|
| 1692 | - $this->rendition_factory->create( |
|
| 1693 | - $this->storage_factory->relations(), |
|
| 1694 | - Wordlift_Query_Builder::DCTERMS_REFERENCES_URI, |
|
| 1695 | - self::DATA_TYPE_URI, |
|
| 1696 | - $this->language_code |
|
| 1697 | - ), |
|
| 1698 | - ), |
|
| 1699 | - ); |
|
| 1700 | - |
|
| 1701 | - return $schema; |
|
| 1702 | - } |
|
| 21 | + /** |
|
| 22 | + * The 'location created' field name. |
|
| 23 | + * |
|
| 24 | + * @since 3.5.0 |
|
| 25 | + */ |
|
| 26 | + const FIELD_LOCATION_CREATED = 'wl_location_created'; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * The 'topic' field name. |
|
| 30 | + * |
|
| 31 | + * @since 3.5.0 |
|
| 32 | + */ |
|
| 33 | + const FIELD_TOPIC = 'wl_topic'; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * The 'author' field name. |
|
| 37 | + * |
|
| 38 | + * @since 3.1.0 |
|
| 39 | + */ |
|
| 40 | + const FIELD_AUTHOR = 'wl_author'; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * The 'same as' field name. |
|
| 44 | + * |
|
| 45 | + * @since 3.1.0 |
|
| 46 | + */ |
|
| 47 | + const FIELD_SAME_AS = 'entity_same_as'; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * The 'date start' field name. |
|
| 51 | + * |
|
| 52 | + * @since 3.1.0 |
|
| 53 | + */ |
|
| 54 | + const FIELD_DATE_START = 'wl_cal_date_start'; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * The 'date end' field name. |
|
| 58 | + * |
|
| 59 | + * @since 3.1.0 |
|
| 60 | + */ |
|
| 61 | + const FIELD_DATE_END = 'wl_cal_date_end'; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * The 'location' field name. |
|
| 65 | + * |
|
| 66 | + * @since 3.1.0 |
|
| 67 | + */ |
|
| 68 | + const FIELD_LOCATION = 'wl_location'; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The 'founder' field name. |
|
| 72 | + * |
|
| 73 | + * @since 3.1.0 |
|
| 74 | + */ |
|
| 75 | + const FIELD_FOUNDER = 'wl_founder'; |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * The 'knows' field name. |
|
| 79 | + * |
|
| 80 | + * @since 3.1.0 |
|
| 81 | + */ |
|
| 82 | + const FIELD_KNOWS = 'wl_knows'; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * The 'birth date' field name. |
|
| 86 | + * |
|
| 87 | + * @since 3.1.0 |
|
| 88 | + */ |
|
| 89 | + const FIELD_BIRTH_DATE = 'wl_birth_date'; |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * The 'birth place' field name. |
|
| 93 | + * |
|
| 94 | + * @since 3.1.0 |
|
| 95 | + */ |
|
| 96 | + const FIELD_BIRTH_PLACE = 'wl_birth_place'; |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * The 'latitude' field name. |
|
| 100 | + * |
|
| 101 | + * @since 3.1.0 |
|
| 102 | + */ |
|
| 103 | + const FIELD_GEO_LATITUDE = 'wl_geo_latitude'; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The 'longitude' field name. |
|
| 107 | + * |
|
| 108 | + * @since 3.1.0 |
|
| 109 | + */ |
|
| 110 | + const FIELD_GEO_LONGITUDE = 'wl_geo_longitude'; |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * The 'streetAddress' field name. |
|
| 114 | + * |
|
| 115 | + * @since 3.1.0 |
|
| 116 | + */ |
|
| 117 | + const FIELD_ADDRESS = 'wl_address'; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The 'postOfficeBoxNumber' field name. |
|
| 121 | + * |
|
| 122 | + * @since 3.3.0 |
|
| 123 | + */ |
|
| 124 | + const FIELD_ADDRESS_PO_BOX = 'wl_address_post_office_box'; |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * The 'postalCode' field name. |
|
| 128 | + * |
|
| 129 | + * @since 3.3.0 |
|
| 130 | + */ |
|
| 131 | + const FIELD_ADDRESS_POSTAL_CODE = 'wl_address_postal_code'; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * The 'addressLocality' field name. |
|
| 135 | + * |
|
| 136 | + * @since 3.3.0 |
|
| 137 | + */ |
|
| 138 | + const FIELD_ADDRESS_LOCALITY = 'wl_address_locality'; |
|
| 139 | + /** |
|
| 140 | + * The 'addressRegion' field name. |
|
| 141 | + * |
|
| 142 | + * @since 3.3.0 |
|
| 143 | + */ |
|
| 144 | + const FIELD_ADDRESS_REGION = 'wl_address_region'; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * The 'addressCountry' field name. |
|
| 148 | + * |
|
| 149 | + * @since 3.3.0 |
|
| 150 | + */ |
|
| 151 | + const FIELD_ADDRESS_COUNTRY = 'wl_address_country'; |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * The 'entity type' field name. |
|
| 155 | + * |
|
| 156 | + * @since 3.1.0 |
|
| 157 | + */ |
|
| 158 | + const FIELD_ENTITY_TYPE = 'wl_entity_type_uri'; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The 'email' field name. |
|
| 162 | + * |
|
| 163 | + * @since 3.2.0 |
|
| 164 | + */ |
|
| 165 | + const FIELD_EMAIL = 'wl_email'; |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * The 'affiliation' field name. |
|
| 169 | + * |
|
| 170 | + * @since 3.2.0 |
|
| 171 | + */ |
|
| 172 | + const FIELD_AFFILIATION = 'wl_affiliation'; |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * The 'telephone' field name. |
|
| 176 | + * |
|
| 177 | + * @since 3.8.0 |
|
| 178 | + */ |
|
| 179 | + const FIELD_TELEPHONE = 'wl_schema_telephone'; |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * The 'legalName' field name. |
|
| 183 | + * |
|
| 184 | + * @since 3.12.0 |
|
| 185 | + */ |
|
| 186 | + const FIELD_LEGAL_NAME = 'wl_schema_legal_name'; |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * The 'recipeCuisine' field name. |
|
| 190 | + * |
|
| 191 | + * @since 3.14.0 |
|
| 192 | + */ |
|
| 193 | + const FIELD_RECIPE_CUISINE = 'wl_schema_recipe_cuisine'; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The 'recipeIngredient' field name. |
|
| 197 | + * |
|
| 198 | + * @since 3.14.0 |
|
| 199 | + */ |
|
| 200 | + const FIELD_RECIPE_INGREDIENT = 'wl_schema_recipe_ingredient'; |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * The 'calories' field name. |
|
| 204 | + * |
|
| 205 | + * @since 3.14.0 |
|
| 206 | + */ |
|
| 207 | + const FIELD_NUTRITION_INFO_CALORIES = 'wl_schema_nutrition_information_calories'; |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * The 'recipeInstructions' field name. |
|
| 211 | + * |
|
| 212 | + * @since 3.14.0 |
|
| 213 | + */ |
|
| 214 | + const FIELD_RECIPE_INSTRUCTIONS = 'wl_schema_recipe_instructions'; |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * The 'recipeYield' field name. |
|
| 218 | + * |
|
| 219 | + * @since 3.14.0 |
|
| 220 | + */ |
|
| 221 | + const FIELD_RECIPE_YIELD = 'wl_schema_recipe_yield'; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * The 'prepTime' field name. |
|
| 225 | + * |
|
| 226 | + * @since 3.14.0 |
|
| 227 | + */ |
|
| 228 | + const FIELD_PREP_TIME = 'wl_schema_prep_time'; |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * The 'cookTime' field name. |
|
| 232 | + * |
|
| 233 | + * @since 3.14.0 |
|
| 234 | + */ |
|
| 235 | + const FIELD_COOK_TIME = 'wl_schema_cook_time'; |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * The 'totalTime' field name. |
|
| 239 | + * |
|
| 240 | + * @since 3.14.0 |
|
| 241 | + */ |
|
| 242 | + const FIELD_TOTAL_TIME = 'wl_schema_total_time'; |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * The 'performer' field name. |
|
| 246 | + * |
|
| 247 | + * @since 3.18.0 |
|
| 248 | + */ |
|
| 249 | + const FIELD_PERFORMER = 'wl_schema_performer'; |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * The 'offers' field name. |
|
| 253 | + * |
|
| 254 | + * @since 3.18.0 |
|
| 255 | + */ |
|
| 256 | + const FIELD_OFFERS = 'wl_schema_offers'; |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * The 'availablity' field name. |
|
| 260 | + * |
|
| 261 | + * @since 3.18.0 |
|
| 262 | + */ |
|
| 263 | + const FIELD_AVAILABILITY = 'wl_schema_availability'; |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * The 'inventoryLevel' field name. |
|
| 267 | + * |
|
| 268 | + * @since 3.18.0 |
|
| 269 | + */ |
|
| 270 | + const FIELD_INVENTORY_LEVEL = 'wl_schema_inventory_level'; |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * The 'price' field name. |
|
| 274 | + * |
|
| 275 | + * @since 3.18.0 |
|
| 276 | + */ |
|
| 277 | + const FIELD_PRICE = 'wl_schema_price'; |
|
| 278 | + |
|
| 279 | + /** |
|
| 280 | + * The 'priceCurrency' field name. |
|
| 281 | + * |
|
| 282 | + * @since 3.18.0 |
|
| 283 | + */ |
|
| 284 | + const FIELD_PRICE_CURRENCY = 'wl_schema_price_currency'; |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * The 'availabilityStarts' field name. |
|
| 288 | + * |
|
| 289 | + * @since 3.18.0 |
|
| 290 | + */ |
|
| 291 | + const FIELD_AVAILABILITY_STARTS = 'wl_schema_availability_starts'; |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * The 'availabilityEnds' field name. |
|
| 295 | + * |
|
| 296 | + * @since 3.18.0 |
|
| 297 | + */ |
|
| 298 | + const FIELD_AVAILABILITY_ENDS = 'wl_schema_availability_ends'; |
|
| 299 | + |
|
| 300 | + /** |
|
| 301 | + * The 'validFrom' field name. |
|
| 302 | + * |
|
| 303 | + * @since 3.18.0 |
|
| 304 | + */ |
|
| 305 | + const FIELD_VALID_FROM = 'wl_schema_valid_from'; |
|
| 306 | + |
|
| 307 | + /** |
|
| 308 | + * The 'priceValidUntil' field name. |
|
| 309 | + * |
|
| 310 | + * @since 3.18.0 |
|
| 311 | + */ |
|
| 312 | + const FIELD_PRICE_VALID_UNTIL = 'wl_schema_valid_until'; |
|
| 313 | + |
|
| 314 | + /** |
|
| 315 | + * The 'itemOffered' field name. |
|
| 316 | + * |
|
| 317 | + * @since 3.18.0 |
|
| 318 | + */ |
|
| 319 | + const FIELD_ITEM_OFFERED = 'wl_schema_item_offered'; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * The 'URI' data type name. |
|
| 323 | + * |
|
| 324 | + * @since 3.1.0 |
|
| 325 | + */ |
|
| 326 | + const DATA_TYPE_URI = 'uri'; |
|
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * The 'date' data type name. |
|
| 330 | + * |
|
| 331 | + * @since 3.1.0 |
|
| 332 | + */ |
|
| 333 | + const DATA_TYPE_DATE = 'date'; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * The 'dateTime' data type name. |
|
| 337 | + * |
|
| 338 | + * @since 3.15.0 |
|
| 339 | + */ |
|
| 340 | + const DATA_TYPE_DATE_TIME = 'dateTime'; |
|
| 341 | + |
|
| 342 | + /** |
|
| 343 | + * The 'time' data type name. |
|
| 344 | + * |
|
| 345 | + * @since 3.14.0 |
|
| 346 | + */ |
|
| 347 | + const DATA_TYPE_DURATION = 'duration'; |
|
| 348 | + |
|
| 349 | + /** |
|
| 350 | + * The 'double' data type name. |
|
| 351 | + * |
|
| 352 | + * @since 3.1.0 |
|
| 353 | + */ |
|
| 354 | + const DATA_TYPE_DOUBLE = 'double'; |
|
| 355 | + |
|
| 356 | + /** |
|
| 357 | + * The 'string' data type name. |
|
| 358 | + * |
|
| 359 | + * @since 3.1.0 |
|
| 360 | + */ |
|
| 361 | + const DATA_TYPE_STRING = 'string'; |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * The multiline text data type name. |
|
| 365 | + * |
|
| 366 | + * @since 3.14.0 |
|
| 367 | + */ |
|
| 368 | + const DATA_TYPE_MULTILINE = 'multiline'; |
|
| 369 | + |
|
| 370 | + /** |
|
| 371 | + * The 'integer' data type name. |
|
| 372 | + * |
|
| 373 | + * @since 3.1.0 |
|
| 374 | + */ |
|
| 375 | + const DATA_TYPE_INTEGER = 'int'; |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * The 'boolean' data type name. |
|
| 379 | + * |
|
| 380 | + * @since 3.1.0 |
|
| 381 | + */ |
|
| 382 | + const DATA_TYPE_BOOLEAN = 'bool'; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * The schema.org Event type URI. |
|
| 386 | + * |
|
| 387 | + * @since 3.1.0 |
|
| 388 | + */ |
|
| 389 | + const SCHEMA_EVENT_TYPE = 'http://schema.org/Event'; |
|
| 390 | + |
|
| 391 | + /** |
|
| 392 | + * The schema.org Offer type URI. |
|
| 393 | + * |
|
| 394 | + * @since 3.18.0 |
|
| 395 | + */ |
|
| 396 | + const SCHEMA_OFFER_TYPE = 'http://schema.org/Offer'; |
|
| 397 | + |
|
| 398 | + /** |
|
| 399 | + * The Schema service singleton instance. |
|
| 400 | + * |
|
| 401 | + * @since 3.1.0 |
|
| 402 | + * @access private |
|
| 403 | + * @var \Wordlift_Schema_Service $instance The Schema service singleton instance. |
|
| 404 | + */ |
|
| 405 | + private static $instance; |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * WordLift's schema. |
|
| 409 | + * |
|
| 410 | + * @since 3.1.0 |
|
| 411 | + * @access private |
|
| 412 | + * @var array $schema WordLift's schema. |
|
| 413 | + */ |
|
| 414 | + private $schema; |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * The Log service. |
|
| 418 | + * |
|
| 419 | + * @since 3.1.0 |
|
| 420 | + * @access private |
|
| 421 | + * @var \Wordlift_Log_Service $log The Log service. |
|
| 422 | + */ |
|
| 423 | + private $log; |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * The {@link Wordlift_Post_Property_Storage_Factory} instance. |
|
| 427 | + * |
|
| 428 | + * @since 3.15.0 |
|
| 429 | + * @access private |
|
| 430 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Post_Property_Storage_Factory} instance. |
|
| 431 | + */ |
|
| 432 | + private $storage_factory; |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 436 | + * |
|
| 437 | + * @since 3.15.0 |
|
| 438 | + * @access private |
|
| 439 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 440 | + */ |
|
| 441 | + private $rendition_factory; |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * The {@link Wordlift_Configuration_Service} instance. |
|
| 445 | + * |
|
| 446 | + * @since 3.15.0 |
|
| 447 | + * @access private |
|
| 448 | + * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 449 | + */ |
|
| 450 | + private $configuration_service; |
|
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * The web site configured language code. |
|
| 454 | + * |
|
| 455 | + * @since 3.15.0 |
|
| 456 | + * @access private |
|
| 457 | + * @var string $language_code The web site configured language code. |
|
| 458 | + */ |
|
| 459 | + private $language_code; |
|
| 460 | + |
|
| 461 | + /** |
|
| 462 | + * Wordlift_Schema_Service constructor. |
|
| 463 | + * |
|
| 464 | + * @since 3.1.0 |
|
| 465 | + * |
|
| 466 | + * @param \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Post_Property_Storage_Factory} instance. |
|
| 467 | + * @param \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 468 | + * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 469 | + */ |
|
| 470 | + public function __construct( $storage_factory, $rendition_factory, $configuration_service ) { |
|
| 471 | + |
|
| 472 | + $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Schema_Service' ); |
|
| 473 | + |
|
| 474 | + $this->storage_factory = $storage_factory; |
|
| 475 | + $this->rendition_factory = $rendition_factory; |
|
| 476 | + $this->configuration_service = $configuration_service; |
|
| 477 | + $this->language_code = $this->configuration_service->get_language_code(); |
|
| 478 | + |
|
| 479 | + $schemas = array( |
|
| 480 | + 'article' => $this->get_article_schema(), |
|
| 481 | + 'thing' => $this->get_thing_schema(), |
|
| 482 | + 'creative-work' => $this->get_creative_work_schema(), |
|
| 483 | + 'event' => $this->get_event_schema(), |
|
| 484 | + 'organization' => $this->get_organization_schema(), |
|
| 485 | + 'person' => $this->get_person_schema(), |
|
| 486 | + 'place' => $this->get_place_schema(), |
|
| 487 | + 'local-business' => $this->get_local_business_schema(), |
|
| 488 | + 'recipe' => $this->get_recipe_schema(), |
|
| 489 | + 'web-page' => $this->get_web_page_schema(), |
|
| 490 | + 'offer' => $this->get_offer_schema(), |
|
| 491 | + ); |
|
| 492 | + |
|
| 493 | + // Set the taxonomy data. |
|
| 494 | + // Note: parent types must be defined before child types. |
|
| 495 | + /** |
|
| 496 | + * Alter the configured schemas. |
|
| 497 | + * |
|
| 498 | + * Enable 3rd parties to alter WordLift's schemas array. |
|
| 499 | + * |
|
| 500 | + * @since 3.19.1 |
|
| 501 | + * |
|
| 502 | + * @param array $schemas The array of schemas. |
|
| 503 | + */ |
|
| 504 | + $this->schema = apply_filters( 'wl_schemas', $schemas ); |
|
| 505 | + |
|
| 506 | + // Create a singleton instance of the Schema service, useful to provide static functions to global functions. |
|
| 507 | + self::$instance = $this; |
|
| 508 | + |
|
| 509 | + // Hook the `init` to allow plugins to add their schemas. |
|
| 510 | + add_action( 'init', array( $this, 'init' ) ); |
|
| 511 | + |
|
| 512 | + } |
|
| 513 | + |
|
| 514 | + /** |
|
| 515 | + * Hook to the `init`, allow late binding plugins to add their schema. |
|
| 516 | + * |
|
| 517 | + * @since 3.19.2 |
|
| 518 | + */ |
|
| 519 | + public function init() { |
|
| 520 | + |
|
| 521 | + $this->schema = apply_filters( 'wl_schemas_init', $this->schema ); |
|
| 522 | + |
|
| 523 | + } |
|
| 524 | + |
|
| 525 | + /** |
|
| 526 | + * Get a reference to the Schema service. |
|
| 527 | + * |
|
| 528 | + * @since 3.1.0 |
|
| 529 | + * |
|
| 530 | + * @return Wordlift_Schema_Service A reference to the Schema service. |
|
| 531 | + */ |
|
| 532 | + public static function get_instance() { |
|
| 533 | + |
|
| 534 | + return self::$instance; |
|
| 535 | + } |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * Get the properties for a field with the specified key. The key is used as |
|
| 539 | + * meta key when the field's value is stored in WordPress meta data table. |
|
| 540 | + * |
|
| 541 | + * @since 3.6.0 |
|
| 542 | + * |
|
| 543 | + * @param string $key The field's key. |
|
| 544 | + * |
|
| 545 | + * @return null|array An array of field's properties or null if the field is not found. |
|
| 546 | + */ |
|
| 547 | + public function get_field( $key ) { |
|
| 548 | + |
|
| 549 | + // Parse each schema's fields until we find the one we're looking for, then |
|
| 550 | + // return its properties. |
|
| 551 | + foreach ( $this->schema as $_ => $schema ) { |
|
| 552 | + |
|
| 553 | + if ( ! isset( $schema['custom_fields'] ) ) { |
|
| 554 | + break; |
|
| 555 | + } |
|
| 556 | + |
|
| 557 | + foreach ( $schema['custom_fields'] as $field => $props ) { |
|
| 558 | + if ( $key === $field ) { |
|
| 559 | + return $props; |
|
| 560 | + } |
|
| 561 | + } |
|
| 562 | + } |
|
| 563 | + |
|
| 564 | + return null; |
|
| 565 | + } |
|
| 566 | + |
|
| 567 | + /** |
|
| 568 | + * Get all renditions for each WordLift's schema. |
|
| 569 | + * |
|
| 570 | + * @since 3.18.0 |
|
| 571 | + * |
|
| 572 | + * @return array An array with the schema renditions. |
|
| 573 | + */ |
|
| 574 | + public function get_renditions() { |
|
| 575 | + // Get the custom fields. |
|
| 576 | + $renditions = array_reduce( |
|
| 577 | + $this->schema, |
|
| 578 | + function ( $carry, $item ) { |
|
| 579 | + return array_merge( $carry, $item['linked_data'] ); |
|
| 580 | + }, |
|
| 581 | + array() |
|
| 582 | + ); |
|
| 583 | + |
|
| 584 | + // Return the schemas. |
|
| 585 | + return $renditions; |
|
| 586 | + } |
|
| 587 | + |
|
| 588 | + /** |
|
| 589 | + * Get the WordLift's schema. |
|
| 590 | + * |
|
| 591 | + * @param string $name The schema name. |
|
| 592 | + * |
|
| 593 | + * @return array|null An array with the schema configuration or NULL if the schema is not found. |
|
| 594 | + * |
|
| 595 | + * @since 3.1.0 |
|
| 596 | + */ |
|
| 597 | + public function get_schema( $name ) { |
|
| 598 | + // Check if the schema exists and, if not, return NULL. |
|
| 599 | + if ( ! isset( $this->schema[ $name ] ) ) { |
|
| 600 | + return null; |
|
| 601 | + } |
|
| 602 | + |
|
| 603 | + // Return the requested schema. |
|
| 604 | + return $this->schema[ $name ]; |
|
| 605 | + } |
|
| 606 | + |
|
| 607 | + /** |
|
| 608 | + * Get the WordLift's schema trough schema type uri. |
|
| 609 | + * |
|
| 610 | + * @param string $uri The schema uri. |
|
| 611 | + * |
|
| 612 | + * @return array|null An array with the schema configuration or NULL if the schema is not found. |
|
| 613 | + * |
|
| 614 | + * @since 3.3.0 |
|
| 615 | + */ |
|
| 616 | + public function get_schema_by_uri( $uri ) { |
|
| 617 | + |
|
| 618 | + foreach ( $this->schema as $name => $schema ) { |
|
| 619 | + if ( $schema['uri'] === $uri ) { |
|
| 620 | + return $schema; |
|
| 621 | + } |
|
| 622 | + } |
|
| 623 | + |
|
| 624 | + return null; |
|
| 625 | + } |
|
| 626 | + |
|
| 627 | + /** |
|
| 628 | + * Get the 'thing' schema. |
|
| 629 | + * |
|
| 630 | + * @return array An array with the schema configuration. |
|
| 631 | + * |
|
| 632 | + * @since 3.1.0 |
|
| 633 | + */ |
|
| 634 | + private function get_thing_schema() { |
|
| 635 | + |
|
| 636 | + return array( |
|
| 637 | + 'css_class' => 'wl-thing', |
|
| 638 | + 'uri' => 'http://schema.org/Thing', |
|
| 639 | + 'same_as' => array( '*' ), |
|
| 640 | + // set as default. |
|
| 641 | + 'custom_fields' => array( |
|
| 642 | + self::FIELD_SAME_AS => array( |
|
| 643 | + 'predicate' => 'http://schema.org/sameAs', |
|
| 644 | + 'type' => self::DATA_TYPE_URI, |
|
| 645 | + 'export_type' => 'http://schema.org/Thing', |
|
| 646 | + 'constraints' => array( |
|
| 647 | + 'cardinality' => INF, |
|
| 648 | + ), |
|
| 649 | + // We need a custom metabox. |
|
| 650 | + 'input_field' => 'sameas', |
|
| 651 | + ), |
|
| 652 | + // Add the schema:url property. |
|
| 653 | + Wordlift_Schema_Url_Property_Service::META_KEY => Wordlift_Schema_Url_Property_Service::get_instance() |
|
| 654 | + ->get_compat_definition(), |
|
| 655 | + ), |
|
| 656 | + // {{sameAs}} not present in the microdata template, |
|
| 657 | + // because it is treated separately in *wl_content_embed_item_microdata* |
|
| 658 | + 'templates' => array( |
|
| 659 | + 'subtitle' => '{{id}}', |
|
| 660 | + ), |
|
| 661 | + 'linked_data' => array( |
|
| 662 | + // ### Title to rdfs:label. |
|
| 663 | + $this->rendition_factory->create( |
|
| 664 | + $this->storage_factory->post_title(), |
|
| 665 | + Wordlift_Query_Builder::RDFS_LABEL_URI, |
|
| 666 | + null, |
|
| 667 | + $this->language_code |
|
| 668 | + ), |
|
| 669 | + // ### Title to dct:title. |
|
| 670 | + $this->rendition_factory->create( |
|
| 671 | + $this->storage_factory->post_title(), |
|
| 672 | + 'http://purl.org/dc/terms/title', |
|
| 673 | + null, |
|
| 674 | + $this->language_code |
|
| 675 | + ), |
|
| 676 | + // ### Alternative title to rdfs:label. |
|
| 677 | + $this->rendition_factory->create( |
|
| 678 | + $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 679 | + Wordlift_Query_Builder::RDFS_LABEL_URI, |
|
| 680 | + null, |
|
| 681 | + $this->language_code |
|
| 682 | + ), |
|
| 683 | + // ### Alternative title to dct:title. |
|
| 684 | + $this->rendition_factory->create( |
|
| 685 | + $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 686 | + 'http://purl.org/dc/terms/title', |
|
| 687 | + null, |
|
| 688 | + $this->language_code |
|
| 689 | + ), |
|
| 690 | + // ### Title to schema:name. |
|
| 691 | + $this->rendition_factory->create( |
|
| 692 | + $this->storage_factory->post_title(), |
|
| 693 | + 'http://schema.org/name', |
|
| 694 | + null, |
|
| 695 | + $this->language_code |
|
| 696 | + ), |
|
| 697 | + // ### Alternative title to schema:alterName. |
|
| 698 | + $this->rendition_factory->create( |
|
| 699 | + $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 700 | + 'http://schema.org/alternateName', |
|
| 701 | + null, |
|
| 702 | + $this->language_code |
|
| 703 | + ), |
|
| 704 | + // ### schema:url. |
|
| 705 | + $this->rendition_factory->create( |
|
| 706 | + $this->storage_factory->url_property(), |
|
| 707 | + Wordlift_Query_Builder::SCHEMA_URL_URI, |
|
| 708 | + self::DATA_TYPE_URI |
|
| 709 | + ), |
|
| 710 | + // ### schema:description. |
|
| 711 | + $this->rendition_factory->create( |
|
| 712 | + $this->storage_factory->post_description_no_tags_no_shortcodes(), |
|
| 713 | + 'http://schema.org/description', |
|
| 714 | + null, |
|
| 715 | + $this->language_code |
|
| 716 | + ), |
|
| 717 | + // ### owl:sameAs. |
|
| 718 | + $this->rendition_factory->create( |
|
| 719 | + $this->storage_factory->post_meta( self::FIELD_SAME_AS ), |
|
| 720 | + 'http://www.w3.org/2002/07/owl#sameAs', |
|
| 721 | + self::DATA_TYPE_URI |
|
| 722 | + ), |
|
| 723 | + // ### schema:sameAs. |
|
| 724 | + $this->rendition_factory->create( |
|
| 725 | + $this->storage_factory->post_meta( self::FIELD_SAME_AS ), |
|
| 726 | + 'http://schema.org/sameAs', |
|
| 727 | + self::DATA_TYPE_URI |
|
| 728 | + ), |
|
| 729 | + // ### rdf:type. |
|
| 730 | + $this->rendition_factory->create( |
|
| 731 | + $this->storage_factory->schema_class(), |
|
| 732 | + Wordlift_Query_Builder::RDFS_TYPE_URI, |
|
| 733 | + self::DATA_TYPE_URI |
|
| 734 | + ), |
|
| 735 | + // ### schema:image. |
|
| 736 | + $this->rendition_factory->create( |
|
| 737 | + $this->storage_factory->post_images(), |
|
| 738 | + Wordlift_Query_Builder::SCHEMA_IMAGE_URI, |
|
| 739 | + self::DATA_TYPE_URI |
|
| 740 | + ), |
|
| 741 | + // ### dct:relation. |
|
| 742 | + $this->rendition_factory->create( |
|
| 743 | + $this->storage_factory->relations(), |
|
| 744 | + Wordlift_Query_Builder::DCTERMS_RELATION_URI, |
|
| 745 | + self::DATA_TYPE_URI |
|
| 746 | + ), |
|
| 747 | + ), |
|
| 748 | + ); |
|
| 749 | + |
|
| 750 | + } |
|
| 751 | + |
|
| 752 | + /** |
|
| 753 | + * Get the 'web-page' schema. |
|
| 754 | + * |
|
| 755 | + * @return array An array with the schema configuration. |
|
| 756 | + * |
|
| 757 | + * @since 3.18.0 |
|
| 758 | + */ |
|
| 759 | + private function get_web_page_schema() { |
|
| 760 | + |
|
| 761 | + return array( |
|
| 762 | + 'css_class' => 'wl-webpage', |
|
| 763 | + 'uri' => 'http://schema.org/WebPage', |
|
| 764 | + 'linked_data' => array( |
|
| 765 | + // ### schema:headline. |
|
| 766 | + $this->rendition_factory->create( |
|
| 767 | + $this->storage_factory->post_title(), |
|
| 768 | + 'http://schema.org/headline', |
|
| 769 | + null, |
|
| 770 | + $this->language_code |
|
| 771 | + ), |
|
| 772 | + // ### schema:url. |
|
| 773 | + $this->rendition_factory->create( |
|
| 774 | + $this->storage_factory->url_property(), |
|
| 775 | + Wordlift_Query_Builder::SCHEMA_URL_URI, |
|
| 776 | + self::DATA_TYPE_URI |
|
| 777 | + ), |
|
| 778 | + // ### rdf:type. |
|
| 779 | + $this->rendition_factory->create( |
|
| 780 | + $this->storage_factory->schema_class(), |
|
| 781 | + Wordlift_Query_Builder::RDFS_TYPE_URI, |
|
| 782 | + self::DATA_TYPE_URI |
|
| 783 | + ), |
|
| 784 | + // ### dcterms:references. |
|
| 785 | + $this->rendition_factory->create( |
|
| 786 | + $this->storage_factory->relations(), |
|
| 787 | + Wordlift_Query_Builder::DCTERMS_REFERENCES_URI, |
|
| 788 | + self::DATA_TYPE_URI, |
|
| 789 | + $this->language_code |
|
| 790 | + ), |
|
| 791 | + ), |
|
| 792 | + ); |
|
| 793 | + |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + /** |
|
| 797 | + * Get the 'creative work' schema. |
|
| 798 | + * |
|
| 799 | + * @return array An array with the schema configuration. |
|
| 800 | + * |
|
| 801 | + * @since 3.1.0 |
|
| 802 | + */ |
|
| 803 | + private function get_creative_work_schema() { |
|
| 804 | + |
|
| 805 | + $schema = array( |
|
| 806 | + 'label' => 'CreativeWork', |
|
| 807 | + 'description' => 'A creative work (or a Music Album).', |
|
| 808 | + 'parents' => array( 'thing' ), |
|
| 809 | + // Give term slug as parent. |
|
| 810 | + 'css_class' => 'wl-creative-work', |
|
| 811 | + 'uri' => 'http://schema.org/CreativeWork', |
|
| 812 | + 'same_as' => array( |
|
| 813 | + 'http://schema.org/MusicAlbum', |
|
| 814 | + 'http://schema.org/Product', |
|
| 815 | + ), |
|
| 816 | + 'custom_fields' => array( |
|
| 817 | + self::FIELD_AUTHOR => array( |
|
| 818 | + 'predicate' => 'http://schema.org/author', |
|
| 819 | + 'type' => self::DATA_TYPE_URI, |
|
| 820 | + 'export_type' => 'http://schema.org/Person', |
|
| 821 | + 'constraints' => array( |
|
| 822 | + 'uri_type' => array( 'Person', 'Organization' ), |
|
| 823 | + 'cardinality' => INF, |
|
| 824 | + ), |
|
| 825 | + ), |
|
| 826 | + ), |
|
| 827 | + 'linked_data' => array( |
|
| 828 | + // ### schema:author. |
|
| 829 | + $this->rendition_factory->create( |
|
| 830 | + $this->storage_factory->author_uri(), |
|
| 831 | + Wordlift_Query_Builder::SCHEMA_AUTHOR_URI, |
|
| 832 | + self::DATA_TYPE_URI |
|
| 833 | + ), |
|
| 834 | + ), |
|
| 835 | + 'templates' => array( |
|
| 836 | + 'subtitle' => '{{id}}', |
|
| 837 | + ), |
|
| 838 | + ); |
|
| 839 | + |
|
| 840 | + // Merge the custom fields with those provided by the thing schema. |
|
| 841 | + $parent_schema = $this->get_thing_schema(); |
|
| 842 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 843 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 844 | + |
|
| 845 | + return $schema; |
|
| 846 | + } |
|
| 847 | + |
|
| 848 | + /** |
|
| 849 | + * Get the 'event' schema. |
|
| 850 | + * |
|
| 851 | + * @return array An array with the schema configuration. |
|
| 852 | + * |
|
| 853 | + * @since 3.1.0 |
|
| 854 | + */ |
|
| 855 | + private function get_event_schema() { |
|
| 856 | + |
|
| 857 | + $schema = array( |
|
| 858 | + 'label' => 'Event', |
|
| 859 | + 'description' => 'An event . ', |
|
| 860 | + 'parents' => array( 'thing' ), |
|
| 861 | + 'css_class' => 'wl-event', |
|
| 862 | + 'uri' => self::SCHEMA_EVENT_TYPE, |
|
| 863 | + 'same_as' => array( 'http://dbpedia.org/ontology/Event' ), |
|
| 864 | + 'custom_fields' => array( |
|
| 865 | + self::FIELD_DATE_START => array( |
|
| 866 | + 'predicate' => 'http://schema.org/startDate', |
|
| 867 | + 'type' => self::DATA_TYPE_DATE, |
|
| 868 | + 'export_type' => 'xsd:dateTime', |
|
| 869 | + 'constraints' => '', |
|
| 870 | + ), |
|
| 871 | + self::FIELD_DATE_END => array( |
|
| 872 | + 'predicate' => 'http://schema.org/endDate', |
|
| 873 | + 'type' => self::DATA_TYPE_DATE, |
|
| 874 | + 'export_type' => 'xsd:dateTime', |
|
| 875 | + 'constraints' => '', |
|
| 876 | + ), |
|
| 877 | + self::FIELD_LOCATION => array( |
|
| 878 | + 'predicate' => 'http://schema.org/location', |
|
| 879 | + 'type' => self::DATA_TYPE_URI, |
|
| 880 | + 'export_type' => 'http://schema.org/PostalAddress', |
|
| 881 | + 'constraints' => array( |
|
| 882 | + 'uri_type' => array( 'Place', 'LocalBusiness' ), |
|
| 883 | + 'cardinality' => INF, |
|
| 884 | + ), |
|
| 885 | + ), |
|
| 886 | + self::FIELD_PERFORMER => array( |
|
| 887 | + 'predicate' => 'http://schema.org/performer', |
|
| 888 | + 'type' => self::DATA_TYPE_URI, |
|
| 889 | + 'export_type' => 'http://schema.org/Person', |
|
| 890 | + 'constraints' => array( |
|
| 891 | + 'uri_type' => array( 'Person', 'Organization' ), |
|
| 892 | + 'cardinality' => INF, |
|
| 893 | + ), |
|
| 894 | + ), |
|
| 895 | + self::FIELD_OFFERS => array( |
|
| 896 | + 'predicate' => 'http://schema.org/offers', |
|
| 897 | + 'type' => self::DATA_TYPE_URI, |
|
| 898 | + 'export_type' => 'http://schema.org/Offer', |
|
| 899 | + 'constraints' => array( |
|
| 900 | + 'uri_type' => array( 'Offer' ), |
|
| 901 | + 'cardinality' => INF, |
|
| 902 | + ), |
|
| 903 | + ), |
|
| 904 | + ), |
|
| 905 | + 'linked_data' => array( |
|
| 906 | + // ### schema:startDate. |
|
| 907 | + $this->rendition_factory->create( |
|
| 908 | + $this->storage_factory->post_meta( self::FIELD_DATE_START ), |
|
| 909 | + 'http://schema.org/startDate', |
|
| 910 | + self::DATA_TYPE_DATE_TIME |
|
| 911 | + ), |
|
| 912 | + // ### schema:endDate. |
|
| 913 | + $this->rendition_factory->create( |
|
| 914 | + $this->storage_factory->post_meta( self::FIELD_DATE_END ), |
|
| 915 | + 'http://schema.org/endDate', |
|
| 916 | + self::DATA_TYPE_DATE_TIME |
|
| 917 | + ), |
|
| 918 | + // ### schema:location. |
|
| 919 | + $this->rendition_factory->create( |
|
| 920 | + $this->storage_factory->post_meta_to_uri( self::FIELD_LOCATION ), |
|
| 921 | + 'http://schema.org/location', |
|
| 922 | + self::DATA_TYPE_URI |
|
| 923 | + ), |
|
| 924 | + // ### schema:performer. |
|
| 925 | + $this->rendition_factory->create( |
|
| 926 | + $this->storage_factory->post_meta_to_uri( self::FIELD_PERFORMER ), |
|
| 927 | + 'http://schema.org/performer', |
|
| 928 | + self::DATA_TYPE_URI |
|
| 929 | + ), |
|
| 930 | + // ### schema:offers. |
|
| 931 | + $this->rendition_factory->create( |
|
| 932 | + $this->storage_factory->post_meta_to_uri( self::FIELD_OFFERS ), |
|
| 933 | + 'http://schema.org/offers', |
|
| 934 | + self::DATA_TYPE_URI |
|
| 935 | + ), |
|
| 936 | + ), |
|
| 937 | + 'templates' => array( |
|
| 938 | + 'subtitle' => '{{id}}', |
|
| 939 | + ), |
|
| 940 | + ); |
|
| 941 | + |
|
| 942 | + // Merge the custom fields with those provided by the thing schema. |
|
| 943 | + $parent_schema = $this->get_thing_schema(); |
|
| 944 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 945 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 946 | + |
|
| 947 | + return $schema; |
|
| 948 | + } |
|
| 949 | + |
|
| 950 | + /** |
|
| 951 | + * Get the 'organization' schema. |
|
| 952 | + * |
|
| 953 | + * @return array An array with the schema configuration. |
|
| 954 | + * |
|
| 955 | + * @since 3.1.0 |
|
| 956 | + */ |
|
| 957 | + private function get_organization_schema() { |
|
| 958 | + |
|
| 959 | + $schema = array( |
|
| 960 | + 'label' => 'Organization', |
|
| 961 | + 'description' => 'An organization, including a government or a newspaper.', |
|
| 962 | + 'parents' => array( 'thing' ), |
|
| 963 | + 'css_class' => 'wl-organization', |
|
| 964 | + 'uri' => 'http://schema.org/Organization', |
|
| 965 | + 'same_as' => array( |
|
| 966 | + 'http://rdf.freebase.com/ns/organization.organization', |
|
| 967 | + 'http://rdf.freebase.com/ns/government.government', |
|
| 968 | + 'http://schema.org/Newspaper', |
|
| 969 | + ), |
|
| 970 | + 'custom_fields' => array( |
|
| 971 | + self::FIELD_LEGAL_NAME => array( |
|
| 972 | + 'predicate' => 'http://schema.org/legalName', |
|
| 973 | + 'type' => self::DATA_TYPE_STRING, |
|
| 974 | + 'export_type' => 'xsd:string', |
|
| 975 | + 'constraints' => '', |
|
| 976 | + ), |
|
| 977 | + self::FIELD_FOUNDER => array( |
|
| 978 | + 'predicate' => 'http://schema.org/founder', |
|
| 979 | + 'type' => self::DATA_TYPE_URI, |
|
| 980 | + 'export_type' => 'http://schema.org/Person', |
|
| 981 | + 'constraints' => array( |
|
| 982 | + 'uri_type' => 'Person', |
|
| 983 | + 'cardinality' => INF, |
|
| 984 | + ), |
|
| 985 | + ), |
|
| 986 | + self::FIELD_ADDRESS => array( |
|
| 987 | + 'predicate' => 'http://schema.org/streetAddress', |
|
| 988 | + 'type' => self::DATA_TYPE_STRING, |
|
| 989 | + 'export_type' => 'xsd:string', |
|
| 990 | + 'constraints' => '', |
|
| 991 | + // To build custom metabox. |
|
| 992 | + 'input_field' => 'address', |
|
| 993 | + ), |
|
| 994 | + self::FIELD_ADDRESS_PO_BOX => array( |
|
| 995 | + 'predicate' => 'http://schema.org/postOfficeBoxNumber', |
|
| 996 | + 'type' => self::DATA_TYPE_STRING, |
|
| 997 | + 'export_type' => 'xsd:string', |
|
| 998 | + 'constraints' => '', |
|
| 999 | + // To build custom metabox. |
|
| 1000 | + 'input_field' => 'address', |
|
| 1001 | + ), |
|
| 1002 | + self::FIELD_ADDRESS_POSTAL_CODE => array( |
|
| 1003 | + 'predicate' => 'http://schema.org/postalCode', |
|
| 1004 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1005 | + 'export_type' => 'xsd:string', |
|
| 1006 | + 'constraints' => '', |
|
| 1007 | + // To build custom metabox. |
|
| 1008 | + 'input_field' => 'address', |
|
| 1009 | + ), |
|
| 1010 | + self::FIELD_ADDRESS_LOCALITY => array( |
|
| 1011 | + 'predicate' => 'http://schema.org/addressLocality', |
|
| 1012 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1013 | + 'export_type' => 'xsd:string', |
|
| 1014 | + 'constraints' => '', |
|
| 1015 | + // To build custom metabox. |
|
| 1016 | + 'input_field' => 'address', |
|
| 1017 | + ), |
|
| 1018 | + self::FIELD_ADDRESS_REGION => array( |
|
| 1019 | + 'predicate' => 'http://schema.org/addressRegion', |
|
| 1020 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1021 | + 'export_type' => 'xsd:string', |
|
| 1022 | + 'constraints' => '', |
|
| 1023 | + // To build custom metabox. |
|
| 1024 | + 'input_field' => 'address', |
|
| 1025 | + ), |
|
| 1026 | + self::FIELD_ADDRESS_COUNTRY => array( |
|
| 1027 | + 'predicate' => 'http://schema.org/addressCountry', |
|
| 1028 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1029 | + 'export_type' => 'xsd:string', |
|
| 1030 | + 'constraints' => '', |
|
| 1031 | + // To build custom metabox. |
|
| 1032 | + 'input_field' => 'address', |
|
| 1033 | + ), |
|
| 1034 | + self::FIELD_EMAIL => array( |
|
| 1035 | + 'predicate' => 'http://schema.org/email', |
|
| 1036 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1037 | + 'export_type' => 'xsd:string', |
|
| 1038 | + 'constraints' => '', |
|
| 1039 | + ), |
|
| 1040 | + self::FIELD_TELEPHONE => array( |
|
| 1041 | + 'predicate' => 'http://schema.org/telephone', |
|
| 1042 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1043 | + 'export_type' => 'xsd:string', |
|
| 1044 | + 'constraints' => '', |
|
| 1045 | + ), |
|
| 1046 | + ), |
|
| 1047 | + 'linked_data' => array( |
|
| 1048 | + // ### schema:legalName. |
|
| 1049 | + $this->rendition_factory->create( |
|
| 1050 | + $this->storage_factory->post_meta( self::FIELD_LEGAL_NAME ), |
|
| 1051 | + 'http://schema.org/legalName' |
|
| 1052 | + ), |
|
| 1053 | + // ### schema:founder. |
|
| 1054 | + $this->rendition_factory->create( |
|
| 1055 | + $this->storage_factory->post_meta_to_uri( self::FIELD_FOUNDER ), |
|
| 1056 | + 'http://schema.org/founder', |
|
| 1057 | + self::DATA_TYPE_URI |
|
| 1058 | + ), |
|
| 1059 | + // ### schema:email. |
|
| 1060 | + $this->rendition_factory->create( |
|
| 1061 | + $this->storage_factory->post_meta( self::FIELD_EMAIL ), |
|
| 1062 | + 'http://schema.org/email' |
|
| 1063 | + ), |
|
| 1064 | + // ### schema:telephone. |
|
| 1065 | + $this->rendition_factory->create( |
|
| 1066 | + $this->storage_factory->post_meta( self::FIELD_TELEPHONE ), |
|
| 1067 | + 'http://schema.org/telephone' |
|
| 1068 | + ), |
|
| 1069 | + ), |
|
| 1070 | + 'templates' => array( |
|
| 1071 | + 'subtitle' => '{{id}}', |
|
| 1072 | + ), |
|
| 1073 | + ); |
|
| 1074 | + |
|
| 1075 | + // Merge the custom fields with those provided by the thing schema. |
|
| 1076 | + $parent_schema = $this->get_thing_schema(); |
|
| 1077 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1078 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1079 | + |
|
| 1080 | + return $schema; |
|
| 1081 | + } |
|
| 1082 | + |
|
| 1083 | + /** |
|
| 1084 | + * Get the 'person' schema. |
|
| 1085 | + * |
|
| 1086 | + * @return array An array with the schema configuration. |
|
| 1087 | + * |
|
| 1088 | + * @since 3.1.0 |
|
| 1089 | + */ |
|
| 1090 | + private function get_person_schema() { |
|
| 1091 | + |
|
| 1092 | + $schema = array( |
|
| 1093 | + 'label' => 'Person', |
|
| 1094 | + 'description' => 'A person (or a music artist).', |
|
| 1095 | + 'parents' => array( 'thing' ), |
|
| 1096 | + 'css_class' => 'wl-person', |
|
| 1097 | + 'uri' => 'http://schema.org/Person', |
|
| 1098 | + 'same_as' => array( |
|
| 1099 | + 'http://rdf.freebase.com/ns/people.person', |
|
| 1100 | + 'http://rdf.freebase.com/ns/music.artist', |
|
| 1101 | + 'http://dbpedia.org/class/yago/LivingPeople', |
|
| 1102 | + ), |
|
| 1103 | + 'custom_fields' => array( |
|
| 1104 | + self::FIELD_KNOWS => array( |
|
| 1105 | + 'predicate' => 'http://schema.org/knows', |
|
| 1106 | + 'type' => self::DATA_TYPE_URI, |
|
| 1107 | + 'export_type' => 'http://schema.org/Person', |
|
| 1108 | + 'constraints' => array( |
|
| 1109 | + 'uri_type' => 'Person', |
|
| 1110 | + 'cardinality' => INF, |
|
| 1111 | + ), |
|
| 1112 | + ), |
|
| 1113 | + self::FIELD_BIRTH_DATE => array( |
|
| 1114 | + 'predicate' => 'http://schema.org/birthDate', |
|
| 1115 | + 'type' => self::DATA_TYPE_DATE, |
|
| 1116 | + 'export_type' => 'xsd:date', |
|
| 1117 | + 'constraints' => '', |
|
| 1118 | + ), |
|
| 1119 | + self::FIELD_BIRTH_PLACE => array( |
|
| 1120 | + 'predicate' => 'http://schema.org/birthPlace', |
|
| 1121 | + 'type' => self::DATA_TYPE_URI, |
|
| 1122 | + 'export_type' => 'http://schema.org/Place', |
|
| 1123 | + 'constraints' => array( |
|
| 1124 | + 'uri_type' => 'Place', |
|
| 1125 | + ), |
|
| 1126 | + ), |
|
| 1127 | + self::FIELD_AFFILIATION => array( |
|
| 1128 | + 'predicate' => 'http://schema.org/affiliation', |
|
| 1129 | + 'type' => self::DATA_TYPE_URI, |
|
| 1130 | + 'export_type' => 'http://schema.org/Organization', |
|
| 1131 | + 'constraints' => array( |
|
| 1132 | + 'uri_type' => array( |
|
| 1133 | + 'Organization', |
|
| 1134 | + 'LocalBusiness', |
|
| 1135 | + ), |
|
| 1136 | + 'cardinality' => INF, |
|
| 1137 | + ), |
|
| 1138 | + ), |
|
| 1139 | + self::FIELD_EMAIL => array( |
|
| 1140 | + 'predicate' => 'http://schema.org/email', |
|
| 1141 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1142 | + 'export_type' => 'xsd:string', |
|
| 1143 | + 'constraints' => array( |
|
| 1144 | + 'cardinality' => INF, |
|
| 1145 | + ), |
|
| 1146 | + ), |
|
| 1147 | + ), |
|
| 1148 | + 'linked_data' => array( |
|
| 1149 | + // ### schema:knows. |
|
| 1150 | + $this->rendition_factory->create( |
|
| 1151 | + $this->storage_factory->post_meta_to_uri( self::FIELD_KNOWS ), |
|
| 1152 | + 'http://schema.org/knows', |
|
| 1153 | + self::DATA_TYPE_URI |
|
| 1154 | + ), |
|
| 1155 | + // ### schema:birthDate. |
|
| 1156 | + $this->rendition_factory->create( |
|
| 1157 | + $this->storage_factory->post_meta( self::FIELD_BIRTH_DATE ), |
|
| 1158 | + 'http://schema.org/birthDate', |
|
| 1159 | + self::DATA_TYPE_DATE |
|
| 1160 | + ), |
|
| 1161 | + // ### schema:birthPlace. |
|
| 1162 | + $this->rendition_factory->create( |
|
| 1163 | + $this->storage_factory->post_meta_to_uri( self::FIELD_BIRTH_PLACE ), |
|
| 1164 | + 'http://schema.org/birthPlace', |
|
| 1165 | + self::DATA_TYPE_URI |
|
| 1166 | + ), |
|
| 1167 | + // ### schema:affiliation. |
|
| 1168 | + $this->rendition_factory->create( |
|
| 1169 | + $this->storage_factory->post_meta_to_uri( self::FIELD_AFFILIATION ), |
|
| 1170 | + 'http://schema.org/affiliation', |
|
| 1171 | + self::DATA_TYPE_URI |
|
| 1172 | + ), |
|
| 1173 | + // ### schema:email. |
|
| 1174 | + $this->rendition_factory->create( |
|
| 1175 | + $this->storage_factory->post_meta( self::FIELD_EMAIL ), |
|
| 1176 | + 'http://schema.org/email' |
|
| 1177 | + ), |
|
| 1178 | + ), |
|
| 1179 | + 'templates' => array( |
|
| 1180 | + 'subtitle' => '{{id}}', |
|
| 1181 | + ), |
|
| 1182 | + ); |
|
| 1183 | + |
|
| 1184 | + // Merge the custom fields with those provided by the thing schema. |
|
| 1185 | + $parent_schema = $this->get_thing_schema(); |
|
| 1186 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1187 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1188 | + |
|
| 1189 | + return $schema; |
|
| 1190 | + |
|
| 1191 | + } |
|
| 1192 | + |
|
| 1193 | + /** |
|
| 1194 | + * Get the 'place' schema. |
|
| 1195 | + * |
|
| 1196 | + * @return array An array with the schema configuration. |
|
| 1197 | + * |
|
| 1198 | + * @since 3.1.0 |
|
| 1199 | + */ |
|
| 1200 | + private function get_place_schema() { |
|
| 1201 | + |
|
| 1202 | + $schema = array( |
|
| 1203 | + 'label' => 'Place', |
|
| 1204 | + 'description' => 'A place.', |
|
| 1205 | + 'parents' => array( 'thing' ), |
|
| 1206 | + 'css_class' => 'wl-place', |
|
| 1207 | + 'uri' => 'http://schema.org/Place', |
|
| 1208 | + 'same_as' => array( |
|
| 1209 | + 'http://rdf.freebase.com/ns/location.location', |
|
| 1210 | + 'http://www.opengis.net/gml/_Feature', |
|
| 1211 | + ), |
|
| 1212 | + 'custom_fields' => array( |
|
| 1213 | + self::FIELD_GEO_LATITUDE => array( |
|
| 1214 | + 'predicate' => 'http://schema.org/latitude', |
|
| 1215 | + 'type' => self::DATA_TYPE_DOUBLE, |
|
| 1216 | + 'export_type' => 'xsd:double', |
|
| 1217 | + 'constraints' => '', |
|
| 1218 | + // To build custom metabox. |
|
| 1219 | + 'input_field' => 'coordinates', |
|
| 1220 | + ), |
|
| 1221 | + self::FIELD_GEO_LONGITUDE => array( |
|
| 1222 | + 'predicate' => 'http://schema.org/longitude', |
|
| 1223 | + 'type' => self::DATA_TYPE_DOUBLE, |
|
| 1224 | + 'export_type' => 'xsd:double', |
|
| 1225 | + 'constraints' => '', |
|
| 1226 | + // To build custom metabox. |
|
| 1227 | + 'input_field' => 'coordinates', |
|
| 1228 | + ), |
|
| 1229 | + self::FIELD_ADDRESS => array( |
|
| 1230 | + 'predicate' => 'http://schema.org/streetAddress', |
|
| 1231 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1232 | + 'export_type' => 'xsd:string', |
|
| 1233 | + 'constraints' => '', |
|
| 1234 | + // To build custom metabox. |
|
| 1235 | + 'input_field' => 'address', |
|
| 1236 | + ), |
|
| 1237 | + self::FIELD_ADDRESS_PO_BOX => array( |
|
| 1238 | + 'predicate' => 'http://schema.org/postOfficeBoxNumber', |
|
| 1239 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1240 | + 'export_type' => 'xsd:string', |
|
| 1241 | + 'constraints' => '', |
|
| 1242 | + // To build custom metabox. |
|
| 1243 | + 'input_field' => 'address', |
|
| 1244 | + ), |
|
| 1245 | + self::FIELD_ADDRESS_POSTAL_CODE => array( |
|
| 1246 | + 'predicate' => 'http://schema.org/postalCode', |
|
| 1247 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1248 | + 'export_type' => 'xsd:string', |
|
| 1249 | + 'constraints' => '', |
|
| 1250 | + // To build custom metabox. |
|
| 1251 | + 'input_field' => 'address', |
|
| 1252 | + ), |
|
| 1253 | + self::FIELD_ADDRESS_LOCALITY => array( |
|
| 1254 | + 'predicate' => 'http://schema.org/addressLocality', |
|
| 1255 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1256 | + 'export_type' => 'xsd:string', |
|
| 1257 | + 'constraints' => '', |
|
| 1258 | + // To build custom metabox. |
|
| 1259 | + 'input_field' => 'address', |
|
| 1260 | + ), |
|
| 1261 | + self::FIELD_ADDRESS_REGION => array( |
|
| 1262 | + 'predicate' => 'http://schema.org/addressRegion', |
|
| 1263 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1264 | + 'export_type' => 'xsd:string', |
|
| 1265 | + 'constraints' => '', |
|
| 1266 | + // To build custom metabox. |
|
| 1267 | + 'input_field' => 'address', |
|
| 1268 | + ), |
|
| 1269 | + self::FIELD_ADDRESS_COUNTRY => array( |
|
| 1270 | + 'predicate' => 'http://schema.org/addressCountry', |
|
| 1271 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1272 | + 'export_type' => 'xsd:string', |
|
| 1273 | + 'constraints' => '', |
|
| 1274 | + // To build custom metabox. |
|
| 1275 | + 'input_field' => 'address', |
|
| 1276 | + ), |
|
| 1277 | + ), |
|
| 1278 | + 'linked_data' => array( |
|
| 1279 | + $this->rendition_factory->create_address( |
|
| 1280 | + $this->storage_factory, |
|
| 1281 | + $this->language_code |
|
| 1282 | + ), |
|
| 1283 | + ), |
|
| 1284 | + 'templates' => array( |
|
| 1285 | + 'subtitle' => '{{id}}', |
|
| 1286 | + ), |
|
| 1287 | + ); |
|
| 1288 | + |
|
| 1289 | + // Merge the custom fields with those provided by the thing schema. |
|
| 1290 | + $parent_schema = $this->get_thing_schema(); |
|
| 1291 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1292 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1293 | + |
|
| 1294 | + return $schema; |
|
| 1295 | + } |
|
| 1296 | + |
|
| 1297 | + /** |
|
| 1298 | + * Get the 'local business' schema. |
|
| 1299 | + * |
|
| 1300 | + * @return array An array with the schema configuration. |
|
| 1301 | + * |
|
| 1302 | + * @since 3.1.0 |
|
| 1303 | + */ |
|
| 1304 | + private function get_local_business_schema() { |
|
| 1305 | + |
|
| 1306 | + $schema = array( |
|
| 1307 | + 'label' => 'LocalBusiness', |
|
| 1308 | + 'description' => 'A local business.', |
|
| 1309 | + 'parents' => array( 'place', 'organization' ), |
|
| 1310 | + 'css_class' => 'wl-local-business', |
|
| 1311 | + 'uri' => 'http://schema.org/LocalBusiness', |
|
| 1312 | + 'same_as' => array( |
|
| 1313 | + 'http://rdf.freebase.com/ns/business/business_location', |
|
| 1314 | + 'https://schema.org/Store', |
|
| 1315 | + ), |
|
| 1316 | + 'custom_fields' => array(), |
|
| 1317 | + 'linked_data' => array(), |
|
| 1318 | + 'templates' => array( |
|
| 1319 | + 'subtitle' => '{{id}}', |
|
| 1320 | + ), |
|
| 1321 | + ); |
|
| 1322 | + |
|
| 1323 | + // Merge the custom fields with those provided by the place and organization schema. |
|
| 1324 | + $place_schema = $this->get_place_schema(); |
|
| 1325 | + $organization_schema = $this->get_organization_schema(); |
|
| 1326 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $place_schema['custom_fields'], $organization_schema['custom_fields'] ); |
|
| 1327 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $place_schema['linked_data'], $organization_schema['linked_data'] ); |
|
| 1328 | + |
|
| 1329 | + return $schema; |
|
| 1330 | + } |
|
| 1331 | + |
|
| 1332 | + /** |
|
| 1333 | + * Get the 'recipe' schema. |
|
| 1334 | + * |
|
| 1335 | + * @return array An array with the schema configuration. |
|
| 1336 | + * |
|
| 1337 | + * @since 3.14.0 |
|
| 1338 | + */ |
|
| 1339 | + private function get_recipe_schema() { |
|
| 1340 | + |
|
| 1341 | + $schema = array( |
|
| 1342 | + 'label' => 'Recipe', |
|
| 1343 | + 'description' => 'A Recipe.', |
|
| 1344 | + 'parents' => array( 'CreativeWork' ), |
|
| 1345 | + 'css_class' => 'wl-recipe', |
|
| 1346 | + 'uri' => 'http://schema.org/Recipe', |
|
| 1347 | + 'same_as' => array(), |
|
| 1348 | + 'templates' => array( |
|
| 1349 | + 'subtitle' => '{{id}}', |
|
| 1350 | + ), |
|
| 1351 | + 'custom_fields' => array( |
|
| 1352 | + self::FIELD_RECIPE_CUISINE => array( |
|
| 1353 | + 'predicate' => 'http://schema.org/recipeCuisine', |
|
| 1354 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1355 | + 'export_type' => 'xsd:string', |
|
| 1356 | + 'constraints' => '', |
|
| 1357 | + 'metabox' => array( |
|
| 1358 | + 'label' => __( 'Recipe cuisine', 'wordlift' ), |
|
| 1359 | + ), |
|
| 1360 | + ), |
|
| 1361 | + self::FIELD_RECIPE_INGREDIENT => array( |
|
| 1362 | + 'predicate' => 'http://schema.org/recipeIngredient', |
|
| 1363 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1364 | + 'export_type' => 'xsd:string', |
|
| 1365 | + 'constraints' => array( |
|
| 1366 | + 'cardinality' => INF, |
|
| 1367 | + ), |
|
| 1368 | + 'metabox' => array( |
|
| 1369 | + 'label' => __( 'Recipe ingredient', 'wordlift' ), |
|
| 1370 | + ), |
|
| 1371 | + ), |
|
| 1372 | + self::FIELD_RECIPE_INSTRUCTIONS => array( |
|
| 1373 | + 'predicate' => 'http://schema.org/recipeInstructions', |
|
| 1374 | + 'type' => self::DATA_TYPE_MULTILINE, |
|
| 1375 | + 'export_type' => 'xsd:string', |
|
| 1376 | + 'constraints' => '', |
|
| 1377 | + 'metabox' => array( |
|
| 1378 | + 'class' => 'Wordlift_Metabox_Field_Multiline', |
|
| 1379 | + 'label' => __( 'Recipe instructions', 'wordlift' ), |
|
| 1380 | + ), |
|
| 1381 | + ), |
|
| 1382 | + self::FIELD_RECIPE_YIELD => array( |
|
| 1383 | + 'predicate' => 'http://schema.org/recipeYield', |
|
| 1384 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1385 | + 'export_type' => 'xsd:string', |
|
| 1386 | + 'constraints' => '', |
|
| 1387 | + 'metabox' => array( |
|
| 1388 | + 'label' => __( 'Recipe number of servings', 'wordlift' ), |
|
| 1389 | + ), |
|
| 1390 | + ), |
|
| 1391 | + self::FIELD_RECIPE_INGREDIENT => array( |
|
| 1392 | + 'predicate' => 'http://schema.org/recipeIngredient', |
|
| 1393 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1394 | + 'export_type' => 'xsd:string', |
|
| 1395 | + 'constraints' => array( |
|
| 1396 | + 'cardinality' => INF, |
|
| 1397 | + ), |
|
| 1398 | + 'metabox' => array( |
|
| 1399 | + 'label' => __( 'Recipe ingredient', 'wordlift' ), |
|
| 1400 | + ), |
|
| 1401 | + ), |
|
| 1402 | + self::FIELD_NUTRITION_INFO_CALORIES => array( |
|
| 1403 | + 'predicate' => 'http://schema.org/calories', |
|
| 1404 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1405 | + 'export_type' => 'xsd:string', |
|
| 1406 | + 'constraints' => '', |
|
| 1407 | + 'metabox' => array( |
|
| 1408 | + 'label' => __( 'Calories (e.g. 240 calories)', 'wordlift' ), |
|
| 1409 | + ), |
|
| 1410 | + ), |
|
| 1411 | + self::FIELD_PREP_TIME => array( |
|
| 1412 | + 'predicate' => 'http://schema.org/prepTime', |
|
| 1413 | + 'type' => self::DATA_TYPE_DURATION, |
|
| 1414 | + 'export_type' => 'xsd:time', |
|
| 1415 | + 'constraints' => '', |
|
| 1416 | + 'metabox' => array( |
|
| 1417 | + 'class' => 'Wordlift_Metabox_Field_Duration', |
|
| 1418 | + 'label' => __( 'Recipe preparation time (e.g. 1:30)', 'wordlift' ), |
|
| 1419 | + ), |
|
| 1420 | + ), |
|
| 1421 | + self::FIELD_COOK_TIME => array( |
|
| 1422 | + 'predicate' => 'http://schema.org/cookTime', |
|
| 1423 | + 'type' => self::DATA_TYPE_DURATION, |
|
| 1424 | + 'export_type' => 'xsd:time', |
|
| 1425 | + 'constraints' => '', |
|
| 1426 | + 'metabox' => array( |
|
| 1427 | + 'class' => 'Wordlift_Metabox_Field_Duration', |
|
| 1428 | + 'label' => __( 'Recipe cook time (e.g. 1:30)', 'wordlift' ), |
|
| 1429 | + ), |
|
| 1430 | + ), |
|
| 1431 | + self::FIELD_TOTAL_TIME => array( |
|
| 1432 | + 'predicate' => 'http://schema.org/totalTime', |
|
| 1433 | + 'type' => self::DATA_TYPE_DURATION, |
|
| 1434 | + 'export_type' => 'xsd:time', |
|
| 1435 | + 'constraints' => '', |
|
| 1436 | + 'metabox' => array( |
|
| 1437 | + 'class' => 'Wordlift_Metabox_Field_Duration', |
|
| 1438 | + 'label' => __( 'Recipe total time (e.g. 1:30)', 'wordlift' ), |
|
| 1439 | + ), |
|
| 1440 | + ), |
|
| 1441 | + ), |
|
| 1442 | + 'linked_data' => array( |
|
| 1443 | + // ### schema:recipeCuisine. |
|
| 1444 | + $this->rendition_factory->create( |
|
| 1445 | + $this->storage_factory->post_meta( self::FIELD_RECIPE_CUISINE ), |
|
| 1446 | + 'http://schema.org/recipeCuisine' |
|
| 1447 | + ), |
|
| 1448 | + // ### schema:recipeIngredient. |
|
| 1449 | + $this->rendition_factory->create( |
|
| 1450 | + $this->storage_factory->post_meta( self::FIELD_RECIPE_INGREDIENT ), |
|
| 1451 | + 'http://schema.org/recipeIngredient' |
|
| 1452 | + ), |
|
| 1453 | + // ### schema:recipeInstructions. |
|
| 1454 | + $this->rendition_factory->create( |
|
| 1455 | + $this->storage_factory->post_meta( self::FIELD_RECIPE_INSTRUCTIONS ), |
|
| 1456 | + 'http://schema.org/recipeInstructions' |
|
| 1457 | + ), |
|
| 1458 | + // ### schema:recipeYield. |
|
| 1459 | + $this->rendition_factory->create( |
|
| 1460 | + $this->storage_factory->post_meta( self::FIELD_RECIPE_YIELD ), |
|
| 1461 | + 'http://schema.org/recipeYield' |
|
| 1462 | + ), |
|
| 1463 | + // ### schema:prepTime. |
|
| 1464 | + $this->rendition_factory->create( |
|
| 1465 | + $this->storage_factory->post_meta( self::FIELD_PREP_TIME ), |
|
| 1466 | + 'http://schema.org/prepTime', |
|
| 1467 | + self::DATA_TYPE_DURATION |
|
| 1468 | + ), |
|
| 1469 | + // ### schema:cookTime. |
|
| 1470 | + $this->rendition_factory->create( |
|
| 1471 | + $this->storage_factory->post_meta( self::FIELD_COOK_TIME ), |
|
| 1472 | + 'http://schema.org/cookTime', |
|
| 1473 | + self::DATA_TYPE_DURATION |
|
| 1474 | + ), |
|
| 1475 | + // ### schema:totalTime. |
|
| 1476 | + $this->rendition_factory->create( |
|
| 1477 | + $this->storage_factory->post_meta( self::FIELD_TOTAL_TIME ), |
|
| 1478 | + 'http://schema.org/totalTime', |
|
| 1479 | + self::DATA_TYPE_DURATION |
|
| 1480 | + ), |
|
| 1481 | + ), |
|
| 1482 | + ); |
|
| 1483 | + |
|
| 1484 | + // Merge the custom fields with those provided by the parent schema. |
|
| 1485 | + $parent_schema = $this->get_creative_work_schema(); |
|
| 1486 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1487 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1488 | + |
|
| 1489 | + return $schema; |
|
| 1490 | + } |
|
| 1491 | + |
|
| 1492 | + /** |
|
| 1493 | + * Get the 'offer' schema. |
|
| 1494 | + * |
|
| 1495 | + * @return array An array with the schema configuration. |
|
| 1496 | + * |
|
| 1497 | + * @since 3.18.0 |
|
| 1498 | + */ |
|
| 1499 | + private function get_offer_schema() { |
|
| 1500 | + |
|
| 1501 | + $schema = array( |
|
| 1502 | + 'label' => 'Offer', |
|
| 1503 | + 'description' => 'An offer. ', |
|
| 1504 | + 'parents' => array( 'thing' ), |
|
| 1505 | + 'css_class' => 'wl-offer', |
|
| 1506 | + 'uri' => self::SCHEMA_OFFER_TYPE, |
|
| 1507 | + 'same_as' => array(), |
|
| 1508 | + 'templates' => array( |
|
| 1509 | + 'subtitle' => '{{id}}', |
|
| 1510 | + ), |
|
| 1511 | + 'custom_fields' => array( |
|
| 1512 | + self::FIELD_AVAILABILITY => array( |
|
| 1513 | + 'predicate' => 'http://schema.org/availability', |
|
| 1514 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1515 | + 'export_type' => 'xsd:string', |
|
| 1516 | + 'metabox' => array( |
|
| 1517 | + 'class' => 'Wordlift_Metabox_Field_Select', |
|
| 1518 | + ), |
|
| 1519 | + 'options' => array( |
|
| 1520 | + 'Discontinued' => esc_html__( 'Discontinued', 'wordlift' ), |
|
| 1521 | + 'InStock' => esc_html__( 'In Stock', 'wordlift' ), |
|
| 1522 | + 'InStoreOnly' => esc_html__( 'In Store Only', 'wordlift' ), |
|
| 1523 | + 'LimitedAvailability' => esc_html__( 'Limited Availability', 'wordlift' ), |
|
| 1524 | + 'OnlineOnly' => esc_html__( 'Online Only', 'wordlift' ), |
|
| 1525 | + 'OutOfStock' => esc_html__( 'Out of Stock', 'wordlift' ), |
|
| 1526 | + 'PreOrder' => esc_html__( 'Pre Order', 'wordlift' ), |
|
| 1527 | + 'PreSale' => esc_html__( 'Pre Sale', 'wordlift' ), |
|
| 1528 | + 'SoldOut' => esc_html__( 'Sold Out', 'wordlift' ), |
|
| 1529 | + ), |
|
| 1530 | + ), |
|
| 1531 | + self::FIELD_PRICE => array( |
|
| 1532 | + 'predicate' => 'http://schema.org/price', |
|
| 1533 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1534 | + 'export_type' => 'xsd:integer', |
|
| 1535 | + 'metabox' => array( |
|
| 1536 | + 'class' => 'Wordlift_Metabox_Field_Integer', |
|
| 1537 | + ), |
|
| 1538 | + ), |
|
| 1539 | + self::FIELD_PRICE_CURRENCY => array( |
|
| 1540 | + 'predicate' => 'http://schema.org/priceCurrency', |
|
| 1541 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1542 | + 'export_type' => 'xsd:string', |
|
| 1543 | + ), |
|
| 1544 | + self::FIELD_AVAILABILITY_STARTS => array( |
|
| 1545 | + 'predicate' => 'http://schema.org/availabilityStarts', |
|
| 1546 | + 'type' => self::DATA_TYPE_DATE, |
|
| 1547 | + 'export_type' => 'xsd:dateTime', |
|
| 1548 | + ), |
|
| 1549 | + self::FIELD_AVAILABILITY_ENDS => array( |
|
| 1550 | + 'predicate' => 'http://schema.org/availabilityEnds', |
|
| 1551 | + 'type' => self::DATA_TYPE_DATE, |
|
| 1552 | + 'export_type' => 'xsd:dateTime', |
|
| 1553 | + ), |
|
| 1554 | + self::FIELD_INVENTORY_LEVEL => array( |
|
| 1555 | + 'predicate' => 'http://schema.org/inventoryLevel', |
|
| 1556 | + 'type' => self::DATA_TYPE_STRING, |
|
| 1557 | + 'export_type' => 'xsd:integer', |
|
| 1558 | + 'metabox' => array( |
|
| 1559 | + 'class' => 'Wordlift_Metabox_Field_Integer', |
|
| 1560 | + ), |
|
| 1561 | + ), |
|
| 1562 | + self::FIELD_VALID_FROM => array( |
|
| 1563 | + 'predicate' => 'http://schema.org/validFrom', |
|
| 1564 | + 'type' => self::DATA_TYPE_DATE, |
|
| 1565 | + 'export_type' => 'xsd:dateTime', |
|
| 1566 | + ), |
|
| 1567 | + self::FIELD_PRICE_VALID_UNTIL => array( |
|
| 1568 | + 'predicate' => 'http://schema.org/priceValidUntil', |
|
| 1569 | + 'type' => self::DATA_TYPE_DATE, |
|
| 1570 | + 'export_type' => 'xsd:dateTime', |
|
| 1571 | + ), |
|
| 1572 | + self::FIELD_ITEM_OFFERED => array( |
|
| 1573 | + 'predicate' => 'http://schema.org/itemOffered', |
|
| 1574 | + 'type' => self::DATA_TYPE_URI, |
|
| 1575 | + 'export_type' => 'http://schema.org/Thing', |
|
| 1576 | + 'constraints' => array( |
|
| 1577 | + 'uri_type' => array( |
|
| 1578 | + 'Event', |
|
| 1579 | + 'Thing', |
|
| 1580 | + ), |
|
| 1581 | + 'cardinality' => INF, |
|
| 1582 | + ), |
|
| 1583 | + ), |
|
| 1584 | + ), |
|
| 1585 | + 'linked_data' => array( |
|
| 1586 | + // ### schema:availability. |
|
| 1587 | + $this->rendition_factory->create( |
|
| 1588 | + $this->storage_factory->post_meta( self::FIELD_AVAILABILITY ), |
|
| 1589 | + 'http://schema.org/availability', |
|
| 1590 | + null |
|
| 1591 | + ), |
|
| 1592 | + // ### schema:availabilityStarts. |
|
| 1593 | + $this->rendition_factory->create( |
|
| 1594 | + $this->storage_factory->post_meta( self::FIELD_AVAILABILITY_STARTS ), |
|
| 1595 | + 'http://schema.org/availabilityStarts', |
|
| 1596 | + self::DATA_TYPE_DATE_TIME |
|
| 1597 | + ), |
|
| 1598 | + // ### schema:availabilityEnds. |
|
| 1599 | + $this->rendition_factory->create( |
|
| 1600 | + $this->storage_factory->post_meta( self::FIELD_AVAILABILITY_ENDS ), |
|
| 1601 | + 'http://schema.org/availabilityEnds', |
|
| 1602 | + self::DATA_TYPE_DATE_TIME |
|
| 1603 | + ), |
|
| 1604 | + // ### schema:inventoryLevel. |
|
| 1605 | + $this->rendition_factory->create( |
|
| 1606 | + $this->storage_factory->post_meta( self::FIELD_INVENTORY_LEVEL ), |
|
| 1607 | + 'http://schema.org/inventoryLevel', |
|
| 1608 | + self::DATA_TYPE_INTEGER |
|
| 1609 | + ), |
|
| 1610 | + // ### schema:price. |
|
| 1611 | + $this->rendition_factory->create( |
|
| 1612 | + $this->storage_factory->post_meta( self::FIELD_PRICE ), |
|
| 1613 | + 'http://schema.org/price', |
|
| 1614 | + self::DATA_TYPE_INTEGER |
|
| 1615 | + ), |
|
| 1616 | + // ### schema:priceCurrency. |
|
| 1617 | + $this->rendition_factory->create( |
|
| 1618 | + $this->storage_factory->post_meta( self::FIELD_PRICE_CURRENCY ), |
|
| 1619 | + 'http://schema.org/priceCurrency', |
|
| 1620 | + null |
|
| 1621 | + ), |
|
| 1622 | + // ### schema:validFrom. |
|
| 1623 | + $this->rendition_factory->create( |
|
| 1624 | + $this->storage_factory->post_meta( self::FIELD_VALID_FROM ), |
|
| 1625 | + 'http://schema.org/validFrom', |
|
| 1626 | + null |
|
| 1627 | + ), |
|
| 1628 | + // ### schema:priceValidUntil. |
|
| 1629 | + $this->rendition_factory->create( |
|
| 1630 | + $this->storage_factory->post_meta( self::FIELD_PRICE_VALID_UNTIL ), |
|
| 1631 | + 'http://schema.org/priceValidUntil', |
|
| 1632 | + null |
|
| 1633 | + ), |
|
| 1634 | + // ### schema:itemOffered. |
|
| 1635 | + $this->rendition_factory->create( |
|
| 1636 | + $this->storage_factory->post_meta_to_uri( self::FIELD_ITEM_OFFERED ), |
|
| 1637 | + 'http://schema.org/itemOffered', |
|
| 1638 | + self::DATA_TYPE_URI |
|
| 1639 | + ), |
|
| 1640 | + ), |
|
| 1641 | + ); |
|
| 1642 | + |
|
| 1643 | + // Merge the custom fields with those provided by the thing schema. |
|
| 1644 | + $parent_schema = $this->get_thing_schema(); |
|
| 1645 | + $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1646 | + $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1647 | + |
|
| 1648 | + return $schema; |
|
| 1649 | + } |
|
| 1650 | + |
|
| 1651 | + /** |
|
| 1652 | + * Get the 'article' schema. |
|
| 1653 | + * |
|
| 1654 | + * @return array An array with the schema configuration. |
|
| 1655 | + * |
|
| 1656 | + * @since 3.15.0 |
|
| 1657 | + */ |
|
| 1658 | + private function get_article_schema() { |
|
| 1659 | + |
|
| 1660 | + $schema = array( |
|
| 1661 | + 'label' => 'Article', |
|
| 1662 | + 'description' => 'An Article.', |
|
| 1663 | + 'parents' => array(), |
|
| 1664 | + 'css_class' => 'wl-article', |
|
| 1665 | + 'uri' => 'http://schema.org/Article', |
|
| 1666 | + 'same_as' => array(), |
|
| 1667 | + 'templates' => array( |
|
| 1668 | + 'subtitle' => '{{id}}', |
|
| 1669 | + ), |
|
| 1670 | + 'custom_fields' => array(), |
|
| 1671 | + 'linked_data' => array( |
|
| 1672 | + // ### schema:headline. |
|
| 1673 | + $this->rendition_factory->create( |
|
| 1674 | + $this->storage_factory->post_title(), |
|
| 1675 | + 'http://schema.org/headline', |
|
| 1676 | + null, |
|
| 1677 | + $this->language_code |
|
| 1678 | + ), |
|
| 1679 | + // ### schema:url. |
|
| 1680 | + $this->rendition_factory->create( |
|
| 1681 | + $this->storage_factory->url_property(), |
|
| 1682 | + Wordlift_Query_Builder::SCHEMA_URL_URI, |
|
| 1683 | + self::DATA_TYPE_URI |
|
| 1684 | + ), |
|
| 1685 | + // ### rdf:type. |
|
| 1686 | + $this->rendition_factory->create( |
|
| 1687 | + $this->storage_factory->schema_class(), |
|
| 1688 | + Wordlift_Query_Builder::RDFS_TYPE_URI, |
|
| 1689 | + self::DATA_TYPE_URI |
|
| 1690 | + ), |
|
| 1691 | + // ### dcterms:references. |
|
| 1692 | + $this->rendition_factory->create( |
|
| 1693 | + $this->storage_factory->relations(), |
|
| 1694 | + Wordlift_Query_Builder::DCTERMS_REFERENCES_URI, |
|
| 1695 | + self::DATA_TYPE_URI, |
|
| 1696 | + $this->language_code |
|
| 1697 | + ), |
|
| 1698 | + ), |
|
| 1699 | + ); |
|
| 1700 | + |
|
| 1701 | + return $schema; |
|
| 1702 | + } |
|
| 1703 | 1703 | |
| 1704 | 1704 | } |
@@ -467,9 +467,9 @@ discard block |
||
| 467 | 467 | * @param \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
| 468 | 468 | * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
| 469 | 469 | */ |
| 470 | - public function __construct( $storage_factory, $rendition_factory, $configuration_service ) { |
|
| 470 | + public function __construct($storage_factory, $rendition_factory, $configuration_service) { |
|
| 471 | 471 | |
| 472 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Schema_Service' ); |
|
| 472 | + $this->log = Wordlift_Log_Service::get_logger('Wordlift_Schema_Service'); |
|
| 473 | 473 | |
| 474 | 474 | $this->storage_factory = $storage_factory; |
| 475 | 475 | $this->rendition_factory = $rendition_factory; |
@@ -501,13 +501,13 @@ discard block |
||
| 501 | 501 | * |
| 502 | 502 | * @param array $schemas The array of schemas. |
| 503 | 503 | */ |
| 504 | - $this->schema = apply_filters( 'wl_schemas', $schemas ); |
|
| 504 | + $this->schema = apply_filters('wl_schemas', $schemas); |
|
| 505 | 505 | |
| 506 | 506 | // Create a singleton instance of the Schema service, useful to provide static functions to global functions. |
| 507 | 507 | self::$instance = $this; |
| 508 | 508 | |
| 509 | 509 | // Hook the `init` to allow plugins to add their schemas. |
| 510 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 510 | + add_action('init', array($this, 'init')); |
|
| 511 | 511 | |
| 512 | 512 | } |
| 513 | 513 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | */ |
| 519 | 519 | public function init() { |
| 520 | 520 | |
| 521 | - $this->schema = apply_filters( 'wl_schemas_init', $this->schema ); |
|
| 521 | + $this->schema = apply_filters('wl_schemas_init', $this->schema); |
|
| 522 | 522 | |
| 523 | 523 | } |
| 524 | 524 | |
@@ -544,18 +544,18 @@ discard block |
||
| 544 | 544 | * |
| 545 | 545 | * @return null|array An array of field's properties or null if the field is not found. |
| 546 | 546 | */ |
| 547 | - public function get_field( $key ) { |
|
| 547 | + public function get_field($key) { |
|
| 548 | 548 | |
| 549 | 549 | // Parse each schema's fields until we find the one we're looking for, then |
| 550 | 550 | // return its properties. |
| 551 | - foreach ( $this->schema as $_ => $schema ) { |
|
| 551 | + foreach ($this->schema as $_ => $schema) { |
|
| 552 | 552 | |
| 553 | - if ( ! isset( $schema['custom_fields'] ) ) { |
|
| 553 | + if ( ! isset($schema['custom_fields'])) { |
|
| 554 | 554 | break; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - foreach ( $schema['custom_fields'] as $field => $props ) { |
|
| 558 | - if ( $key === $field ) { |
|
| 557 | + foreach ($schema['custom_fields'] as $field => $props) { |
|
| 558 | + if ($key === $field) { |
|
| 559 | 559 | return $props; |
| 560 | 560 | } |
| 561 | 561 | } |
@@ -575,8 +575,8 @@ discard block |
||
| 575 | 575 | // Get the custom fields. |
| 576 | 576 | $renditions = array_reduce( |
| 577 | 577 | $this->schema, |
| 578 | - function ( $carry, $item ) { |
|
| 579 | - return array_merge( $carry, $item['linked_data'] ); |
|
| 578 | + function($carry, $item) { |
|
| 579 | + return array_merge($carry, $item['linked_data']); |
|
| 580 | 580 | }, |
| 581 | 581 | array() |
| 582 | 582 | ); |
@@ -594,14 +594,14 @@ discard block |
||
| 594 | 594 | * |
| 595 | 595 | * @since 3.1.0 |
| 596 | 596 | */ |
| 597 | - public function get_schema( $name ) { |
|
| 597 | + public function get_schema($name) { |
|
| 598 | 598 | // Check if the schema exists and, if not, return NULL. |
| 599 | - if ( ! isset( $this->schema[ $name ] ) ) { |
|
| 599 | + if ( ! isset($this->schema[$name])) { |
|
| 600 | 600 | return null; |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | // Return the requested schema. |
| 604 | - return $this->schema[ $name ]; |
|
| 604 | + return $this->schema[$name]; |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | /** |
@@ -613,10 +613,10 @@ discard block |
||
| 613 | 613 | * |
| 614 | 614 | * @since 3.3.0 |
| 615 | 615 | */ |
| 616 | - public function get_schema_by_uri( $uri ) { |
|
| 616 | + public function get_schema_by_uri($uri) { |
|
| 617 | 617 | |
| 618 | - foreach ( $this->schema as $name => $schema ) { |
|
| 619 | - if ( $schema['uri'] === $uri ) { |
|
| 618 | + foreach ($this->schema as $name => $schema) { |
|
| 619 | + if ($schema['uri'] === $uri) { |
|
| 620 | 620 | return $schema; |
| 621 | 621 | } |
| 622 | 622 | } |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | return array( |
| 637 | 637 | 'css_class' => 'wl-thing', |
| 638 | 638 | 'uri' => 'http://schema.org/Thing', |
| 639 | - 'same_as' => array( '*' ), |
|
| 639 | + 'same_as' => array('*'), |
|
| 640 | 640 | // set as default. |
| 641 | 641 | 'custom_fields' => array( |
| 642 | 642 | self::FIELD_SAME_AS => array( |
@@ -675,14 +675,14 @@ discard block |
||
| 675 | 675 | ), |
| 676 | 676 | // ### Alternative title to rdfs:label. |
| 677 | 677 | $this->rendition_factory->create( |
| 678 | - $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 678 | + $this->storage_factory->post_meta(Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY), |
|
| 679 | 679 | Wordlift_Query_Builder::RDFS_LABEL_URI, |
| 680 | 680 | null, |
| 681 | 681 | $this->language_code |
| 682 | 682 | ), |
| 683 | 683 | // ### Alternative title to dct:title. |
| 684 | 684 | $this->rendition_factory->create( |
| 685 | - $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 685 | + $this->storage_factory->post_meta(Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY), |
|
| 686 | 686 | 'http://purl.org/dc/terms/title', |
| 687 | 687 | null, |
| 688 | 688 | $this->language_code |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | ), |
| 697 | 697 | // ### Alternative title to schema:alterName. |
| 698 | 698 | $this->rendition_factory->create( |
| 699 | - $this->storage_factory->post_meta( Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ), |
|
| 699 | + $this->storage_factory->post_meta(Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY), |
|
| 700 | 700 | 'http://schema.org/alternateName', |
| 701 | 701 | null, |
| 702 | 702 | $this->language_code |
@@ -716,13 +716,13 @@ discard block |
||
| 716 | 716 | ), |
| 717 | 717 | // ### owl:sameAs. |
| 718 | 718 | $this->rendition_factory->create( |
| 719 | - $this->storage_factory->post_meta( self::FIELD_SAME_AS ), |
|
| 719 | + $this->storage_factory->post_meta(self::FIELD_SAME_AS), |
|
| 720 | 720 | 'http://www.w3.org/2002/07/owl#sameAs', |
| 721 | 721 | self::DATA_TYPE_URI |
| 722 | 722 | ), |
| 723 | 723 | // ### schema:sameAs. |
| 724 | 724 | $this->rendition_factory->create( |
| 725 | - $this->storage_factory->post_meta( self::FIELD_SAME_AS ), |
|
| 725 | + $this->storage_factory->post_meta(self::FIELD_SAME_AS), |
|
| 726 | 726 | 'http://schema.org/sameAs', |
| 727 | 727 | self::DATA_TYPE_URI |
| 728 | 728 | ), |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | $schema = array( |
| 806 | 806 | 'label' => 'CreativeWork', |
| 807 | 807 | 'description' => 'A creative work (or a Music Album).', |
| 808 | - 'parents' => array( 'thing' ), |
|
| 808 | + 'parents' => array('thing'), |
|
| 809 | 809 | // Give term slug as parent. |
| 810 | 810 | 'css_class' => 'wl-creative-work', |
| 811 | 811 | 'uri' => 'http://schema.org/CreativeWork', |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | 'type' => self::DATA_TYPE_URI, |
| 820 | 820 | 'export_type' => 'http://schema.org/Person', |
| 821 | 821 | 'constraints' => array( |
| 822 | - 'uri_type' => array( 'Person', 'Organization' ), |
|
| 822 | + 'uri_type' => array('Person', 'Organization'), |
|
| 823 | 823 | 'cardinality' => INF, |
| 824 | 824 | ), |
| 825 | 825 | ), |
@@ -839,8 +839,8 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | // Merge the custom fields with those provided by the thing schema. |
| 841 | 841 | $parent_schema = $this->get_thing_schema(); |
| 842 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 843 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 842 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 843 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 844 | 844 | |
| 845 | 845 | return $schema; |
| 846 | 846 | } |
@@ -857,10 +857,10 @@ discard block |
||
| 857 | 857 | $schema = array( |
| 858 | 858 | 'label' => 'Event', |
| 859 | 859 | 'description' => 'An event . ', |
| 860 | - 'parents' => array( 'thing' ), |
|
| 860 | + 'parents' => array('thing'), |
|
| 861 | 861 | 'css_class' => 'wl-event', |
| 862 | 862 | 'uri' => self::SCHEMA_EVENT_TYPE, |
| 863 | - 'same_as' => array( 'http://dbpedia.org/ontology/Event' ), |
|
| 863 | + 'same_as' => array('http://dbpedia.org/ontology/Event'), |
|
| 864 | 864 | 'custom_fields' => array( |
| 865 | 865 | self::FIELD_DATE_START => array( |
| 866 | 866 | 'predicate' => 'http://schema.org/startDate', |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | 'type' => self::DATA_TYPE_URI, |
| 880 | 880 | 'export_type' => 'http://schema.org/PostalAddress', |
| 881 | 881 | 'constraints' => array( |
| 882 | - 'uri_type' => array( 'Place', 'LocalBusiness' ), |
|
| 882 | + 'uri_type' => array('Place', 'LocalBusiness'), |
|
| 883 | 883 | 'cardinality' => INF, |
| 884 | 884 | ), |
| 885 | 885 | ), |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | 'type' => self::DATA_TYPE_URI, |
| 889 | 889 | 'export_type' => 'http://schema.org/Person', |
| 890 | 890 | 'constraints' => array( |
| 891 | - 'uri_type' => array( 'Person', 'Organization' ), |
|
| 891 | + 'uri_type' => array('Person', 'Organization'), |
|
| 892 | 892 | 'cardinality' => INF, |
| 893 | 893 | ), |
| 894 | 894 | ), |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | 'type' => self::DATA_TYPE_URI, |
| 898 | 898 | 'export_type' => 'http://schema.org/Offer', |
| 899 | 899 | 'constraints' => array( |
| 900 | - 'uri_type' => array( 'Offer' ), |
|
| 900 | + 'uri_type' => array('Offer'), |
|
| 901 | 901 | 'cardinality' => INF, |
| 902 | 902 | ), |
| 903 | 903 | ), |
@@ -905,31 +905,31 @@ discard block |
||
| 905 | 905 | 'linked_data' => array( |
| 906 | 906 | // ### schema:startDate. |
| 907 | 907 | $this->rendition_factory->create( |
| 908 | - $this->storage_factory->post_meta( self::FIELD_DATE_START ), |
|
| 908 | + $this->storage_factory->post_meta(self::FIELD_DATE_START), |
|
| 909 | 909 | 'http://schema.org/startDate', |
| 910 | 910 | self::DATA_TYPE_DATE_TIME |
| 911 | 911 | ), |
| 912 | 912 | // ### schema:endDate. |
| 913 | 913 | $this->rendition_factory->create( |
| 914 | - $this->storage_factory->post_meta( self::FIELD_DATE_END ), |
|
| 914 | + $this->storage_factory->post_meta(self::FIELD_DATE_END), |
|
| 915 | 915 | 'http://schema.org/endDate', |
| 916 | 916 | self::DATA_TYPE_DATE_TIME |
| 917 | 917 | ), |
| 918 | 918 | // ### schema:location. |
| 919 | 919 | $this->rendition_factory->create( |
| 920 | - $this->storage_factory->post_meta_to_uri( self::FIELD_LOCATION ), |
|
| 920 | + $this->storage_factory->post_meta_to_uri(self::FIELD_LOCATION), |
|
| 921 | 921 | 'http://schema.org/location', |
| 922 | 922 | self::DATA_TYPE_URI |
| 923 | 923 | ), |
| 924 | 924 | // ### schema:performer. |
| 925 | 925 | $this->rendition_factory->create( |
| 926 | - $this->storage_factory->post_meta_to_uri( self::FIELD_PERFORMER ), |
|
| 926 | + $this->storage_factory->post_meta_to_uri(self::FIELD_PERFORMER), |
|
| 927 | 927 | 'http://schema.org/performer', |
| 928 | 928 | self::DATA_TYPE_URI |
| 929 | 929 | ), |
| 930 | 930 | // ### schema:offers. |
| 931 | 931 | $this->rendition_factory->create( |
| 932 | - $this->storage_factory->post_meta_to_uri( self::FIELD_OFFERS ), |
|
| 932 | + $this->storage_factory->post_meta_to_uri(self::FIELD_OFFERS), |
|
| 933 | 933 | 'http://schema.org/offers', |
| 934 | 934 | self::DATA_TYPE_URI |
| 935 | 935 | ), |
@@ -941,8 +941,8 @@ discard block |
||
| 941 | 941 | |
| 942 | 942 | // Merge the custom fields with those provided by the thing schema. |
| 943 | 943 | $parent_schema = $this->get_thing_schema(); |
| 944 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 945 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 944 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 945 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 946 | 946 | |
| 947 | 947 | return $schema; |
| 948 | 948 | } |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | $schema = array( |
| 960 | 960 | 'label' => 'Organization', |
| 961 | 961 | 'description' => 'An organization, including a government or a newspaper.', |
| 962 | - 'parents' => array( 'thing' ), |
|
| 962 | + 'parents' => array('thing'), |
|
| 963 | 963 | 'css_class' => 'wl-organization', |
| 964 | 964 | 'uri' => 'http://schema.org/Organization', |
| 965 | 965 | 'same_as' => array( |
@@ -1047,23 +1047,23 @@ discard block |
||
| 1047 | 1047 | 'linked_data' => array( |
| 1048 | 1048 | // ### schema:legalName. |
| 1049 | 1049 | $this->rendition_factory->create( |
| 1050 | - $this->storage_factory->post_meta( self::FIELD_LEGAL_NAME ), |
|
| 1050 | + $this->storage_factory->post_meta(self::FIELD_LEGAL_NAME), |
|
| 1051 | 1051 | 'http://schema.org/legalName' |
| 1052 | 1052 | ), |
| 1053 | 1053 | // ### schema:founder. |
| 1054 | 1054 | $this->rendition_factory->create( |
| 1055 | - $this->storage_factory->post_meta_to_uri( self::FIELD_FOUNDER ), |
|
| 1055 | + $this->storage_factory->post_meta_to_uri(self::FIELD_FOUNDER), |
|
| 1056 | 1056 | 'http://schema.org/founder', |
| 1057 | 1057 | self::DATA_TYPE_URI |
| 1058 | 1058 | ), |
| 1059 | 1059 | // ### schema:email. |
| 1060 | 1060 | $this->rendition_factory->create( |
| 1061 | - $this->storage_factory->post_meta( self::FIELD_EMAIL ), |
|
| 1061 | + $this->storage_factory->post_meta(self::FIELD_EMAIL), |
|
| 1062 | 1062 | 'http://schema.org/email' |
| 1063 | 1063 | ), |
| 1064 | 1064 | // ### schema:telephone. |
| 1065 | 1065 | $this->rendition_factory->create( |
| 1066 | - $this->storage_factory->post_meta( self::FIELD_TELEPHONE ), |
|
| 1066 | + $this->storage_factory->post_meta(self::FIELD_TELEPHONE), |
|
| 1067 | 1067 | 'http://schema.org/telephone' |
| 1068 | 1068 | ), |
| 1069 | 1069 | ), |
@@ -1074,8 +1074,8 @@ discard block |
||
| 1074 | 1074 | |
| 1075 | 1075 | // Merge the custom fields with those provided by the thing schema. |
| 1076 | 1076 | $parent_schema = $this->get_thing_schema(); |
| 1077 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1078 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1077 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 1078 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 1079 | 1079 | |
| 1080 | 1080 | return $schema; |
| 1081 | 1081 | } |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | $schema = array( |
| 1093 | 1093 | 'label' => 'Person', |
| 1094 | 1094 | 'description' => 'A person (or a music artist).', |
| 1095 | - 'parents' => array( 'thing' ), |
|
| 1095 | + 'parents' => array('thing'), |
|
| 1096 | 1096 | 'css_class' => 'wl-person', |
| 1097 | 1097 | 'uri' => 'http://schema.org/Person', |
| 1098 | 1098 | 'same_as' => array( |
@@ -1148,31 +1148,31 @@ discard block |
||
| 1148 | 1148 | 'linked_data' => array( |
| 1149 | 1149 | // ### schema:knows. |
| 1150 | 1150 | $this->rendition_factory->create( |
| 1151 | - $this->storage_factory->post_meta_to_uri( self::FIELD_KNOWS ), |
|
| 1151 | + $this->storage_factory->post_meta_to_uri(self::FIELD_KNOWS), |
|
| 1152 | 1152 | 'http://schema.org/knows', |
| 1153 | 1153 | self::DATA_TYPE_URI |
| 1154 | 1154 | ), |
| 1155 | 1155 | // ### schema:birthDate. |
| 1156 | 1156 | $this->rendition_factory->create( |
| 1157 | - $this->storage_factory->post_meta( self::FIELD_BIRTH_DATE ), |
|
| 1157 | + $this->storage_factory->post_meta(self::FIELD_BIRTH_DATE), |
|
| 1158 | 1158 | 'http://schema.org/birthDate', |
| 1159 | 1159 | self::DATA_TYPE_DATE |
| 1160 | 1160 | ), |
| 1161 | 1161 | // ### schema:birthPlace. |
| 1162 | 1162 | $this->rendition_factory->create( |
| 1163 | - $this->storage_factory->post_meta_to_uri( self::FIELD_BIRTH_PLACE ), |
|
| 1163 | + $this->storage_factory->post_meta_to_uri(self::FIELD_BIRTH_PLACE), |
|
| 1164 | 1164 | 'http://schema.org/birthPlace', |
| 1165 | 1165 | self::DATA_TYPE_URI |
| 1166 | 1166 | ), |
| 1167 | 1167 | // ### schema:affiliation. |
| 1168 | 1168 | $this->rendition_factory->create( |
| 1169 | - $this->storage_factory->post_meta_to_uri( self::FIELD_AFFILIATION ), |
|
| 1169 | + $this->storage_factory->post_meta_to_uri(self::FIELD_AFFILIATION), |
|
| 1170 | 1170 | 'http://schema.org/affiliation', |
| 1171 | 1171 | self::DATA_TYPE_URI |
| 1172 | 1172 | ), |
| 1173 | 1173 | // ### schema:email. |
| 1174 | 1174 | $this->rendition_factory->create( |
| 1175 | - $this->storage_factory->post_meta( self::FIELD_EMAIL ), |
|
| 1175 | + $this->storage_factory->post_meta(self::FIELD_EMAIL), |
|
| 1176 | 1176 | 'http://schema.org/email' |
| 1177 | 1177 | ), |
| 1178 | 1178 | ), |
@@ -1183,8 +1183,8 @@ discard block |
||
| 1183 | 1183 | |
| 1184 | 1184 | // Merge the custom fields with those provided by the thing schema. |
| 1185 | 1185 | $parent_schema = $this->get_thing_schema(); |
| 1186 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1187 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1186 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 1187 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 1188 | 1188 | |
| 1189 | 1189 | return $schema; |
| 1190 | 1190 | |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | $schema = array( |
| 1203 | 1203 | 'label' => 'Place', |
| 1204 | 1204 | 'description' => 'A place.', |
| 1205 | - 'parents' => array( 'thing' ), |
|
| 1205 | + 'parents' => array('thing'), |
|
| 1206 | 1206 | 'css_class' => 'wl-place', |
| 1207 | 1207 | 'uri' => 'http://schema.org/Place', |
| 1208 | 1208 | 'same_as' => array( |
@@ -1288,8 +1288,8 @@ discard block |
||
| 1288 | 1288 | |
| 1289 | 1289 | // Merge the custom fields with those provided by the thing schema. |
| 1290 | 1290 | $parent_schema = $this->get_thing_schema(); |
| 1291 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1292 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1291 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 1292 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 1293 | 1293 | |
| 1294 | 1294 | return $schema; |
| 1295 | 1295 | } |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | $schema = array( |
| 1307 | 1307 | 'label' => 'LocalBusiness', |
| 1308 | 1308 | 'description' => 'A local business.', |
| 1309 | - 'parents' => array( 'place', 'organization' ), |
|
| 1309 | + 'parents' => array('place', 'organization'), |
|
| 1310 | 1310 | 'css_class' => 'wl-local-business', |
| 1311 | 1311 | 'uri' => 'http://schema.org/LocalBusiness', |
| 1312 | 1312 | 'same_as' => array( |
@@ -1323,8 +1323,8 @@ discard block |
||
| 1323 | 1323 | // Merge the custom fields with those provided by the place and organization schema. |
| 1324 | 1324 | $place_schema = $this->get_place_schema(); |
| 1325 | 1325 | $organization_schema = $this->get_organization_schema(); |
| 1326 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $place_schema['custom_fields'], $organization_schema['custom_fields'] ); |
|
| 1327 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $place_schema['linked_data'], $organization_schema['linked_data'] ); |
|
| 1326 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $place_schema['custom_fields'], $organization_schema['custom_fields']); |
|
| 1327 | + $schema['linked_data'] = array_merge($schema['linked_data'], $place_schema['linked_data'], $organization_schema['linked_data']); |
|
| 1328 | 1328 | |
| 1329 | 1329 | return $schema; |
| 1330 | 1330 | } |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | $schema = array( |
| 1342 | 1342 | 'label' => 'Recipe', |
| 1343 | 1343 | 'description' => 'A Recipe.', |
| 1344 | - 'parents' => array( 'CreativeWork' ), |
|
| 1344 | + 'parents' => array('CreativeWork'), |
|
| 1345 | 1345 | 'css_class' => 'wl-recipe', |
| 1346 | 1346 | 'uri' => 'http://schema.org/Recipe', |
| 1347 | 1347 | 'same_as' => array(), |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | 'export_type' => 'xsd:string', |
| 1356 | 1356 | 'constraints' => '', |
| 1357 | 1357 | 'metabox' => array( |
| 1358 | - 'label' => __( 'Recipe cuisine', 'wordlift' ), |
|
| 1358 | + 'label' => __('Recipe cuisine', 'wordlift'), |
|
| 1359 | 1359 | ), |
| 1360 | 1360 | ), |
| 1361 | 1361 | self::FIELD_RECIPE_INGREDIENT => array( |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | 'cardinality' => INF, |
| 1367 | 1367 | ), |
| 1368 | 1368 | 'metabox' => array( |
| 1369 | - 'label' => __( 'Recipe ingredient', 'wordlift' ), |
|
| 1369 | + 'label' => __('Recipe ingredient', 'wordlift'), |
|
| 1370 | 1370 | ), |
| 1371 | 1371 | ), |
| 1372 | 1372 | self::FIELD_RECIPE_INSTRUCTIONS => array( |
@@ -1376,7 +1376,7 @@ discard block |
||
| 1376 | 1376 | 'constraints' => '', |
| 1377 | 1377 | 'metabox' => array( |
| 1378 | 1378 | 'class' => 'Wordlift_Metabox_Field_Multiline', |
| 1379 | - 'label' => __( 'Recipe instructions', 'wordlift' ), |
|
| 1379 | + 'label' => __('Recipe instructions', 'wordlift'), |
|
| 1380 | 1380 | ), |
| 1381 | 1381 | ), |
| 1382 | 1382 | self::FIELD_RECIPE_YIELD => array( |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | 'export_type' => 'xsd:string', |
| 1386 | 1386 | 'constraints' => '', |
| 1387 | 1387 | 'metabox' => array( |
| 1388 | - 'label' => __( 'Recipe number of servings', 'wordlift' ), |
|
| 1388 | + 'label' => __('Recipe number of servings', 'wordlift'), |
|
| 1389 | 1389 | ), |
| 1390 | 1390 | ), |
| 1391 | 1391 | self::FIELD_RECIPE_INGREDIENT => array( |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | 'cardinality' => INF, |
| 1397 | 1397 | ), |
| 1398 | 1398 | 'metabox' => array( |
| 1399 | - 'label' => __( 'Recipe ingredient', 'wordlift' ), |
|
| 1399 | + 'label' => __('Recipe ingredient', 'wordlift'), |
|
| 1400 | 1400 | ), |
| 1401 | 1401 | ), |
| 1402 | 1402 | self::FIELD_NUTRITION_INFO_CALORIES => array( |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | 'export_type' => 'xsd:string', |
| 1406 | 1406 | 'constraints' => '', |
| 1407 | 1407 | 'metabox' => array( |
| 1408 | - 'label' => __( 'Calories (e.g. 240 calories)', 'wordlift' ), |
|
| 1408 | + 'label' => __('Calories (e.g. 240 calories)', 'wordlift'), |
|
| 1409 | 1409 | ), |
| 1410 | 1410 | ), |
| 1411 | 1411 | self::FIELD_PREP_TIME => array( |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | 'constraints' => '', |
| 1416 | 1416 | 'metabox' => array( |
| 1417 | 1417 | 'class' => 'Wordlift_Metabox_Field_Duration', |
| 1418 | - 'label' => __( 'Recipe preparation time (e.g. 1:30)', 'wordlift' ), |
|
| 1418 | + 'label' => __('Recipe preparation time (e.g. 1:30)', 'wordlift'), |
|
| 1419 | 1419 | ), |
| 1420 | 1420 | ), |
| 1421 | 1421 | self::FIELD_COOK_TIME => array( |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | 'constraints' => '', |
| 1426 | 1426 | 'metabox' => array( |
| 1427 | 1427 | 'class' => 'Wordlift_Metabox_Field_Duration', |
| 1428 | - 'label' => __( 'Recipe cook time (e.g. 1:30)', 'wordlift' ), |
|
| 1428 | + 'label' => __('Recipe cook time (e.g. 1:30)', 'wordlift'), |
|
| 1429 | 1429 | ), |
| 1430 | 1430 | ), |
| 1431 | 1431 | self::FIELD_TOTAL_TIME => array( |
@@ -1435,46 +1435,46 @@ discard block |
||
| 1435 | 1435 | 'constraints' => '', |
| 1436 | 1436 | 'metabox' => array( |
| 1437 | 1437 | 'class' => 'Wordlift_Metabox_Field_Duration', |
| 1438 | - 'label' => __( 'Recipe total time (e.g. 1:30)', 'wordlift' ), |
|
| 1438 | + 'label' => __('Recipe total time (e.g. 1:30)', 'wordlift'), |
|
| 1439 | 1439 | ), |
| 1440 | 1440 | ), |
| 1441 | 1441 | ), |
| 1442 | 1442 | 'linked_data' => array( |
| 1443 | 1443 | // ### schema:recipeCuisine. |
| 1444 | 1444 | $this->rendition_factory->create( |
| 1445 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_CUISINE ), |
|
| 1445 | + $this->storage_factory->post_meta(self::FIELD_RECIPE_CUISINE), |
|
| 1446 | 1446 | 'http://schema.org/recipeCuisine' |
| 1447 | 1447 | ), |
| 1448 | 1448 | // ### schema:recipeIngredient. |
| 1449 | 1449 | $this->rendition_factory->create( |
| 1450 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_INGREDIENT ), |
|
| 1450 | + $this->storage_factory->post_meta(self::FIELD_RECIPE_INGREDIENT), |
|
| 1451 | 1451 | 'http://schema.org/recipeIngredient' |
| 1452 | 1452 | ), |
| 1453 | 1453 | // ### schema:recipeInstructions. |
| 1454 | 1454 | $this->rendition_factory->create( |
| 1455 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_INSTRUCTIONS ), |
|
| 1455 | + $this->storage_factory->post_meta(self::FIELD_RECIPE_INSTRUCTIONS), |
|
| 1456 | 1456 | 'http://schema.org/recipeInstructions' |
| 1457 | 1457 | ), |
| 1458 | 1458 | // ### schema:recipeYield. |
| 1459 | 1459 | $this->rendition_factory->create( |
| 1460 | - $this->storage_factory->post_meta( self::FIELD_RECIPE_YIELD ), |
|
| 1460 | + $this->storage_factory->post_meta(self::FIELD_RECIPE_YIELD), |
|
| 1461 | 1461 | 'http://schema.org/recipeYield' |
| 1462 | 1462 | ), |
| 1463 | 1463 | // ### schema:prepTime. |
| 1464 | 1464 | $this->rendition_factory->create( |
| 1465 | - $this->storage_factory->post_meta( self::FIELD_PREP_TIME ), |
|
| 1465 | + $this->storage_factory->post_meta(self::FIELD_PREP_TIME), |
|
| 1466 | 1466 | 'http://schema.org/prepTime', |
| 1467 | 1467 | self::DATA_TYPE_DURATION |
| 1468 | 1468 | ), |
| 1469 | 1469 | // ### schema:cookTime. |
| 1470 | 1470 | $this->rendition_factory->create( |
| 1471 | - $this->storage_factory->post_meta( self::FIELD_COOK_TIME ), |
|
| 1471 | + $this->storage_factory->post_meta(self::FIELD_COOK_TIME), |
|
| 1472 | 1472 | 'http://schema.org/cookTime', |
| 1473 | 1473 | self::DATA_TYPE_DURATION |
| 1474 | 1474 | ), |
| 1475 | 1475 | // ### schema:totalTime. |
| 1476 | 1476 | $this->rendition_factory->create( |
| 1477 | - $this->storage_factory->post_meta( self::FIELD_TOTAL_TIME ), |
|
| 1477 | + $this->storage_factory->post_meta(self::FIELD_TOTAL_TIME), |
|
| 1478 | 1478 | 'http://schema.org/totalTime', |
| 1479 | 1479 | self::DATA_TYPE_DURATION |
| 1480 | 1480 | ), |
@@ -1483,8 +1483,8 @@ discard block |
||
| 1483 | 1483 | |
| 1484 | 1484 | // Merge the custom fields with those provided by the parent schema. |
| 1485 | 1485 | $parent_schema = $this->get_creative_work_schema(); |
| 1486 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1487 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1486 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 1487 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 1488 | 1488 | |
| 1489 | 1489 | return $schema; |
| 1490 | 1490 | } |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | $schema = array( |
| 1502 | 1502 | 'label' => 'Offer', |
| 1503 | 1503 | 'description' => 'An offer. ', |
| 1504 | - 'parents' => array( 'thing' ), |
|
| 1504 | + 'parents' => array('thing'), |
|
| 1505 | 1505 | 'css_class' => 'wl-offer', |
| 1506 | 1506 | 'uri' => self::SCHEMA_OFFER_TYPE, |
| 1507 | 1507 | 'same_as' => array(), |
@@ -1517,15 +1517,15 @@ discard block |
||
| 1517 | 1517 | 'class' => 'Wordlift_Metabox_Field_Select', |
| 1518 | 1518 | ), |
| 1519 | 1519 | 'options' => array( |
| 1520 | - 'Discontinued' => esc_html__( 'Discontinued', 'wordlift' ), |
|
| 1521 | - 'InStock' => esc_html__( 'In Stock', 'wordlift' ), |
|
| 1522 | - 'InStoreOnly' => esc_html__( 'In Store Only', 'wordlift' ), |
|
| 1523 | - 'LimitedAvailability' => esc_html__( 'Limited Availability', 'wordlift' ), |
|
| 1524 | - 'OnlineOnly' => esc_html__( 'Online Only', 'wordlift' ), |
|
| 1525 | - 'OutOfStock' => esc_html__( 'Out of Stock', 'wordlift' ), |
|
| 1526 | - 'PreOrder' => esc_html__( 'Pre Order', 'wordlift' ), |
|
| 1527 | - 'PreSale' => esc_html__( 'Pre Sale', 'wordlift' ), |
|
| 1528 | - 'SoldOut' => esc_html__( 'Sold Out', 'wordlift' ), |
|
| 1520 | + 'Discontinued' => esc_html__('Discontinued', 'wordlift'), |
|
| 1521 | + 'InStock' => esc_html__('In Stock', 'wordlift'), |
|
| 1522 | + 'InStoreOnly' => esc_html__('In Store Only', 'wordlift'), |
|
| 1523 | + 'LimitedAvailability' => esc_html__('Limited Availability', 'wordlift'), |
|
| 1524 | + 'OnlineOnly' => esc_html__('Online Only', 'wordlift'), |
|
| 1525 | + 'OutOfStock' => esc_html__('Out of Stock', 'wordlift'), |
|
| 1526 | + 'PreOrder' => esc_html__('Pre Order', 'wordlift'), |
|
| 1527 | + 'PreSale' => esc_html__('Pre Sale', 'wordlift'), |
|
| 1528 | + 'SoldOut' => esc_html__('Sold Out', 'wordlift'), |
|
| 1529 | 1529 | ), |
| 1530 | 1530 | ), |
| 1531 | 1531 | self::FIELD_PRICE => array( |
@@ -1585,55 +1585,55 @@ discard block |
||
| 1585 | 1585 | 'linked_data' => array( |
| 1586 | 1586 | // ### schema:availability. |
| 1587 | 1587 | $this->rendition_factory->create( |
| 1588 | - $this->storage_factory->post_meta( self::FIELD_AVAILABILITY ), |
|
| 1588 | + $this->storage_factory->post_meta(self::FIELD_AVAILABILITY), |
|
| 1589 | 1589 | 'http://schema.org/availability', |
| 1590 | 1590 | null |
| 1591 | 1591 | ), |
| 1592 | 1592 | // ### schema:availabilityStarts. |
| 1593 | 1593 | $this->rendition_factory->create( |
| 1594 | - $this->storage_factory->post_meta( self::FIELD_AVAILABILITY_STARTS ), |
|
| 1594 | + $this->storage_factory->post_meta(self::FIELD_AVAILABILITY_STARTS), |
|
| 1595 | 1595 | 'http://schema.org/availabilityStarts', |
| 1596 | 1596 | self::DATA_TYPE_DATE_TIME |
| 1597 | 1597 | ), |
| 1598 | 1598 | // ### schema:availabilityEnds. |
| 1599 | 1599 | $this->rendition_factory->create( |
| 1600 | - $this->storage_factory->post_meta( self::FIELD_AVAILABILITY_ENDS ), |
|
| 1600 | + $this->storage_factory->post_meta(self::FIELD_AVAILABILITY_ENDS), |
|
| 1601 | 1601 | 'http://schema.org/availabilityEnds', |
| 1602 | 1602 | self::DATA_TYPE_DATE_TIME |
| 1603 | 1603 | ), |
| 1604 | 1604 | // ### schema:inventoryLevel. |
| 1605 | 1605 | $this->rendition_factory->create( |
| 1606 | - $this->storage_factory->post_meta( self::FIELD_INVENTORY_LEVEL ), |
|
| 1606 | + $this->storage_factory->post_meta(self::FIELD_INVENTORY_LEVEL), |
|
| 1607 | 1607 | 'http://schema.org/inventoryLevel', |
| 1608 | 1608 | self::DATA_TYPE_INTEGER |
| 1609 | 1609 | ), |
| 1610 | 1610 | // ### schema:price. |
| 1611 | 1611 | $this->rendition_factory->create( |
| 1612 | - $this->storage_factory->post_meta( self::FIELD_PRICE ), |
|
| 1612 | + $this->storage_factory->post_meta(self::FIELD_PRICE), |
|
| 1613 | 1613 | 'http://schema.org/price', |
| 1614 | 1614 | self::DATA_TYPE_INTEGER |
| 1615 | 1615 | ), |
| 1616 | 1616 | // ### schema:priceCurrency. |
| 1617 | 1617 | $this->rendition_factory->create( |
| 1618 | - $this->storage_factory->post_meta( self::FIELD_PRICE_CURRENCY ), |
|
| 1618 | + $this->storage_factory->post_meta(self::FIELD_PRICE_CURRENCY), |
|
| 1619 | 1619 | 'http://schema.org/priceCurrency', |
| 1620 | 1620 | null |
| 1621 | 1621 | ), |
| 1622 | 1622 | // ### schema:validFrom. |
| 1623 | 1623 | $this->rendition_factory->create( |
| 1624 | - $this->storage_factory->post_meta( self::FIELD_VALID_FROM ), |
|
| 1624 | + $this->storage_factory->post_meta(self::FIELD_VALID_FROM), |
|
| 1625 | 1625 | 'http://schema.org/validFrom', |
| 1626 | 1626 | null |
| 1627 | 1627 | ), |
| 1628 | 1628 | // ### schema:priceValidUntil. |
| 1629 | 1629 | $this->rendition_factory->create( |
| 1630 | - $this->storage_factory->post_meta( self::FIELD_PRICE_VALID_UNTIL ), |
|
| 1630 | + $this->storage_factory->post_meta(self::FIELD_PRICE_VALID_UNTIL), |
|
| 1631 | 1631 | 'http://schema.org/priceValidUntil', |
| 1632 | 1632 | null |
| 1633 | 1633 | ), |
| 1634 | 1634 | // ### schema:itemOffered. |
| 1635 | 1635 | $this->rendition_factory->create( |
| 1636 | - $this->storage_factory->post_meta_to_uri( self::FIELD_ITEM_OFFERED ), |
|
| 1636 | + $this->storage_factory->post_meta_to_uri(self::FIELD_ITEM_OFFERED), |
|
| 1637 | 1637 | 'http://schema.org/itemOffered', |
| 1638 | 1638 | self::DATA_TYPE_URI |
| 1639 | 1639 | ), |
@@ -1642,8 +1642,8 @@ discard block |
||
| 1642 | 1642 | |
| 1643 | 1643 | // Merge the custom fields with those provided by the thing schema. |
| 1644 | 1644 | $parent_schema = $this->get_thing_schema(); |
| 1645 | - $schema['custom_fields'] = array_merge( $schema['custom_fields'], $parent_schema['custom_fields'] ); |
|
| 1646 | - $schema['linked_data'] = array_merge( $schema['linked_data'], $parent_schema['linked_data'] ); |
|
| 1645 | + $schema['custom_fields'] = array_merge($schema['custom_fields'], $parent_schema['custom_fields']); |
|
| 1646 | + $schema['linked_data'] = array_merge($schema['linked_data'], $parent_schema['linked_data']); |
|
| 1647 | 1647 | |
| 1648 | 1648 | return $schema; |
| 1649 | 1649 | } |
@@ -16,467 +16,467 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Entity_Service { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The Log service. |
|
| 21 | - * |
|
| 22 | - * @since 3.2.0 |
|
| 23 | - * @access private |
|
| 24 | - * @var \Wordlift_Log_Service $log The Log service. |
|
| 25 | - */ |
|
| 26 | - private $log; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * The UI service. |
|
| 30 | - * |
|
| 31 | - * @since 3.2.0 |
|
| 32 | - * @access private |
|
| 33 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 34 | - */ |
|
| 35 | - private $ui_service; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 39 | - * |
|
| 40 | - * @since 3.15.0 |
|
| 41 | - * @access private |
|
| 42 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 43 | - */ |
|
| 44 | - private $relation_service; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 48 | - * |
|
| 49 | - * @since 3.16.3 |
|
| 50 | - * @access private |
|
| 51 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 52 | - */ |
|
| 53 | - private $entity_uri_service; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * The entity post type name. |
|
| 57 | - * |
|
| 58 | - * @since 3.1.0 |
|
| 59 | - */ |
|
| 60 | - const TYPE_NAME = 'entity'; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * The alternative label meta key. |
|
| 64 | - * |
|
| 65 | - * @since 3.2.0 |
|
| 66 | - */ |
|
| 67 | - const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label'; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The alternative label input template. |
|
| 71 | - * |
|
| 72 | - * @since 3.2.0 |
|
| 73 | - */ |
|
| 74 | - // TODO: this should be moved to a class that deals with HTML code. |
|
| 75 | - const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label"> |
|
| 19 | + /** |
|
| 20 | + * The Log service. |
|
| 21 | + * |
|
| 22 | + * @since 3.2.0 |
|
| 23 | + * @access private |
|
| 24 | + * @var \Wordlift_Log_Service $log The Log service. |
|
| 25 | + */ |
|
| 26 | + private $log; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * The UI service. |
|
| 30 | + * |
|
| 31 | + * @since 3.2.0 |
|
| 32 | + * @access private |
|
| 33 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 34 | + */ |
|
| 35 | + private $ui_service; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 39 | + * |
|
| 40 | + * @since 3.15.0 |
|
| 41 | + * @access private |
|
| 42 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 43 | + */ |
|
| 44 | + private $relation_service; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 48 | + * |
|
| 49 | + * @since 3.16.3 |
|
| 50 | + * @access private |
|
| 51 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 52 | + */ |
|
| 53 | + private $entity_uri_service; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * The entity post type name. |
|
| 57 | + * |
|
| 58 | + * @since 3.1.0 |
|
| 59 | + */ |
|
| 60 | + const TYPE_NAME = 'entity'; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * The alternative label meta key. |
|
| 64 | + * |
|
| 65 | + * @since 3.2.0 |
|
| 66 | + */ |
|
| 67 | + const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label'; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The alternative label input template. |
|
| 71 | + * |
|
| 72 | + * @since 3.2.0 |
|
| 73 | + */ |
|
| 74 | + // TODO: this should be moved to a class that deals with HTML code. |
|
| 75 | + const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label"> |
|
| 76 | 76 | <label class="screen-reader-text" id="wl-alternative-label-prompt-text" for="wl-alternative-label">Enter alternative label here</label> |
| 77 | 77 | <input name="wl_alternative_label[]" size="30" value="%s" id="wl-alternative-label" type="text"> |
| 78 | 78 | <button class="button wl-delete-button">%s</button> |
| 79 | 79 | </div>'; |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * A singleton instance of the Entity service. |
|
| 83 | - * |
|
| 84 | - * @since 3.2.0 |
|
| 85 | - * @access private |
|
| 86 | - * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service. |
|
| 87 | - */ |
|
| 88 | - private static $instance; |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Create a Wordlift_Entity_Service instance. |
|
| 92 | - * |
|
| 93 | - * @since 3.2.0 |
|
| 94 | - * |
|
| 95 | - * @param \Wordlift_UI_Service $ui_service The UI service. |
|
| 96 | - * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 97 | - * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 98 | - */ |
|
| 99 | - public function __construct( $ui_service, $relation_service, $entity_uri_service ) { |
|
| 100 | - |
|
| 101 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' ); |
|
| 102 | - |
|
| 103 | - $this->ui_service = $ui_service; |
|
| 104 | - $this->relation_service = $relation_service; |
|
| 105 | - $this->entity_uri_service = $entity_uri_service; |
|
| 106 | - |
|
| 107 | - // Set the singleton instance. |
|
| 108 | - self::$instance = $this; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * Get the singleton instance of the Entity service. |
|
| 113 | - * |
|
| 114 | - * @since 3.2.0 |
|
| 115 | - * @return \Wordlift_Entity_Service The singleton instance of the Entity service. |
|
| 116 | - */ |
|
| 117 | - public static function get_instance() { |
|
| 118 | - |
|
| 119 | - return self::$instance; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Determines whether a post is an entity or not. Entity is in this context |
|
| 124 | - * something which is not an article. |
|
| 125 | - * |
|
| 126 | - * @since 3.1.0 |
|
| 127 | - * |
|
| 128 | - * @param int $post_id A post id. |
|
| 129 | - * |
|
| 130 | - * @return bool Return true if the post is an entity otherwise false. |
|
| 131 | - */ |
|
| 132 | - public function is_entity( $post_id ) { |
|
| 133 | - |
|
| 134 | - $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 135 | - |
|
| 136 | - if ( is_wp_error( $terms ) ) { |
|
| 137 | - $this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() ); |
|
| 138 | - |
|
| 139 | - return false; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - if ( empty( $terms ) ) { |
|
| 143 | - return false; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /* |
|
| 81 | + /** |
|
| 82 | + * A singleton instance of the Entity service. |
|
| 83 | + * |
|
| 84 | + * @since 3.2.0 |
|
| 85 | + * @access private |
|
| 86 | + * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service. |
|
| 87 | + */ |
|
| 88 | + private static $instance; |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Create a Wordlift_Entity_Service instance. |
|
| 92 | + * |
|
| 93 | + * @since 3.2.0 |
|
| 94 | + * |
|
| 95 | + * @param \Wordlift_UI_Service $ui_service The UI service. |
|
| 96 | + * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 97 | + * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 98 | + */ |
|
| 99 | + public function __construct( $ui_service, $relation_service, $entity_uri_service ) { |
|
| 100 | + |
|
| 101 | + $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' ); |
|
| 102 | + |
|
| 103 | + $this->ui_service = $ui_service; |
|
| 104 | + $this->relation_service = $relation_service; |
|
| 105 | + $this->entity_uri_service = $entity_uri_service; |
|
| 106 | + |
|
| 107 | + // Set the singleton instance. |
|
| 108 | + self::$instance = $this; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * Get the singleton instance of the Entity service. |
|
| 113 | + * |
|
| 114 | + * @since 3.2.0 |
|
| 115 | + * @return \Wordlift_Entity_Service The singleton instance of the Entity service. |
|
| 116 | + */ |
|
| 117 | + public static function get_instance() { |
|
| 118 | + |
|
| 119 | + return self::$instance; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Determines whether a post is an entity or not. Entity is in this context |
|
| 124 | + * something which is not an article. |
|
| 125 | + * |
|
| 126 | + * @since 3.1.0 |
|
| 127 | + * |
|
| 128 | + * @param int $post_id A post id. |
|
| 129 | + * |
|
| 130 | + * @return bool Return true if the post is an entity otherwise false. |
|
| 131 | + */ |
|
| 132 | + public function is_entity( $post_id ) { |
|
| 133 | + |
|
| 134 | + $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 135 | + |
|
| 136 | + if ( is_wp_error( $terms ) ) { |
|
| 137 | + $this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() ); |
|
| 138 | + |
|
| 139 | + return false; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + if ( empty( $terms ) ) { |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /* |
|
| 147 | 147 | * We don't consider an `article` to be an entity. |
| 148 | 148 | * |
| 149 | 149 | * @since 3.20.0 At least one associated mustn't be an `article`. |
| 150 | 150 | * |
| 151 | 151 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 152 | 152 | */ |
| 153 | - foreach ( $terms as $term ) { |
|
| 154 | - if ( 'article' !== $term->slug ) { |
|
| 155 | - return true; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - return false; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Get the proper classification scope for a given entity post |
|
| 164 | - * |
|
| 165 | - * @since 3.5.0 |
|
| 166 | - * |
|
| 167 | - * @param integer $post_id An entity post id. |
|
| 168 | - * |
|
| 169 | - * @param string $default The default classification scope, `what` if not |
|
| 170 | - * provided. |
|
| 171 | - * |
|
| 172 | - * @return string Returns a classification scope (e.g. 'what'). |
|
| 173 | - */ |
|
| 174 | - public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) { |
|
| 175 | - |
|
| 176 | - if ( false === $this->is_entity( $post_id ) ) { |
|
| 177 | - return $default; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - // Retrieve the entity type |
|
| 181 | - $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id ); |
|
| 182 | - $entity_type = str_replace( 'wl-', '', $entity_type_arr['css_class'] ); |
|
| 183 | - // Retrieve classification boxes configuration |
|
| 184 | - $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES ); |
|
| 185 | - foreach ( $classification_boxes as $cb ) { |
|
| 186 | - if ( in_array( $entity_type, $cb['registeredTypes'] ) ) { |
|
| 187 | - return $cb['id']; |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return $default; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Check whether a {@link WP_Post} is used. |
|
| 196 | - * |
|
| 197 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 198 | - * |
|
| 199 | - * @return bool|null Null if it's not an entity, otherwise true if it's used. |
|
| 200 | - */ |
|
| 201 | - public function is_used( $post_id ) { |
|
| 202 | - |
|
| 203 | - if ( false === $this->is_entity( $post_id ) ) { |
|
| 204 | - return null; |
|
| 205 | - } |
|
| 206 | - // Retrieve the post |
|
| 207 | - $entity = get_post( $post_id ); |
|
| 208 | - |
|
| 209 | - global $wpdb; |
|
| 210 | - // Retrieve Wordlift relation instances table name |
|
| 211 | - $table_name = wl_core_get_relation_instances_table_name(); |
|
| 212 | - |
|
| 213 | - // Check is it's referenced / related to another post / entity |
|
| 214 | - $stmt = $wpdb->prepare( |
|
| 215 | - "SELECT COUNT(*) FROM $table_name WHERE object_id = %d", |
|
| 216 | - $entity->ID |
|
| 217 | - ); |
|
| 218 | - |
|
| 219 | - // Perform the query |
|
| 220 | - $relation_instances = (int) $wpdb->get_var( $stmt ); |
|
| 221 | - // If there is at least one relation instance for the current entity, then it's used |
|
| 222 | - if ( 0 < $relation_instances ) { |
|
| 223 | - return true; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - // Check if the entity uri is used as meta_value |
|
| 227 | - $stmt = $wpdb->prepare( |
|
| 228 | - "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s", |
|
| 229 | - $entity->ID, |
|
| 230 | - wl_get_entity_uri( $entity->ID ) |
|
| 231 | - ); |
|
| 232 | - // Perform the query |
|
| 233 | - $meta_instances = (int) $wpdb->get_var( $stmt ); |
|
| 234 | - |
|
| 235 | - // If there is at least one meta that refers the current entity uri, then current entity is used |
|
| 236 | - if ( 0 < $meta_instances ) { |
|
| 237 | - return true; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - // If we are here, it means the current entity is not used at the moment |
|
| 241 | - return false; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * Find entity posts by the entity URI. Entity as searched by their entity URI or same as. |
|
| 246 | - * |
|
| 247 | - * @since 3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri ); |
|
| 248 | - * @since 3.2.0 |
|
| 249 | - * |
|
| 250 | - * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri ); |
|
| 251 | - * |
|
| 252 | - * @param string $uri The entity URI. |
|
| 253 | - * |
|
| 254 | - * @return WP_Post|null A WP_Post instance or null if not found. |
|
| 255 | - */ |
|
| 256 | - public function get_entity_post_by_uri( $uri ) { |
|
| 257 | - |
|
| 258 | - return $this->entity_uri_service->get_entity( $uri ); |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * Fires once a post has been saved. This function uses the $_REQUEST, therefore |
|
| 263 | - * we check that the post we're saving is the current post. |
|
| 264 | - * |
|
| 265 | - * @see https://github.com/insideout10/wordlift-plugin/issues/363 |
|
| 266 | - * |
|
| 267 | - * @since 3.2.0 |
|
| 268 | - * |
|
| 269 | - * @param int $post_id Post ID. |
|
| 270 | - * @param WP_Post $post Post object. |
|
| 271 | - * @param bool $update Whether this is an existing post being updated or not. |
|
| 272 | - */ |
|
| 273 | - public function save_post( $post_id, $post, $update ) { |
|
| 274 | - |
|
| 275 | - // Avoid doing anything if post is autosave or a revision. |
|
| 276 | - if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) { |
|
| 277 | - return; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - // We're setting the alternative label that have been provided via the UI |
|
| 281 | - // (in fact we're using $_REQUEST), while save_post may be also called |
|
| 282 | - // programmatically by some other function: we need to check therefore if |
|
| 283 | - // the $post_id in the save_post call matches the post id set in the request. |
|
| 284 | - // |
|
| 285 | - // If this is not the current post being saved or if it's not an entity, return. |
|
| 286 | - if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) { |
|
| 287 | - return; |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - // Get the alt labels from the request (or empty array). |
|
| 291 | - $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array(); |
|
| 292 | - |
|
| 293 | - // Set the alternative labels. |
|
| 294 | - $this->set_alternative_labels( $post_id, $alt_labels ); |
|
| 295 | - |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * Set the alternative labels. |
|
| 300 | - * |
|
| 301 | - * @since 3.2.0 |
|
| 302 | - * |
|
| 303 | - * @param int $post_id The post id. |
|
| 304 | - * @param array $alt_labels An array of labels. |
|
| 305 | - */ |
|
| 306 | - public function set_alternative_labels( $post_id, $alt_labels ) { |
|
| 307 | - |
|
| 308 | - // Force $alt_labels to be an array |
|
| 309 | - if ( ! is_array( $alt_labels ) ) { |
|
| 310 | - $alt_labels = array( $alt_labels ); |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" ); |
|
| 314 | - |
|
| 315 | - // Delete all the existing alternate labels. |
|
| 316 | - delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY ); |
|
| 317 | - |
|
| 318 | - // Set the alternative labels. |
|
| 319 | - foreach ( $alt_labels as $alt_label ) { |
|
| 320 | - if ( ! empty( $alt_label ) ) { |
|
| 321 | - add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label ); |
|
| 322 | - } |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - /** |
|
| 328 | - * Retrieve the alternate labels. |
|
| 329 | - * |
|
| 330 | - * @since 3.2.0 |
|
| 331 | - * |
|
| 332 | - * @param int $post_id Post id. |
|
| 333 | - * |
|
| 334 | - * @return mixed An array of alternative labels. |
|
| 335 | - */ |
|
| 336 | - public function get_alternative_labels( $post_id ) { |
|
| 337 | - |
|
| 338 | - return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY ); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Retrieve the labels for an entity, i.e. the title + the synonyms. |
|
| 343 | - * |
|
| 344 | - * @since 3.12.0 |
|
| 345 | - * |
|
| 346 | - * @param int $post_id The entity {@link WP_Post} id. |
|
| 347 | - * |
|
| 348 | - * @return array An array with the entity title and labels. |
|
| 349 | - */ |
|
| 350 | - public function get_labels( $post_id ) { |
|
| 351 | - |
|
| 352 | - return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) ); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - /** |
|
| 356 | - * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0). |
|
| 357 | - * |
|
| 358 | - * @since 3.2.0 |
|
| 359 | - * |
|
| 360 | - * @param WP_Post $post Post object. |
|
| 361 | - */ |
|
| 362 | - public function edit_form_before_permalink( $post ) { |
|
| 363 | - |
|
| 364 | - // If it's not an entity, return. |
|
| 365 | - if ( ! $this->is_entity( $post->ID ) ) { |
|
| 366 | - return; |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - // Print the input template. |
|
| 370 | - $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() ); |
|
| 371 | - |
|
| 372 | - // Print all the currently set alternative labels. |
|
| 373 | - foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) { |
|
| 374 | - |
|
| 375 | - echo $this->get_alternative_label_input( $alt_label ); |
|
| 376 | - |
|
| 377 | - }; |
|
| 378 | - |
|
| 379 | - // Print the button. |
|
| 380 | - $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) ); |
|
| 381 | - |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * Get the URI for the entity with the specified post id. |
|
| 386 | - * |
|
| 387 | - * @since 3.6.0 |
|
| 388 | - * |
|
| 389 | - * @param int $post_id The entity post id. |
|
| 390 | - * |
|
| 391 | - * @return null|string The entity URI or NULL if not found or the dataset URI is not configured. |
|
| 392 | - */ |
|
| 393 | - public function get_uri( $post_id ) { |
|
| 394 | - |
|
| 395 | - // If a null is given, nothing to do |
|
| 396 | - if ( null == $post_id ) { |
|
| 397 | - return null; |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true ); |
|
| 401 | - |
|
| 402 | - // If the dataset uri is not properly configured, null is returned |
|
| 403 | - if ( '' === wl_configuration_get_redlink_dataset_uri() ) { |
|
| 404 | - return null; |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - // Set the URI if it isn't set yet. |
|
| 408 | - $post_status = get_post_status( $post_id ); |
|
| 409 | - if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) { |
|
| 410 | - $uri = wl_build_entity_uri( $post_id ); |
|
| 411 | - wl_set_entity_uri( $post_id, $uri ); |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - return $uri; |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - |
|
| 418 | - /** |
|
| 419 | - * Get the alternative label input HTML code. |
|
| 420 | - * |
|
| 421 | - * @since 3.2.0 |
|
| 422 | - * |
|
| 423 | - * @param string $value The input value. |
|
| 424 | - * |
|
| 425 | - * @return string The input HTML code. |
|
| 426 | - */ |
|
| 427 | - private function get_alternative_label_input( $value = '' ) { |
|
| 428 | - |
|
| 429 | - return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) ); |
|
| 430 | - } |
|
| 431 | - |
|
| 432 | - /** |
|
| 433 | - * Get the number of entity posts published in this blog. |
|
| 434 | - * |
|
| 435 | - * @since 3.6.0 |
|
| 436 | - * |
|
| 437 | - * @return int The number of published entity posts. |
|
| 438 | - */ |
|
| 439 | - public function count() { |
|
| 440 | - |
|
| 441 | - $posts = get_posts( $this->add_criterias( array( |
|
| 442 | - 'fields' => 'ids', |
|
| 443 | - 'post_status' => 'any', |
|
| 444 | - 'numberposts' => - 1, |
|
| 445 | - ) ) ); |
|
| 446 | - |
|
| 447 | - return count( $posts ); |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - /** |
|
| 451 | - * Add the entity filtering criterias to the arguments for a `get_posts` |
|
| 452 | - * call. |
|
| 453 | - * |
|
| 454 | - * @since 3.15.0 |
|
| 455 | - * |
|
| 456 | - * @param array $args The arguments for a `get_posts` call. |
|
| 457 | - * |
|
| 458 | - * @return array The arguments for a `get_posts` call. |
|
| 459 | - */ |
|
| 460 | - public static function add_criterias( $args ) { |
|
| 461 | - |
|
| 462 | - // Build an optimal tax-query. |
|
| 463 | - $tax_query = array( |
|
| 464 | - 'relation' => 'AND', |
|
| 465 | - array( |
|
| 466 | - 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 467 | - 'operator' => 'EXISTS', |
|
| 468 | - ), |
|
| 469 | - array( |
|
| 470 | - 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 471 | - 'field' => 'slug', |
|
| 472 | - 'terms' => 'article', |
|
| 473 | - 'operator' => 'NOT IN', |
|
| 474 | - ), |
|
| 475 | - ); |
|
| 476 | - |
|
| 477 | - return $args + array( |
|
| 478 | - 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 479 | - /* |
|
| 153 | + foreach ( $terms as $term ) { |
|
| 154 | + if ( 'article' !== $term->slug ) { |
|
| 155 | + return true; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + return false; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Get the proper classification scope for a given entity post |
|
| 164 | + * |
|
| 165 | + * @since 3.5.0 |
|
| 166 | + * |
|
| 167 | + * @param integer $post_id An entity post id. |
|
| 168 | + * |
|
| 169 | + * @param string $default The default classification scope, `what` if not |
|
| 170 | + * provided. |
|
| 171 | + * |
|
| 172 | + * @return string Returns a classification scope (e.g. 'what'). |
|
| 173 | + */ |
|
| 174 | + public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) { |
|
| 175 | + |
|
| 176 | + if ( false === $this->is_entity( $post_id ) ) { |
|
| 177 | + return $default; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + // Retrieve the entity type |
|
| 181 | + $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id ); |
|
| 182 | + $entity_type = str_replace( 'wl-', '', $entity_type_arr['css_class'] ); |
|
| 183 | + // Retrieve classification boxes configuration |
|
| 184 | + $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES ); |
|
| 185 | + foreach ( $classification_boxes as $cb ) { |
|
| 186 | + if ( in_array( $entity_type, $cb['registeredTypes'] ) ) { |
|
| 187 | + return $cb['id']; |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return $default; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Check whether a {@link WP_Post} is used. |
|
| 196 | + * |
|
| 197 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 198 | + * |
|
| 199 | + * @return bool|null Null if it's not an entity, otherwise true if it's used. |
|
| 200 | + */ |
|
| 201 | + public function is_used( $post_id ) { |
|
| 202 | + |
|
| 203 | + if ( false === $this->is_entity( $post_id ) ) { |
|
| 204 | + return null; |
|
| 205 | + } |
|
| 206 | + // Retrieve the post |
|
| 207 | + $entity = get_post( $post_id ); |
|
| 208 | + |
|
| 209 | + global $wpdb; |
|
| 210 | + // Retrieve Wordlift relation instances table name |
|
| 211 | + $table_name = wl_core_get_relation_instances_table_name(); |
|
| 212 | + |
|
| 213 | + // Check is it's referenced / related to another post / entity |
|
| 214 | + $stmt = $wpdb->prepare( |
|
| 215 | + "SELECT COUNT(*) FROM $table_name WHERE object_id = %d", |
|
| 216 | + $entity->ID |
|
| 217 | + ); |
|
| 218 | + |
|
| 219 | + // Perform the query |
|
| 220 | + $relation_instances = (int) $wpdb->get_var( $stmt ); |
|
| 221 | + // If there is at least one relation instance for the current entity, then it's used |
|
| 222 | + if ( 0 < $relation_instances ) { |
|
| 223 | + return true; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + // Check if the entity uri is used as meta_value |
|
| 227 | + $stmt = $wpdb->prepare( |
|
| 228 | + "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s", |
|
| 229 | + $entity->ID, |
|
| 230 | + wl_get_entity_uri( $entity->ID ) |
|
| 231 | + ); |
|
| 232 | + // Perform the query |
|
| 233 | + $meta_instances = (int) $wpdb->get_var( $stmt ); |
|
| 234 | + |
|
| 235 | + // If there is at least one meta that refers the current entity uri, then current entity is used |
|
| 236 | + if ( 0 < $meta_instances ) { |
|
| 237 | + return true; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + // If we are here, it means the current entity is not used at the moment |
|
| 241 | + return false; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * Find entity posts by the entity URI. Entity as searched by their entity URI or same as. |
|
| 246 | + * |
|
| 247 | + * @since 3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri ); |
|
| 248 | + * @since 3.2.0 |
|
| 249 | + * |
|
| 250 | + * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri ); |
|
| 251 | + * |
|
| 252 | + * @param string $uri The entity URI. |
|
| 253 | + * |
|
| 254 | + * @return WP_Post|null A WP_Post instance or null if not found. |
|
| 255 | + */ |
|
| 256 | + public function get_entity_post_by_uri( $uri ) { |
|
| 257 | + |
|
| 258 | + return $this->entity_uri_service->get_entity( $uri ); |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * Fires once a post has been saved. This function uses the $_REQUEST, therefore |
|
| 263 | + * we check that the post we're saving is the current post. |
|
| 264 | + * |
|
| 265 | + * @see https://github.com/insideout10/wordlift-plugin/issues/363 |
|
| 266 | + * |
|
| 267 | + * @since 3.2.0 |
|
| 268 | + * |
|
| 269 | + * @param int $post_id Post ID. |
|
| 270 | + * @param WP_Post $post Post object. |
|
| 271 | + * @param bool $update Whether this is an existing post being updated or not. |
|
| 272 | + */ |
|
| 273 | + public function save_post( $post_id, $post, $update ) { |
|
| 274 | + |
|
| 275 | + // Avoid doing anything if post is autosave or a revision. |
|
| 276 | + if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) { |
|
| 277 | + return; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + // We're setting the alternative label that have been provided via the UI |
|
| 281 | + // (in fact we're using $_REQUEST), while save_post may be also called |
|
| 282 | + // programmatically by some other function: we need to check therefore if |
|
| 283 | + // the $post_id in the save_post call matches the post id set in the request. |
|
| 284 | + // |
|
| 285 | + // If this is not the current post being saved or if it's not an entity, return. |
|
| 286 | + if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) { |
|
| 287 | + return; |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + // Get the alt labels from the request (or empty array). |
|
| 291 | + $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array(); |
|
| 292 | + |
|
| 293 | + // Set the alternative labels. |
|
| 294 | + $this->set_alternative_labels( $post_id, $alt_labels ); |
|
| 295 | + |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * Set the alternative labels. |
|
| 300 | + * |
|
| 301 | + * @since 3.2.0 |
|
| 302 | + * |
|
| 303 | + * @param int $post_id The post id. |
|
| 304 | + * @param array $alt_labels An array of labels. |
|
| 305 | + */ |
|
| 306 | + public function set_alternative_labels( $post_id, $alt_labels ) { |
|
| 307 | + |
|
| 308 | + // Force $alt_labels to be an array |
|
| 309 | + if ( ! is_array( $alt_labels ) ) { |
|
| 310 | + $alt_labels = array( $alt_labels ); |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" ); |
|
| 314 | + |
|
| 315 | + // Delete all the existing alternate labels. |
|
| 316 | + delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY ); |
|
| 317 | + |
|
| 318 | + // Set the alternative labels. |
|
| 319 | + foreach ( $alt_labels as $alt_label ) { |
|
| 320 | + if ( ! empty( $alt_label ) ) { |
|
| 321 | + add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label ); |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + /** |
|
| 328 | + * Retrieve the alternate labels. |
|
| 329 | + * |
|
| 330 | + * @since 3.2.0 |
|
| 331 | + * |
|
| 332 | + * @param int $post_id Post id. |
|
| 333 | + * |
|
| 334 | + * @return mixed An array of alternative labels. |
|
| 335 | + */ |
|
| 336 | + public function get_alternative_labels( $post_id ) { |
|
| 337 | + |
|
| 338 | + return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY ); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Retrieve the labels for an entity, i.e. the title + the synonyms. |
|
| 343 | + * |
|
| 344 | + * @since 3.12.0 |
|
| 345 | + * |
|
| 346 | + * @param int $post_id The entity {@link WP_Post} id. |
|
| 347 | + * |
|
| 348 | + * @return array An array with the entity title and labels. |
|
| 349 | + */ |
|
| 350 | + public function get_labels( $post_id ) { |
|
| 351 | + |
|
| 352 | + return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) ); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + /** |
|
| 356 | + * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0). |
|
| 357 | + * |
|
| 358 | + * @since 3.2.0 |
|
| 359 | + * |
|
| 360 | + * @param WP_Post $post Post object. |
|
| 361 | + */ |
|
| 362 | + public function edit_form_before_permalink( $post ) { |
|
| 363 | + |
|
| 364 | + // If it's not an entity, return. |
|
| 365 | + if ( ! $this->is_entity( $post->ID ) ) { |
|
| 366 | + return; |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + // Print the input template. |
|
| 370 | + $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() ); |
|
| 371 | + |
|
| 372 | + // Print all the currently set alternative labels. |
|
| 373 | + foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) { |
|
| 374 | + |
|
| 375 | + echo $this->get_alternative_label_input( $alt_label ); |
|
| 376 | + |
|
| 377 | + }; |
|
| 378 | + |
|
| 379 | + // Print the button. |
|
| 380 | + $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) ); |
|
| 381 | + |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * Get the URI for the entity with the specified post id. |
|
| 386 | + * |
|
| 387 | + * @since 3.6.0 |
|
| 388 | + * |
|
| 389 | + * @param int $post_id The entity post id. |
|
| 390 | + * |
|
| 391 | + * @return null|string The entity URI or NULL if not found or the dataset URI is not configured. |
|
| 392 | + */ |
|
| 393 | + public function get_uri( $post_id ) { |
|
| 394 | + |
|
| 395 | + // If a null is given, nothing to do |
|
| 396 | + if ( null == $post_id ) { |
|
| 397 | + return null; |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true ); |
|
| 401 | + |
|
| 402 | + // If the dataset uri is not properly configured, null is returned |
|
| 403 | + if ( '' === wl_configuration_get_redlink_dataset_uri() ) { |
|
| 404 | + return null; |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + // Set the URI if it isn't set yet. |
|
| 408 | + $post_status = get_post_status( $post_id ); |
|
| 409 | + if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) { |
|
| 410 | + $uri = wl_build_entity_uri( $post_id ); |
|
| 411 | + wl_set_entity_uri( $post_id, $uri ); |
|
| 412 | + } |
|
| 413 | + |
|
| 414 | + return $uri; |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + |
|
| 418 | + /** |
|
| 419 | + * Get the alternative label input HTML code. |
|
| 420 | + * |
|
| 421 | + * @since 3.2.0 |
|
| 422 | + * |
|
| 423 | + * @param string $value The input value. |
|
| 424 | + * |
|
| 425 | + * @return string The input HTML code. |
|
| 426 | + */ |
|
| 427 | + private function get_alternative_label_input( $value = '' ) { |
|
| 428 | + |
|
| 429 | + return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) ); |
|
| 430 | + } |
|
| 431 | + |
|
| 432 | + /** |
|
| 433 | + * Get the number of entity posts published in this blog. |
|
| 434 | + * |
|
| 435 | + * @since 3.6.0 |
|
| 436 | + * |
|
| 437 | + * @return int The number of published entity posts. |
|
| 438 | + */ |
|
| 439 | + public function count() { |
|
| 440 | + |
|
| 441 | + $posts = get_posts( $this->add_criterias( array( |
|
| 442 | + 'fields' => 'ids', |
|
| 443 | + 'post_status' => 'any', |
|
| 444 | + 'numberposts' => - 1, |
|
| 445 | + ) ) ); |
|
| 446 | + |
|
| 447 | + return count( $posts ); |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + /** |
|
| 451 | + * Add the entity filtering criterias to the arguments for a `get_posts` |
|
| 452 | + * call. |
|
| 453 | + * |
|
| 454 | + * @since 3.15.0 |
|
| 455 | + * |
|
| 456 | + * @param array $args The arguments for a `get_posts` call. |
|
| 457 | + * |
|
| 458 | + * @return array The arguments for a `get_posts` call. |
|
| 459 | + */ |
|
| 460 | + public static function add_criterias( $args ) { |
|
| 461 | + |
|
| 462 | + // Build an optimal tax-query. |
|
| 463 | + $tax_query = array( |
|
| 464 | + 'relation' => 'AND', |
|
| 465 | + array( |
|
| 466 | + 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 467 | + 'operator' => 'EXISTS', |
|
| 468 | + ), |
|
| 469 | + array( |
|
| 470 | + 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 471 | + 'field' => 'slug', |
|
| 472 | + 'terms' => 'article', |
|
| 473 | + 'operator' => 'NOT IN', |
|
| 474 | + ), |
|
| 475 | + ); |
|
| 476 | + |
|
| 477 | + return $args + array( |
|
| 478 | + 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 479 | + /* |
|
| 480 | 480 | * Ensure compatibility with Polylang. |
| 481 | 481 | * |
| 482 | 482 | * @see https://github.com/insideout10/wordlift-plugin/issues/855. |
@@ -484,102 +484,102 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @since 3.19.5 |
| 486 | 486 | */ |
| 487 | - 'lang' => '', |
|
| 488 | - 'tax_query' => $tax_query, |
|
| 489 | - ); |
|
| 490 | - } |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * Create a new entity. |
|
| 494 | - * |
|
| 495 | - * @since 3.9.0 |
|
| 496 | - * |
|
| 497 | - * @param string $name The entity name. |
|
| 498 | - * @param string $type_uri The entity's type URI. |
|
| 499 | - * @param null $logo The entity logo id (or NULL if none). |
|
| 500 | - * @param string $status The post status, by default 'publish'. |
|
| 501 | - * |
|
| 502 | - * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails. |
|
| 503 | - */ |
|
| 504 | - public function create( $name, $type_uri, $logo = null, $status = 'publish' ) { |
|
| 505 | - |
|
| 506 | - // Create an entity for the publisher. |
|
| 507 | - $post_id = @wp_insert_post( array( |
|
| 508 | - 'post_type' => self::TYPE_NAME, |
|
| 509 | - 'post_title' => $name, |
|
| 510 | - 'post_status' => $status, |
|
| 511 | - 'post_content' => '', |
|
| 512 | - ) ); |
|
| 513 | - |
|
| 514 | - // Return the error if any. |
|
| 515 | - if ( is_wp_error( $post_id ) ) { |
|
| 516 | - return $post_id; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - // Set the entity logo. |
|
| 520 | - if ( $logo && is_numeric( $logo ) ) { |
|
| 521 | - set_post_thumbnail( $post_id, $logo ); |
|
| 522 | - } |
|
| 523 | - |
|
| 524 | - // Set the entity type. |
|
| 525 | - Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri ); |
|
| 526 | - |
|
| 527 | - return $post_id; |
|
| 528 | - } |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * Get the entities related to the one with the specified id. By default only |
|
| 532 | - * published entities will be returned. |
|
| 533 | - * |
|
| 534 | - * @since 3.10.0 |
|
| 535 | - * |
|
| 536 | - * @param int $id The post id. |
|
| 537 | - * @param string $post_status The target post status (default = publish). |
|
| 538 | - * |
|
| 539 | - * @return array An array of post ids. |
|
| 540 | - */ |
|
| 541 | - public function get_related_entities( $id, $post_status = 'publish' ) { |
|
| 542 | - |
|
| 543 | - return $this->relation_service->get_objects( $id, 'ids', null, $post_status ); |
|
| 544 | - } |
|
| 545 | - |
|
| 546 | - /** |
|
| 547 | - * Get the list of entities. |
|
| 548 | - * |
|
| 549 | - * @since 3.12.2 |
|
| 550 | - * |
|
| 551 | - * @param array $params Custom parameters for WordPress' own {@link get_posts} function. |
|
| 552 | - * |
|
| 553 | - * @return array An array of entity posts. |
|
| 554 | - */ |
|
| 555 | - public function get( $params = array() ) { |
|
| 556 | - |
|
| 557 | - // Set the defaults. |
|
| 558 | - $defaults = array( 'post_type' => 'entity' ); |
|
| 559 | - |
|
| 560 | - // Merge the defaults with the provided parameters. |
|
| 561 | - $args = wp_parse_args( $params, $defaults ); |
|
| 562 | - |
|
| 563 | - // Call the `get_posts` function. |
|
| 564 | - return get_posts( $args ); |
|
| 565 | - } |
|
| 566 | - |
|
| 567 | - /** |
|
| 568 | - * The list of post type names which can be used for entities |
|
| 569 | - * |
|
| 570 | - * Criteria is that the post type is public. The list of valid post types |
|
| 571 | - * can be overridden with a filter. |
|
| 572 | - * |
|
| 573 | - * @since 3.15.0 |
|
| 574 | - * |
|
| 575 | - * @return array Array containing the names of the valid post types. |
|
| 576 | - */ |
|
| 577 | - static function valid_entity_post_types() { |
|
| 578 | - |
|
| 579 | - // Ignore builtins in the call to avoid getting attachments. |
|
| 580 | - $post_types = array( 'post', 'page', self::TYPE_NAME ); |
|
| 581 | - |
|
| 582 | - return apply_filters( 'wl_valid_entity_post_types', $post_types ); |
|
| 583 | - } |
|
| 487 | + 'lang' => '', |
|
| 488 | + 'tax_query' => $tax_query, |
|
| 489 | + ); |
|
| 490 | + } |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * Create a new entity. |
|
| 494 | + * |
|
| 495 | + * @since 3.9.0 |
|
| 496 | + * |
|
| 497 | + * @param string $name The entity name. |
|
| 498 | + * @param string $type_uri The entity's type URI. |
|
| 499 | + * @param null $logo The entity logo id (or NULL if none). |
|
| 500 | + * @param string $status The post status, by default 'publish'. |
|
| 501 | + * |
|
| 502 | + * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails. |
|
| 503 | + */ |
|
| 504 | + public function create( $name, $type_uri, $logo = null, $status = 'publish' ) { |
|
| 505 | + |
|
| 506 | + // Create an entity for the publisher. |
|
| 507 | + $post_id = @wp_insert_post( array( |
|
| 508 | + 'post_type' => self::TYPE_NAME, |
|
| 509 | + 'post_title' => $name, |
|
| 510 | + 'post_status' => $status, |
|
| 511 | + 'post_content' => '', |
|
| 512 | + ) ); |
|
| 513 | + |
|
| 514 | + // Return the error if any. |
|
| 515 | + if ( is_wp_error( $post_id ) ) { |
|
| 516 | + return $post_id; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + // Set the entity logo. |
|
| 520 | + if ( $logo && is_numeric( $logo ) ) { |
|
| 521 | + set_post_thumbnail( $post_id, $logo ); |
|
| 522 | + } |
|
| 523 | + |
|
| 524 | + // Set the entity type. |
|
| 525 | + Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri ); |
|
| 526 | + |
|
| 527 | + return $post_id; |
|
| 528 | + } |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * Get the entities related to the one with the specified id. By default only |
|
| 532 | + * published entities will be returned. |
|
| 533 | + * |
|
| 534 | + * @since 3.10.0 |
|
| 535 | + * |
|
| 536 | + * @param int $id The post id. |
|
| 537 | + * @param string $post_status The target post status (default = publish). |
|
| 538 | + * |
|
| 539 | + * @return array An array of post ids. |
|
| 540 | + */ |
|
| 541 | + public function get_related_entities( $id, $post_status = 'publish' ) { |
|
| 542 | + |
|
| 543 | + return $this->relation_service->get_objects( $id, 'ids', null, $post_status ); |
|
| 544 | + } |
|
| 545 | + |
|
| 546 | + /** |
|
| 547 | + * Get the list of entities. |
|
| 548 | + * |
|
| 549 | + * @since 3.12.2 |
|
| 550 | + * |
|
| 551 | + * @param array $params Custom parameters for WordPress' own {@link get_posts} function. |
|
| 552 | + * |
|
| 553 | + * @return array An array of entity posts. |
|
| 554 | + */ |
|
| 555 | + public function get( $params = array() ) { |
|
| 556 | + |
|
| 557 | + // Set the defaults. |
|
| 558 | + $defaults = array( 'post_type' => 'entity' ); |
|
| 559 | + |
|
| 560 | + // Merge the defaults with the provided parameters. |
|
| 561 | + $args = wp_parse_args( $params, $defaults ); |
|
| 562 | + |
|
| 563 | + // Call the `get_posts` function. |
|
| 564 | + return get_posts( $args ); |
|
| 565 | + } |
|
| 566 | + |
|
| 567 | + /** |
|
| 568 | + * The list of post type names which can be used for entities |
|
| 569 | + * |
|
| 570 | + * Criteria is that the post type is public. The list of valid post types |
|
| 571 | + * can be overridden with a filter. |
|
| 572 | + * |
|
| 573 | + * @since 3.15.0 |
|
| 574 | + * |
|
| 575 | + * @return array Array containing the names of the valid post types. |
|
| 576 | + */ |
|
| 577 | + static function valid_entity_post_types() { |
|
| 578 | + |
|
| 579 | + // Ignore builtins in the call to avoid getting attachments. |
|
| 580 | + $post_types = array( 'post', 'page', self::TYPE_NAME ); |
|
| 581 | + |
|
| 582 | + return apply_filters( 'wl_valid_entity_post_types', $post_types ); |
|
| 583 | + } |
|
| 584 | 584 | |
| 585 | 585 | } |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
| 97 | 97 | * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
| 98 | 98 | */ |
| 99 | - public function __construct( $ui_service, $relation_service, $entity_uri_service ) { |
|
| 99 | + public function __construct($ui_service, $relation_service, $entity_uri_service) { |
|
| 100 | 100 | |
| 101 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' ); |
|
| 101 | + $this->log = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service'); |
|
| 102 | 102 | |
| 103 | 103 | $this->ui_service = $ui_service; |
| 104 | 104 | $this->relation_service = $relation_service; |
@@ -129,17 +129,17 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return bool Return true if the post is an entity otherwise false. |
| 131 | 131 | */ |
| 132 | - public function is_entity( $post_id ) { |
|
| 132 | + public function is_entity($post_id) { |
|
| 133 | 133 | |
| 134 | - $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 134 | + $terms = wp_get_object_terms($post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
| 135 | 135 | |
| 136 | - if ( is_wp_error( $terms ) ) { |
|
| 137 | - $this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() ); |
|
| 136 | + if (is_wp_error($terms)) { |
|
| 137 | + $this->log->error("Cannot get the terms for post $post_id: ".$terms->get_error_message()); |
|
| 138 | 138 | |
| 139 | 139 | return false; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( empty( $terms ) ) { |
|
| 142 | + if (empty($terms)) { |
|
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 152 | 152 | */ |
| 153 | - foreach ( $terms as $term ) { |
|
| 154 | - if ( 'article' !== $term->slug ) { |
|
| 153 | + foreach ($terms as $term) { |
|
| 154 | + if ('article' !== $term->slug) { |
|
| 155 | 155 | return true; |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -171,19 +171,19 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @return string Returns a classification scope (e.g. 'what'). |
| 173 | 173 | */ |
| 174 | - public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) { |
|
| 174 | + public function get_classification_scope_for($post_id, $default = WL_WHAT_RELATION) { |
|
| 175 | 175 | |
| 176 | - if ( false === $this->is_entity( $post_id ) ) { |
|
| 176 | + if (false === $this->is_entity($post_id)) { |
|
| 177 | 177 | return $default; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Retrieve the entity type |
| 181 | - $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id ); |
|
| 182 | - $entity_type = str_replace( 'wl-', '', $entity_type_arr['css_class'] ); |
|
| 181 | + $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get($post_id); |
|
| 182 | + $entity_type = str_replace('wl-', '', $entity_type_arr['css_class']); |
|
| 183 | 183 | // Retrieve classification boxes configuration |
| 184 | - $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES ); |
|
| 185 | - foreach ( $classification_boxes as $cb ) { |
|
| 186 | - if ( in_array( $entity_type, $cb['registeredTypes'] ) ) { |
|
| 184 | + $classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES); |
|
| 185 | + foreach ($classification_boxes as $cb) { |
|
| 186 | + if (in_array($entity_type, $cb['registeredTypes'])) { |
|
| 187 | 187 | return $cb['id']; |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @return bool|null Null if it's not an entity, otherwise true if it's used. |
| 200 | 200 | */ |
| 201 | - public function is_used( $post_id ) { |
|
| 201 | + public function is_used($post_id) { |
|
| 202 | 202 | |
| 203 | - if ( false === $this->is_entity( $post_id ) ) { |
|
| 203 | + if (false === $this->is_entity($post_id)) { |
|
| 204 | 204 | return null; |
| 205 | 205 | } |
| 206 | 206 | // Retrieve the post |
| 207 | - $entity = get_post( $post_id ); |
|
| 207 | + $entity = get_post($post_id); |
|
| 208 | 208 | |
| 209 | 209 | global $wpdb; |
| 210 | 210 | // Retrieve Wordlift relation instances table name |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | ); |
| 218 | 218 | |
| 219 | 219 | // Perform the query |
| 220 | - $relation_instances = (int) $wpdb->get_var( $stmt ); |
|
| 220 | + $relation_instances = (int) $wpdb->get_var($stmt); |
|
| 221 | 221 | // If there is at least one relation instance for the current entity, then it's used |
| 222 | - if ( 0 < $relation_instances ) { |
|
| 222 | + if (0 < $relation_instances) { |
|
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | $stmt = $wpdb->prepare( |
| 228 | 228 | "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s", |
| 229 | 229 | $entity->ID, |
| 230 | - wl_get_entity_uri( $entity->ID ) |
|
| 230 | + wl_get_entity_uri($entity->ID) |
|
| 231 | 231 | ); |
| 232 | 232 | // Perform the query |
| 233 | - $meta_instances = (int) $wpdb->get_var( $stmt ); |
|
| 233 | + $meta_instances = (int) $wpdb->get_var($stmt); |
|
| 234 | 234 | |
| 235 | 235 | // If there is at least one meta that refers the current entity uri, then current entity is used |
| 236 | - if ( 0 < $meta_instances ) { |
|
| 236 | + if (0 < $meta_instances) { |
|
| 237 | 237 | return true; |
| 238 | 238 | } |
| 239 | 239 | |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return WP_Post|null A WP_Post instance or null if not found. |
| 255 | 255 | */ |
| 256 | - public function get_entity_post_by_uri( $uri ) { |
|
| 256 | + public function get_entity_post_by_uri($uri) { |
|
| 257 | 257 | |
| 258 | - return $this->entity_uri_service->get_entity( $uri ); |
|
| 258 | + return $this->entity_uri_service->get_entity($uri); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | * @param WP_Post $post Post object. |
| 271 | 271 | * @param bool $update Whether this is an existing post being updated or not. |
| 272 | 272 | */ |
| 273 | - public function save_post( $post_id, $post, $update ) { |
|
| 273 | + public function save_post($post_id, $post, $update) { |
|
| 274 | 274 | |
| 275 | 275 | // Avoid doing anything if post is autosave or a revision. |
| 276 | - if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) { |
|
| 276 | + if (wp_is_post_autosave($post) || wp_is_post_revision($post)) { |
|
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | // the $post_id in the save_post call matches the post id set in the request. |
| 284 | 284 | // |
| 285 | 285 | // If this is not the current post being saved or if it's not an entity, return. |
| 286 | - if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) { |
|
| 286 | + if ( ! isset($_REQUEST['post_ID']) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity($post_id)) { |
|
| 287 | 287 | return; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // Get the alt labels from the request (or empty array). |
| 291 | - $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array(); |
|
| 291 | + $alt_labels = isset($_REQUEST['wl_alternative_label']) ? $_REQUEST['wl_alternative_label'] : array(); |
|
| 292 | 292 | |
| 293 | 293 | // Set the alternative labels. |
| 294 | - $this->set_alternative_labels( $post_id, $alt_labels ); |
|
| 294 | + $this->set_alternative_labels($post_id, $alt_labels); |
|
| 295 | 295 | |
| 296 | 296 | } |
| 297 | 297 | |
@@ -303,22 +303,22 @@ discard block |
||
| 303 | 303 | * @param int $post_id The post id. |
| 304 | 304 | * @param array $alt_labels An array of labels. |
| 305 | 305 | */ |
| 306 | - public function set_alternative_labels( $post_id, $alt_labels ) { |
|
| 306 | + public function set_alternative_labels($post_id, $alt_labels) { |
|
| 307 | 307 | |
| 308 | 308 | // Force $alt_labels to be an array |
| 309 | - if ( ! is_array( $alt_labels ) ) { |
|
| 310 | - $alt_labels = array( $alt_labels ); |
|
| 309 | + if ( ! is_array($alt_labels)) { |
|
| 310 | + $alt_labels = array($alt_labels); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" ); |
|
| 313 | + $this->log->debug("Setting alternative labels [ post id :: $post_id ][ alt labels :: ".implode(',', $alt_labels)." ]"); |
|
| 314 | 314 | |
| 315 | 315 | // Delete all the existing alternate labels. |
| 316 | - delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY ); |
|
| 316 | + delete_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY); |
|
| 317 | 317 | |
| 318 | 318 | // Set the alternative labels. |
| 319 | - foreach ( $alt_labels as $alt_label ) { |
|
| 320 | - if ( ! empty( $alt_label ) ) { |
|
| 321 | - add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label ); |
|
| 319 | + foreach ($alt_labels as $alt_label) { |
|
| 320 | + if ( ! empty($alt_label)) { |
|
| 321 | + add_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -333,9 +333,9 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @return mixed An array of alternative labels. |
| 335 | 335 | */ |
| 336 | - public function get_alternative_labels( $post_id ) { |
|
| 336 | + public function get_alternative_labels($post_id) { |
|
| 337 | 337 | |
| 338 | - return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY ); |
|
| 338 | + return get_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | * |
| 348 | 348 | * @return array An array with the entity title and labels. |
| 349 | 349 | */ |
| 350 | - public function get_labels( $post_id ) { |
|
| 350 | + public function get_labels($post_id) { |
|
| 351 | 351 | |
| 352 | - return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) ); |
|
| 352 | + return array_merge((array) get_the_title($post_id), $this->get_alternative_labels($post_id)); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -359,25 +359,25 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @param WP_Post $post Post object. |
| 361 | 361 | */ |
| 362 | - public function edit_form_before_permalink( $post ) { |
|
| 362 | + public function edit_form_before_permalink($post) { |
|
| 363 | 363 | |
| 364 | 364 | // If it's not an entity, return. |
| 365 | - if ( ! $this->is_entity( $post->ID ) ) { |
|
| 365 | + if ( ! $this->is_entity($post->ID)) { |
|
| 366 | 366 | return; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | // Print the input template. |
| 370 | - $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() ); |
|
| 370 | + $this->ui_service->print_template('wl-tmpl-alternative-label-input', $this->get_alternative_label_input()); |
|
| 371 | 371 | |
| 372 | 372 | // Print all the currently set alternative labels. |
| 373 | - foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) { |
|
| 373 | + foreach ($this->get_alternative_labels($post->ID) as $alt_label) { |
|
| 374 | 374 | |
| 375 | - echo $this->get_alternative_label_input( $alt_label ); |
|
| 375 | + echo $this->get_alternative_label_input($alt_label); |
|
| 376 | 376 | |
| 377 | 377 | }; |
| 378 | 378 | |
| 379 | 379 | // Print the button. |
| 380 | - $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) ); |
|
| 380 | + $this->ui_service->print_button('wl-add-alternative-labels-button', __('Add more titles', 'wordlift')); |
|
| 381 | 381 | |
| 382 | 382 | } |
| 383 | 383 | |
@@ -390,25 +390,25 @@ discard block |
||
| 390 | 390 | * |
| 391 | 391 | * @return null|string The entity URI or NULL if not found or the dataset URI is not configured. |
| 392 | 392 | */ |
| 393 | - public function get_uri( $post_id ) { |
|
| 393 | + public function get_uri($post_id) { |
|
| 394 | 394 | |
| 395 | 395 | // If a null is given, nothing to do |
| 396 | - if ( null == $post_id ) { |
|
| 396 | + if (null == $post_id) { |
|
| 397 | 397 | return null; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true ); |
|
| 400 | + $uri = get_post_meta($post_id, WL_ENTITY_URL_META_NAME, true); |
|
| 401 | 401 | |
| 402 | 402 | // If the dataset uri is not properly configured, null is returned |
| 403 | - if ( '' === wl_configuration_get_redlink_dataset_uri() ) { |
|
| 403 | + if ('' === wl_configuration_get_redlink_dataset_uri()) { |
|
| 404 | 404 | return null; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | // Set the URI if it isn't set yet. |
| 408 | - $post_status = get_post_status( $post_id ); |
|
| 409 | - if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) { |
|
| 410 | - $uri = wl_build_entity_uri( $post_id ); |
|
| 411 | - wl_set_entity_uri( $post_id, $uri ); |
|
| 408 | + $post_status = get_post_status($post_id); |
|
| 409 | + if (empty($uri) && 'auto-draft' !== $post_status && 'revision' !== $post_status) { |
|
| 410 | + $uri = wl_build_entity_uri($post_id); |
|
| 411 | + wl_set_entity_uri($post_id, $uri); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | return $uri; |
@@ -424,9 +424,9 @@ discard block |
||
| 424 | 424 | * |
| 425 | 425 | * @return string The input HTML code. |
| 426 | 426 | */ |
| 427 | - private function get_alternative_label_input( $value = '' ) { |
|
| 427 | + private function get_alternative_label_input($value = '') { |
|
| 428 | 428 | |
| 429 | - return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) ); |
|
| 429 | + return sprintf(self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr($value), __('Delete', 'wordlift')); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | /** |
@@ -438,13 +438,13 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | public function count() { |
| 440 | 440 | |
| 441 | - $posts = get_posts( $this->add_criterias( array( |
|
| 441 | + $posts = get_posts($this->add_criterias(array( |
|
| 442 | 442 | 'fields' => 'ids', |
| 443 | 443 | 'post_status' => 'any', |
| 444 | - 'numberposts' => - 1, |
|
| 445 | - ) ) ); |
|
| 444 | + 'numberposts' => -1, |
|
| 445 | + ))); |
|
| 446 | 446 | |
| 447 | - return count( $posts ); |
|
| 447 | + return count($posts); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * |
| 458 | 458 | * @return array The arguments for a `get_posts` call. |
| 459 | 459 | */ |
| 460 | - public static function add_criterias( $args ) { |
|
| 460 | + public static function add_criterias($args) { |
|
| 461 | 461 | |
| 462 | 462 | // Build an optimal tax-query. |
| 463 | 463 | $tax_query = array( |
@@ -501,28 +501,28 @@ discard block |
||
| 501 | 501 | * |
| 502 | 502 | * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails. |
| 503 | 503 | */ |
| 504 | - public function create( $name, $type_uri, $logo = null, $status = 'publish' ) { |
|
| 504 | + public function create($name, $type_uri, $logo = null, $status = 'publish') { |
|
| 505 | 505 | |
| 506 | 506 | // Create an entity for the publisher. |
| 507 | - $post_id = @wp_insert_post( array( |
|
| 507 | + $post_id = @wp_insert_post(array( |
|
| 508 | 508 | 'post_type' => self::TYPE_NAME, |
| 509 | 509 | 'post_title' => $name, |
| 510 | 510 | 'post_status' => $status, |
| 511 | 511 | 'post_content' => '', |
| 512 | - ) ); |
|
| 512 | + )); |
|
| 513 | 513 | |
| 514 | 514 | // Return the error if any. |
| 515 | - if ( is_wp_error( $post_id ) ) { |
|
| 515 | + if (is_wp_error($post_id)) { |
|
| 516 | 516 | return $post_id; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | // Set the entity logo. |
| 520 | - if ( $logo && is_numeric( $logo ) ) { |
|
| 521 | - set_post_thumbnail( $post_id, $logo ); |
|
| 520 | + if ($logo && is_numeric($logo)) { |
|
| 521 | + set_post_thumbnail($post_id, $logo); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | // Set the entity type. |
| 525 | - Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri ); |
|
| 525 | + Wordlift_Entity_Type_Service::get_instance()->set($post_id, $type_uri); |
|
| 526 | 526 | |
| 527 | 527 | return $post_id; |
| 528 | 528 | } |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | * |
| 539 | 539 | * @return array An array of post ids. |
| 540 | 540 | */ |
| 541 | - public function get_related_entities( $id, $post_status = 'publish' ) { |
|
| 541 | + public function get_related_entities($id, $post_status = 'publish') { |
|
| 542 | 542 | |
| 543 | - return $this->relation_service->get_objects( $id, 'ids', null, $post_status ); |
|
| 543 | + return $this->relation_service->get_objects($id, 'ids', null, $post_status); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -552,16 +552,16 @@ discard block |
||
| 552 | 552 | * |
| 553 | 553 | * @return array An array of entity posts. |
| 554 | 554 | */ |
| 555 | - public function get( $params = array() ) { |
|
| 555 | + public function get($params = array()) { |
|
| 556 | 556 | |
| 557 | 557 | // Set the defaults. |
| 558 | - $defaults = array( 'post_type' => 'entity' ); |
|
| 558 | + $defaults = array('post_type' => 'entity'); |
|
| 559 | 559 | |
| 560 | 560 | // Merge the defaults with the provided parameters. |
| 561 | - $args = wp_parse_args( $params, $defaults ); |
|
| 561 | + $args = wp_parse_args($params, $defaults); |
|
| 562 | 562 | |
| 563 | 563 | // Call the `get_posts` function. |
| 564 | - return get_posts( $args ); |
|
| 564 | + return get_posts($args); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /** |
@@ -577,9 +577,9 @@ discard block |
||
| 577 | 577 | static function valid_entity_post_types() { |
| 578 | 578 | |
| 579 | 579 | // Ignore builtins in the call to avoid getting attachments. |
| 580 | - $post_types = array( 'post', 'page', self::TYPE_NAME ); |
|
| 580 | + $post_types = array('post', 'page', self::TYPE_NAME); |
|
| 581 | 581 | |
| 582 | - return apply_filters( 'wl_valid_entity_post_types', $post_types ); |
|
| 582 | + return apply_filters('wl_valid_entity_post_types', $post_types); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | } |
@@ -14,43 +14,43 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Wordlift_Url_Property_Service extends Wordlift_Simple_Property_Service { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The meta key for the schema:url property. |
|
| 19 | - */ |
|
| 20 | - const META_KEY = 'wl_schema_url'; |
|
| 17 | + /** |
|
| 18 | + * The meta key for the schema:url property. |
|
| 19 | + */ |
|
| 20 | + const META_KEY = 'wl_schema_url'; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Get the URLs associated with the post. |
|
| 24 | - * |
|
| 25 | - * @param int $post_id The post id. |
|
| 26 | - * @param string $meta_key The meta key. |
|
| 27 | - * |
|
| 28 | - * @return array An array of URLs. |
|
| 29 | - */ |
|
| 30 | - public function get( $post_id, $meta_key ) { |
|
| 22 | + /** |
|
| 23 | + * Get the URLs associated with the post. |
|
| 24 | + * |
|
| 25 | + * @param int $post_id The post id. |
|
| 26 | + * @param string $meta_key The meta key. |
|
| 27 | + * |
|
| 28 | + * @return array An array of URLs. |
|
| 29 | + */ |
|
| 30 | + public function get( $post_id, $meta_key ) { |
|
| 31 | 31 | |
| 32 | - // Get the meta values and push the <permalink> to |
|
| 33 | - // ensure that default url will be added to the schema:url's. |
|
| 34 | - /* |
|
| 32 | + // Get the meta values and push the <permalink> to |
|
| 33 | + // ensure that default url will be added to the schema:url's. |
|
| 34 | + /* |
|
| 35 | 35 | * Do not add `<permalink>` if one or more URLs have been provided by the editor. |
| 36 | 36 | * |
| 37 | 37 | * @see https://github.com/insideout10/wordlift-plugin/issues/913 |
| 38 | 38 | * |
| 39 | 39 | * @since 3.21.1 |
| 40 | 40 | */ |
| 41 | - $urls = parent::get( $post_id, $meta_key ) ?: array( '<permalink>' ); |
|
| 41 | + $urls = parent::get( $post_id, $meta_key ) ?: array( '<permalink>' ); |
|
| 42 | 42 | |
| 43 | - // Convert <permalink> in actual permalink values. |
|
| 44 | - return array_map( function ( $item ) use ( $post_id ) { |
|
| 45 | - /* |
|
| 43 | + // Convert <permalink> in actual permalink values. |
|
| 44 | + return array_map( function ( $item ) use ( $post_id ) { |
|
| 45 | + /* |
|
| 46 | 46 | * If `<permalink>` get the production permalink. |
| 47 | 47 | * |
| 48 | 48 | * @since 3.20.0 |
| 49 | 49 | * |
| 50 | 50 | * @see https://github.com/insideout10/wordlift-plugin/issues/850. |
| 51 | 51 | */ |
| 52 | - return '<permalink>' === $item ? Wordlift_Post_Adapter::get_production_permalink( $post_id ) : $item; |
|
| 53 | - }, array_unique( $urls ) ); |
|
| 54 | - } |
|
| 52 | + return '<permalink>' === $item ? Wordlift_Post_Adapter::get_production_permalink( $post_id ) : $item; |
|
| 53 | + }, array_unique( $urls ) ); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return array An array of URLs. |
| 29 | 29 | */ |
| 30 | - public function get( $post_id, $meta_key ) { |
|
| 30 | + public function get($post_id, $meta_key) { |
|
| 31 | 31 | |
| 32 | 32 | // Get the meta values and push the <permalink> to |
| 33 | 33 | // ensure that default url will be added to the schema:url's. |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @since 3.21.1 |
| 40 | 40 | */ |
| 41 | - $urls = parent::get( $post_id, $meta_key ) ?: array( '<permalink>' ); |
|
| 41 | + $urls = parent::get($post_id, $meta_key) ?: array('<permalink>'); |
|
| 42 | 42 | |
| 43 | 43 | // Convert <permalink> in actual permalink values. |
| 44 | - return array_map( function ( $item ) use ( $post_id ) { |
|
| 44 | + return array_map(function($item) use ($post_id) { |
|
| 45 | 45 | /* |
| 46 | 46 | * If `<permalink>` get the production permalink. |
| 47 | 47 | * |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @see https://github.com/insideout10/wordlift-plugin/issues/850. |
| 51 | 51 | */ |
| 52 | - return '<permalink>' === $item ? Wordlift_Post_Adapter::get_production_permalink( $post_id ) : $item; |
|
| 53 | - }, array_unique( $urls ) ); |
|
| 52 | + return '<permalink>' === $item ? Wordlift_Post_Adapter::get_production_permalink($post_id) : $item; |
|
| 53 | + }, array_unique($urls)); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | } |
@@ -28,1484 +28,1484 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class Wordlift { |
| 30 | 30 | |
| 31 | - //<editor-fold desc="## FIELDS"> |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | - * the plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access protected |
|
| 39 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | - */ |
|
| 41 | - protected $loader; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * The unique identifier of this plugin. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * @access protected |
|
| 48 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | - */ |
|
| 50 | - protected $plugin_name; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * The current version of the plugin. |
|
| 54 | - * |
|
| 55 | - * @since 1.0.0 |
|
| 56 | - * @access protected |
|
| 57 | - * @var string $version The current version of the plugin. |
|
| 58 | - */ |
|
| 59 | - protected $version; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | - * |
|
| 64 | - * @since 3.12.0 |
|
| 65 | - * @access protected |
|
| 66 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | - */ |
|
| 68 | - protected $tinymce_adapter; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The Thumbnail service. |
|
| 72 | - * |
|
| 73 | - * @since 3.1.5 |
|
| 74 | - * @access private |
|
| 75 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | - */ |
|
| 77 | - private $thumbnail_service; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * The UI service. |
|
| 81 | - * |
|
| 82 | - * @since 3.2.0 |
|
| 83 | - * @access private |
|
| 84 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | - */ |
|
| 86 | - private $ui_service; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * The Schema service. |
|
| 90 | - * |
|
| 91 | - * @since 3.3.0 |
|
| 92 | - * @access protected |
|
| 93 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | - */ |
|
| 95 | - protected $schema_service; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * The Entity service. |
|
| 99 | - * |
|
| 100 | - * @since 3.1.0 |
|
| 101 | - * @access protected |
|
| 102 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | - */ |
|
| 104 | - protected $entity_service; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * The Topic Taxonomy service. |
|
| 108 | - * |
|
| 109 | - * @since 3.5.0 |
|
| 110 | - * @access private |
|
| 111 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | - */ |
|
| 113 | - private $topic_taxonomy_service; |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * The Entity Types Taxonomy service. |
|
| 117 | - * |
|
| 118 | - * @since 3.18.0 |
|
| 119 | - * @access private |
|
| 120 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | - */ |
|
| 122 | - private $entity_types_taxonomy_service; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * The User service. |
|
| 126 | - * |
|
| 127 | - * @since 3.1.7 |
|
| 128 | - * @access protected |
|
| 129 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | - */ |
|
| 131 | - protected $user_service; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * The Timeline service. |
|
| 135 | - * |
|
| 136 | - * @since 3.1.0 |
|
| 137 | - * @access private |
|
| 138 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | - */ |
|
| 140 | - private $timeline_service; |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * The Redirect service. |
|
| 144 | - * |
|
| 145 | - * @since 3.2.0 |
|
| 146 | - * @access private |
|
| 147 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | - */ |
|
| 149 | - private $redirect_service; |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * The Notice service. |
|
| 153 | - * |
|
| 154 | - * @since 3.3.0 |
|
| 155 | - * @access private |
|
| 156 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | - */ |
|
| 158 | - private $notice_service; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The Entity list customization. |
|
| 162 | - * |
|
| 163 | - * @since 3.3.0 |
|
| 164 | - * @access protected |
|
| 165 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | - */ |
|
| 167 | - protected $entity_list_service; |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * The Entity Types Taxonomy Walker. |
|
| 171 | - * |
|
| 172 | - * @since 3.1.0 |
|
| 173 | - * @access private |
|
| 174 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | - */ |
|
| 176 | - private $entity_types_taxonomy_walker; |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * The ShareThis service. |
|
| 180 | - * |
|
| 181 | - * @since 3.2.0 |
|
| 182 | - * @access private |
|
| 183 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | - */ |
|
| 185 | - private $sharethis_service; |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * The PrimaShop adapter. |
|
| 189 | - * |
|
| 190 | - * @since 3.2.3 |
|
| 191 | - * @access private |
|
| 192 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | - */ |
|
| 194 | - private $primashop_adapter; |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * The WordLift Dashboard adapter. |
|
| 198 | - * |
|
| 199 | - * @since 3.4.0 |
|
| 200 | - * @access private |
|
| 201 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | - */ |
|
| 203 | - private $dashboard_service; |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * The entity type service. |
|
| 207 | - * |
|
| 208 | - * @since 3.6.0 |
|
| 209 | - * @access private |
|
| 210 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | - */ |
|
| 212 | - private $entity_post_type_service; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | - * |
|
| 217 | - * @since 3.6.0 |
|
| 218 | - * @access private |
|
| 219 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 220 | - */ |
|
| 221 | - private $entity_link_service; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | - * |
|
| 226 | - * @since 3.6.0 |
|
| 227 | - * @access protected |
|
| 228 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | - */ |
|
| 230 | - protected $sparql_service; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * A {@link Wordlift_Import_Service} instance. |
|
| 234 | - * |
|
| 235 | - * @since 3.6.0 |
|
| 236 | - * @access private |
|
| 237 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | - */ |
|
| 239 | - private $import_service; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | - * |
|
| 244 | - * @since 3.6.0 |
|
| 245 | - * @access private |
|
| 246 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | - */ |
|
| 248 | - private $rebuild_service; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | - * |
|
| 253 | - * @since 3.7.0 |
|
| 254 | - * @access protected |
|
| 255 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | - */ |
|
| 257 | - protected $jsonld_service; |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | - * |
|
| 262 | - * @since 3.14.0 |
|
| 263 | - * @access protected |
|
| 264 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | - */ |
|
| 266 | - protected $jsonld_website_converter; |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | - * |
|
| 271 | - * @since 3.7.0 |
|
| 272 | - * @access private |
|
| 273 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | - */ |
|
| 275 | - private $property_factory; |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * The 'Download Your Data' page. |
|
| 279 | - * |
|
| 280 | - * @since 3.6.0 |
|
| 281 | - * @access private |
|
| 282 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | - */ |
|
| 284 | - private $download_your_data_page; |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * The 'WordLift Settings' page. |
|
| 288 | - * |
|
| 289 | - * @since 3.11.0 |
|
| 290 | - * @access protected |
|
| 291 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | - */ |
|
| 293 | - protected $settings_page; |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * The 'WordLift Batch analysis' page. |
|
| 297 | - * |
|
| 298 | - * @since 3.14.0 |
|
| 299 | - * @access protected |
|
| 300 | - * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | - */ |
|
| 302 | - protected $batch_analysis_page; |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * The install wizard page. |
|
| 306 | - * |
|
| 307 | - * @since 3.9.0 |
|
| 308 | - * @access private |
|
| 309 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | - */ |
|
| 311 | - private $admin_setup; |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | - * linking of entities to their pages. |
|
| 316 | - * |
|
| 317 | - * @since 3.8.0 |
|
| 318 | - * @access private |
|
| 319 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | - */ |
|
| 321 | - private $content_filter_service; |
|
| 322 | - |
|
| 323 | - /** |
|
| 324 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | - * |
|
| 326 | - * @since 3.9.0 |
|
| 327 | - * @access private |
|
| 328 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | - */ |
|
| 330 | - private $key_validation_service; |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | - * |
|
| 335 | - * @since 3.10.0 |
|
| 336 | - * @access private |
|
| 337 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | - */ |
|
| 339 | - private $rating_service; |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | - * |
|
| 344 | - * @since 3.10.0 |
|
| 345 | - * @access protected |
|
| 346 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | - */ |
|
| 348 | - protected $post_to_jsonld_converter; |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | - * |
|
| 353 | - * @since 3.10.0 |
|
| 354 | - * @access protected |
|
| 355 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | - */ |
|
| 357 | - protected $configuration_service; |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * A {@link Wordlift_Install_Service} instance. |
|
| 361 | - * |
|
| 362 | - * @since 3.18.0 |
|
| 363 | - * @access protected |
|
| 364 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | - */ |
|
| 366 | - protected $install_service; |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | - * |
|
| 371 | - * @since 3.10.0 |
|
| 372 | - * @access protected |
|
| 373 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | - */ |
|
| 375 | - protected $entity_type_service; |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | - * |
|
| 380 | - * @since 3.10.0 |
|
| 381 | - * @access protected |
|
| 382 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | - */ |
|
| 384 | - protected $entity_post_to_jsonld_converter; |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | - * |
|
| 389 | - * @since 3.10.0 |
|
| 390 | - * @access protected |
|
| 391 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | - */ |
|
| 393 | - protected $postid_to_jsonld_converter; |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | - * |
|
| 398 | - * @since 3.9.8 |
|
| 399 | - * @access private |
|
| 400 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | - */ |
|
| 402 | - private $status_page; |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | - * |
|
| 407 | - * @since 3.11.0 |
|
| 408 | - * @access protected |
|
| 409 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | - */ |
|
| 411 | - protected $category_taxonomy_service; |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | - * |
|
| 416 | - * @since 3.11.0 |
|
| 417 | - * @access protected |
|
| 418 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | - */ |
|
| 420 | - protected $entity_page_service; |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | - * |
|
| 425 | - * @since 3.11.0 |
|
| 426 | - * @access protected |
|
| 427 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | - */ |
|
| 429 | - protected $settings_page_action_link; |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 433 | - * |
|
| 434 | - * @since 3.11.0 |
|
| 435 | - * @access protected |
|
| 436 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | - */ |
|
| 438 | - protected $analytics_settings_page_action_link; |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | - * |
|
| 443 | - * @since 3.11.0 |
|
| 444 | - * @access protected |
|
| 445 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | - */ |
|
| 447 | - protected $analytics_connect; |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | - * |
|
| 452 | - * @since 3.11.0 |
|
| 453 | - * @access protected |
|
| 454 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | - */ |
|
| 456 | - protected $publisher_ajax_adapter; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | - * |
|
| 461 | - * @since 3.11.0 |
|
| 462 | - * @access protected |
|
| 463 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | - */ |
|
| 465 | - protected $input_element; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | - * |
|
| 470 | - * @since 3.13.0 |
|
| 471 | - * @access protected |
|
| 472 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | - */ |
|
| 474 | - protected $radio_input_element; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | - * |
|
| 479 | - * @since 3.11.0 |
|
| 480 | - * @access protected |
|
| 481 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | - */ |
|
| 483 | - protected $language_select_element; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | - * |
|
| 488 | - * @since 3.18.0 |
|
| 489 | - * @access protected |
|
| 490 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | - */ |
|
| 492 | - protected $country_select_element; |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | - * |
|
| 497 | - * @since 3.11.0 |
|
| 498 | - * @access protected |
|
| 499 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | - */ |
|
| 501 | - protected $publisher_element; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | - * |
|
| 506 | - * @since 3.11.0 |
|
| 507 | - * @access protected |
|
| 508 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | - */ |
|
| 510 | - protected $select2_element; |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * The controller for the entity type list admin page |
|
| 514 | - * |
|
| 515 | - * @since 3.11.0 |
|
| 516 | - * @access private |
|
| 517 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | - */ |
|
| 519 | - private $entity_type_admin_page; |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * The controller for the entity type settings admin page |
|
| 523 | - * |
|
| 524 | - * @since 3.11.0 |
|
| 525 | - * @access private |
|
| 526 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | - */ |
|
| 528 | - private $entity_type_settings_admin_page; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | - * |
|
| 533 | - * @since 3.11.0 |
|
| 534 | - * @access protected |
|
| 535 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | - */ |
|
| 537 | - protected $related_entities_cloud_widget; |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | - * |
|
| 542 | - * @since 3.14.0 |
|
| 543 | - * @access protected |
|
| 544 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | - */ |
|
| 546 | - protected $author_element; |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | - * |
|
| 551 | - * @since 3.14.0 |
|
| 552 | - * @access protected |
|
| 553 | - * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | - */ |
|
| 555 | - protected $batch_analysis_service; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | - * |
|
| 560 | - * @since 3.12.0 |
|
| 561 | - * @access protected |
|
| 562 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | - */ |
|
| 564 | - protected $sample_data_service; |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | - * |
|
| 569 | - * @since 3.12.0 |
|
| 570 | - * @access protected |
|
| 571 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | - */ |
|
| 573 | - protected $sample_data_ajax_adapter; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.14.2 |
|
| 579 | - * @access protected |
|
| 580 | - * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | - */ |
|
| 582 | - private $batch_analysis_adapter; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.14.3 |
|
| 588 | - * @access private |
|
| 589 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | - */ |
|
| 591 | - private $relation_rebuild_service; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | - * |
|
| 596 | - * @since 3.14.3 |
|
| 597 | - * @access private |
|
| 598 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | - */ |
|
| 600 | - private $relation_rebuild_adapter; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | - * |
|
| 605 | - * @since 3.18.0 |
|
| 606 | - * @access private |
|
| 607 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | - */ |
|
| 609 | - private $reference_rebuild_service; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | - * |
|
| 614 | - * @since 3.16.0 |
|
| 615 | - * @access protected |
|
| 616 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | - */ |
|
| 618 | - protected $google_analytics_export_service; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * {@link Wordlift}'s singleton instance. |
|
| 622 | - * |
|
| 623 | - * @since 3.15.0 |
|
| 624 | - * @access protected |
|
| 625 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | - */ |
|
| 627 | - protected $entity_type_adapter; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | - * |
|
| 632 | - * @since 3.15.0 |
|
| 633 | - * @access protected |
|
| 634 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | - */ |
|
| 636 | - protected $linked_data_service; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | - * |
|
| 641 | - * @since 3.15.0 |
|
| 642 | - * @access protected |
|
| 643 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | - */ |
|
| 645 | - protected $storage_factory; |
|
| 646 | - |
|
| 647 | - /** |
|
| 648 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | - * |
|
| 650 | - * @since 3.15.0 |
|
| 651 | - * @access protected |
|
| 652 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | - */ |
|
| 654 | - protected $rendition_factory; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | - * |
|
| 659 | - * @since 3.15.0 |
|
| 660 | - * @access private |
|
| 661 | - * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | - */ |
|
| 663 | - private $autocomplete_service; |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | - * |
|
| 668 | - * @since 3.15.0 |
|
| 669 | - * @access private |
|
| 670 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | - */ |
|
| 672 | - private $autocomplete_adapter; |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | - * |
|
| 677 | - * @since 3.15.0 |
|
| 678 | - * @access protected |
|
| 679 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | - */ |
|
| 681 | - protected $relation_service; |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | - * |
|
| 686 | - * @since 3.16.0 |
|
| 687 | - * @access protected |
|
| 688 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | - * |
|
| 690 | - */ |
|
| 691 | - protected $cached_postid_to_jsonld_converter; |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | - * |
|
| 696 | - * @since 3.16.0 |
|
| 697 | - * @access protected |
|
| 698 | - * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | - */ |
|
| 700 | - protected $file_cache_service; |
|
| 701 | - |
|
| 702 | - /** |
|
| 703 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | - * |
|
| 705 | - * @since 3.16.3 |
|
| 706 | - * @access protected |
|
| 707 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | - */ |
|
| 709 | - protected $entity_uri_service; |
|
| 710 | - |
|
| 711 | - /** |
|
| 712 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | - * |
|
| 714 | - * @since 3.19.0 |
|
| 715 | - * @access protected |
|
| 716 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | - */ |
|
| 718 | - protected $publisher_service; |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * {@link Wordlift}'s singleton instance. |
|
| 722 | - * |
|
| 723 | - * @since 3.11.2 |
|
| 724 | - * @access private |
|
| 725 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | - */ |
|
| 727 | - private static $instance; |
|
| 728 | - |
|
| 729 | - //</editor-fold> |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Define the core functionality of the plugin. |
|
| 733 | - * |
|
| 734 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | - * the public-facing side of the site. |
|
| 737 | - * |
|
| 738 | - * @since 1.0.0 |
|
| 739 | - */ |
|
| 740 | - public function __construct() { |
|
| 741 | - |
|
| 742 | - self::$instance = $this; |
|
| 743 | - |
|
| 744 | - $this->plugin_name = 'wordlift'; |
|
| 745 | - $this->version = '3.21.1'; |
|
| 746 | - $this->load_dependencies(); |
|
| 747 | - $this->set_locale(); |
|
| 748 | - $this->define_admin_hooks(); |
|
| 749 | - $this->define_public_hooks(); |
|
| 750 | - |
|
| 751 | - // If we're in `WP_CLI` load the related files. |
|
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | - $this->load_cli_dependencies(); |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - /** |
|
| 759 | - * Get the singleton instance. |
|
| 760 | - * |
|
| 761 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 762 | - * @since 3.11.2 |
|
| 763 | - * |
|
| 764 | - */ |
|
| 765 | - public static function get_instance() { |
|
| 766 | - |
|
| 767 | - return self::$instance; |
|
| 768 | - } |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * Load the required dependencies for this plugin. |
|
| 772 | - * |
|
| 773 | - * Include the following files that make up the plugin: |
|
| 774 | - * |
|
| 775 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | - * |
|
| 780 | - * Create an instance of the loader which will be used to register the hooks |
|
| 781 | - * with WordPress. |
|
| 782 | - * |
|
| 783 | - * @since 1.0.0 |
|
| 784 | - * @access private |
|
| 785 | - */ |
|
| 786 | - private function load_dependencies() { |
|
| 787 | - |
|
| 788 | - /** |
|
| 789 | - * The class responsible for orchestrating the actions and filters of the |
|
| 790 | - * core plugin. |
|
| 791 | - */ |
|
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | - |
|
| 794 | - // The class responsible for plugin uninstall. |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * The class responsible for defining internationalization functionality |
|
| 799 | - * of the plugin. |
|
| 800 | - */ |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * WordLift's supported languages. |
|
| 805 | - */ |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * WordLift's supported countries. |
|
| 810 | - */ |
|
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * Provide support functions to sanitize data. |
|
| 815 | - */ |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | - |
|
| 818 | - /** Services. */ |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * The Query builder. |
|
| 832 | - */ |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | - |
|
| 835 | - /** |
|
| 836 | - * The Schema service. |
|
| 837 | - */ |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | - |
|
| 840 | - /** |
|
| 841 | - * The schema:url property service. |
|
| 842 | - */ |
|
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The UI service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * The Thumbnail service. |
|
| 853 | - */ |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | - |
|
| 856 | - /** |
|
| 857 | - * The Entity Types Taxonomy service. |
|
| 858 | - */ |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | - |
|
| 861 | - /** |
|
| 862 | - * The Entity service. |
|
| 863 | - */ |
|
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | - |
|
| 867 | - // Add the entity rating service. |
|
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | - |
|
| 870 | - /** |
|
| 871 | - * The User service. |
|
| 872 | - */ |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * The Timeline service. |
|
| 877 | - */ |
|
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | - |
|
| 880 | - /** |
|
| 881 | - * The Topic Taxonomy service. |
|
| 882 | - */ |
|
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | - |
|
| 885 | - /** |
|
| 886 | - * The SPARQL service. |
|
| 887 | - */ |
|
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * The WordLift import service. |
|
| 892 | - */ |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | - |
|
| 895 | - /** |
|
| 896 | - * The WordLift URI service. |
|
| 897 | - */ |
|
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | - |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | - |
|
| 914 | - /** |
|
| 915 | - * Load the converters. |
|
| 916 | - */ |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | - |
|
| 924 | - /** |
|
| 925 | - * Load cache-related files. |
|
| 926 | - */ |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | - |
|
| 929 | - /** |
|
| 930 | - * Load the content filter. |
|
| 931 | - */ |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | - |
|
| 934 | - /* |
|
| 31 | + //<editor-fold desc="## FIELDS"> |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | + * the plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access protected |
|
| 39 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | + */ |
|
| 41 | + protected $loader; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * The unique identifier of this plugin. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * @access protected |
|
| 48 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | + */ |
|
| 50 | + protected $plugin_name; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * The current version of the plugin. |
|
| 54 | + * |
|
| 55 | + * @since 1.0.0 |
|
| 56 | + * @access protected |
|
| 57 | + * @var string $version The current version of the plugin. |
|
| 58 | + */ |
|
| 59 | + protected $version; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | + * |
|
| 64 | + * @since 3.12.0 |
|
| 65 | + * @access protected |
|
| 66 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | + */ |
|
| 68 | + protected $tinymce_adapter; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The Thumbnail service. |
|
| 72 | + * |
|
| 73 | + * @since 3.1.5 |
|
| 74 | + * @access private |
|
| 75 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | + */ |
|
| 77 | + private $thumbnail_service; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * The UI service. |
|
| 81 | + * |
|
| 82 | + * @since 3.2.0 |
|
| 83 | + * @access private |
|
| 84 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | + */ |
|
| 86 | + private $ui_service; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * The Schema service. |
|
| 90 | + * |
|
| 91 | + * @since 3.3.0 |
|
| 92 | + * @access protected |
|
| 93 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | + */ |
|
| 95 | + protected $schema_service; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * The Entity service. |
|
| 99 | + * |
|
| 100 | + * @since 3.1.0 |
|
| 101 | + * @access protected |
|
| 102 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | + */ |
|
| 104 | + protected $entity_service; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * The Topic Taxonomy service. |
|
| 108 | + * |
|
| 109 | + * @since 3.5.0 |
|
| 110 | + * @access private |
|
| 111 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | + */ |
|
| 113 | + private $topic_taxonomy_service; |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * The Entity Types Taxonomy service. |
|
| 117 | + * |
|
| 118 | + * @since 3.18.0 |
|
| 119 | + * @access private |
|
| 120 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | + */ |
|
| 122 | + private $entity_types_taxonomy_service; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * The User service. |
|
| 126 | + * |
|
| 127 | + * @since 3.1.7 |
|
| 128 | + * @access protected |
|
| 129 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | + */ |
|
| 131 | + protected $user_service; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * The Timeline service. |
|
| 135 | + * |
|
| 136 | + * @since 3.1.0 |
|
| 137 | + * @access private |
|
| 138 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | + */ |
|
| 140 | + private $timeline_service; |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * The Redirect service. |
|
| 144 | + * |
|
| 145 | + * @since 3.2.0 |
|
| 146 | + * @access private |
|
| 147 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | + */ |
|
| 149 | + private $redirect_service; |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * The Notice service. |
|
| 153 | + * |
|
| 154 | + * @since 3.3.0 |
|
| 155 | + * @access private |
|
| 156 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | + */ |
|
| 158 | + private $notice_service; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The Entity list customization. |
|
| 162 | + * |
|
| 163 | + * @since 3.3.0 |
|
| 164 | + * @access protected |
|
| 165 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | + */ |
|
| 167 | + protected $entity_list_service; |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * The Entity Types Taxonomy Walker. |
|
| 171 | + * |
|
| 172 | + * @since 3.1.0 |
|
| 173 | + * @access private |
|
| 174 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | + */ |
|
| 176 | + private $entity_types_taxonomy_walker; |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * The ShareThis service. |
|
| 180 | + * |
|
| 181 | + * @since 3.2.0 |
|
| 182 | + * @access private |
|
| 183 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | + */ |
|
| 185 | + private $sharethis_service; |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * The PrimaShop adapter. |
|
| 189 | + * |
|
| 190 | + * @since 3.2.3 |
|
| 191 | + * @access private |
|
| 192 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | + */ |
|
| 194 | + private $primashop_adapter; |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * The WordLift Dashboard adapter. |
|
| 198 | + * |
|
| 199 | + * @since 3.4.0 |
|
| 200 | + * @access private |
|
| 201 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | + */ |
|
| 203 | + private $dashboard_service; |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * The entity type service. |
|
| 207 | + * |
|
| 208 | + * @since 3.6.0 |
|
| 209 | + * @access private |
|
| 210 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | + */ |
|
| 212 | + private $entity_post_type_service; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | + * |
|
| 217 | + * @since 3.6.0 |
|
| 218 | + * @access private |
|
| 219 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 220 | + */ |
|
| 221 | + private $entity_link_service; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | + * |
|
| 226 | + * @since 3.6.0 |
|
| 227 | + * @access protected |
|
| 228 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | + */ |
|
| 230 | + protected $sparql_service; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * A {@link Wordlift_Import_Service} instance. |
|
| 234 | + * |
|
| 235 | + * @since 3.6.0 |
|
| 236 | + * @access private |
|
| 237 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | + */ |
|
| 239 | + private $import_service; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | + * |
|
| 244 | + * @since 3.6.0 |
|
| 245 | + * @access private |
|
| 246 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | + */ |
|
| 248 | + private $rebuild_service; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | + * |
|
| 253 | + * @since 3.7.0 |
|
| 254 | + * @access protected |
|
| 255 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | + */ |
|
| 257 | + protected $jsonld_service; |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | + * |
|
| 262 | + * @since 3.14.0 |
|
| 263 | + * @access protected |
|
| 264 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | + */ |
|
| 266 | + protected $jsonld_website_converter; |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | + * |
|
| 271 | + * @since 3.7.0 |
|
| 272 | + * @access private |
|
| 273 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | + */ |
|
| 275 | + private $property_factory; |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * The 'Download Your Data' page. |
|
| 279 | + * |
|
| 280 | + * @since 3.6.0 |
|
| 281 | + * @access private |
|
| 282 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | + */ |
|
| 284 | + private $download_your_data_page; |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * The 'WordLift Settings' page. |
|
| 288 | + * |
|
| 289 | + * @since 3.11.0 |
|
| 290 | + * @access protected |
|
| 291 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | + */ |
|
| 293 | + protected $settings_page; |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * The 'WordLift Batch analysis' page. |
|
| 297 | + * |
|
| 298 | + * @since 3.14.0 |
|
| 299 | + * @access protected |
|
| 300 | + * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | + */ |
|
| 302 | + protected $batch_analysis_page; |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * The install wizard page. |
|
| 306 | + * |
|
| 307 | + * @since 3.9.0 |
|
| 308 | + * @access private |
|
| 309 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | + */ |
|
| 311 | + private $admin_setup; |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | + * linking of entities to their pages. |
|
| 316 | + * |
|
| 317 | + * @since 3.8.0 |
|
| 318 | + * @access private |
|
| 319 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | + */ |
|
| 321 | + private $content_filter_service; |
|
| 322 | + |
|
| 323 | + /** |
|
| 324 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | + * |
|
| 326 | + * @since 3.9.0 |
|
| 327 | + * @access private |
|
| 328 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | + */ |
|
| 330 | + private $key_validation_service; |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | + * |
|
| 335 | + * @since 3.10.0 |
|
| 336 | + * @access private |
|
| 337 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | + */ |
|
| 339 | + private $rating_service; |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | + * |
|
| 344 | + * @since 3.10.0 |
|
| 345 | + * @access protected |
|
| 346 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | + */ |
|
| 348 | + protected $post_to_jsonld_converter; |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | + * |
|
| 353 | + * @since 3.10.0 |
|
| 354 | + * @access protected |
|
| 355 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | + */ |
|
| 357 | + protected $configuration_service; |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * A {@link Wordlift_Install_Service} instance. |
|
| 361 | + * |
|
| 362 | + * @since 3.18.0 |
|
| 363 | + * @access protected |
|
| 364 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | + */ |
|
| 366 | + protected $install_service; |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | + * |
|
| 371 | + * @since 3.10.0 |
|
| 372 | + * @access protected |
|
| 373 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | + */ |
|
| 375 | + protected $entity_type_service; |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | + * |
|
| 380 | + * @since 3.10.0 |
|
| 381 | + * @access protected |
|
| 382 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | + */ |
|
| 384 | + protected $entity_post_to_jsonld_converter; |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | + * |
|
| 389 | + * @since 3.10.0 |
|
| 390 | + * @access protected |
|
| 391 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | + */ |
|
| 393 | + protected $postid_to_jsonld_converter; |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | + * |
|
| 398 | + * @since 3.9.8 |
|
| 399 | + * @access private |
|
| 400 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | + */ |
|
| 402 | + private $status_page; |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | + * |
|
| 407 | + * @since 3.11.0 |
|
| 408 | + * @access protected |
|
| 409 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | + */ |
|
| 411 | + protected $category_taxonomy_service; |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | + * |
|
| 416 | + * @since 3.11.0 |
|
| 417 | + * @access protected |
|
| 418 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | + */ |
|
| 420 | + protected $entity_page_service; |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | + * |
|
| 425 | + * @since 3.11.0 |
|
| 426 | + * @access protected |
|
| 427 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | + */ |
|
| 429 | + protected $settings_page_action_link; |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 433 | + * |
|
| 434 | + * @since 3.11.0 |
|
| 435 | + * @access protected |
|
| 436 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | + */ |
|
| 438 | + protected $analytics_settings_page_action_link; |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | + * |
|
| 443 | + * @since 3.11.0 |
|
| 444 | + * @access protected |
|
| 445 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | + */ |
|
| 447 | + protected $analytics_connect; |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | + * |
|
| 452 | + * @since 3.11.0 |
|
| 453 | + * @access protected |
|
| 454 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | + */ |
|
| 456 | + protected $publisher_ajax_adapter; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | + * |
|
| 461 | + * @since 3.11.0 |
|
| 462 | + * @access protected |
|
| 463 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | + */ |
|
| 465 | + protected $input_element; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | + * |
|
| 470 | + * @since 3.13.0 |
|
| 471 | + * @access protected |
|
| 472 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | + */ |
|
| 474 | + protected $radio_input_element; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | + * |
|
| 479 | + * @since 3.11.0 |
|
| 480 | + * @access protected |
|
| 481 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | + */ |
|
| 483 | + protected $language_select_element; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | + * |
|
| 488 | + * @since 3.18.0 |
|
| 489 | + * @access protected |
|
| 490 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | + */ |
|
| 492 | + protected $country_select_element; |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | + * |
|
| 497 | + * @since 3.11.0 |
|
| 498 | + * @access protected |
|
| 499 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | + */ |
|
| 501 | + protected $publisher_element; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | + * |
|
| 506 | + * @since 3.11.0 |
|
| 507 | + * @access protected |
|
| 508 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | + */ |
|
| 510 | + protected $select2_element; |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * The controller for the entity type list admin page |
|
| 514 | + * |
|
| 515 | + * @since 3.11.0 |
|
| 516 | + * @access private |
|
| 517 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | + */ |
|
| 519 | + private $entity_type_admin_page; |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * The controller for the entity type settings admin page |
|
| 523 | + * |
|
| 524 | + * @since 3.11.0 |
|
| 525 | + * @access private |
|
| 526 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | + */ |
|
| 528 | + private $entity_type_settings_admin_page; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | + * |
|
| 533 | + * @since 3.11.0 |
|
| 534 | + * @access protected |
|
| 535 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | + */ |
|
| 537 | + protected $related_entities_cloud_widget; |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | + * |
|
| 542 | + * @since 3.14.0 |
|
| 543 | + * @access protected |
|
| 544 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | + */ |
|
| 546 | + protected $author_element; |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | + * |
|
| 551 | + * @since 3.14.0 |
|
| 552 | + * @access protected |
|
| 553 | + * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | + */ |
|
| 555 | + protected $batch_analysis_service; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | + * |
|
| 560 | + * @since 3.12.0 |
|
| 561 | + * @access protected |
|
| 562 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | + */ |
|
| 564 | + protected $sample_data_service; |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | + * |
|
| 569 | + * @since 3.12.0 |
|
| 570 | + * @access protected |
|
| 571 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | + */ |
|
| 573 | + protected $sample_data_ajax_adapter; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.14.2 |
|
| 579 | + * @access protected |
|
| 580 | + * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | + */ |
|
| 582 | + private $batch_analysis_adapter; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.14.3 |
|
| 588 | + * @access private |
|
| 589 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | + */ |
|
| 591 | + private $relation_rebuild_service; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | + * |
|
| 596 | + * @since 3.14.3 |
|
| 597 | + * @access private |
|
| 598 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | + */ |
|
| 600 | + private $relation_rebuild_adapter; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | + * |
|
| 605 | + * @since 3.18.0 |
|
| 606 | + * @access private |
|
| 607 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | + */ |
|
| 609 | + private $reference_rebuild_service; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | + * |
|
| 614 | + * @since 3.16.0 |
|
| 615 | + * @access protected |
|
| 616 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | + */ |
|
| 618 | + protected $google_analytics_export_service; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * {@link Wordlift}'s singleton instance. |
|
| 622 | + * |
|
| 623 | + * @since 3.15.0 |
|
| 624 | + * @access protected |
|
| 625 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | + */ |
|
| 627 | + protected $entity_type_adapter; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | + * |
|
| 632 | + * @since 3.15.0 |
|
| 633 | + * @access protected |
|
| 634 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | + */ |
|
| 636 | + protected $linked_data_service; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | + * |
|
| 641 | + * @since 3.15.0 |
|
| 642 | + * @access protected |
|
| 643 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | + */ |
|
| 645 | + protected $storage_factory; |
|
| 646 | + |
|
| 647 | + /** |
|
| 648 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | + * |
|
| 650 | + * @since 3.15.0 |
|
| 651 | + * @access protected |
|
| 652 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | + */ |
|
| 654 | + protected $rendition_factory; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | + * |
|
| 659 | + * @since 3.15.0 |
|
| 660 | + * @access private |
|
| 661 | + * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | + */ |
|
| 663 | + private $autocomplete_service; |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | + * |
|
| 668 | + * @since 3.15.0 |
|
| 669 | + * @access private |
|
| 670 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | + */ |
|
| 672 | + private $autocomplete_adapter; |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | + * |
|
| 677 | + * @since 3.15.0 |
|
| 678 | + * @access protected |
|
| 679 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | + */ |
|
| 681 | + protected $relation_service; |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | + * |
|
| 686 | + * @since 3.16.0 |
|
| 687 | + * @access protected |
|
| 688 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | + * |
|
| 690 | + */ |
|
| 691 | + protected $cached_postid_to_jsonld_converter; |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | + * |
|
| 696 | + * @since 3.16.0 |
|
| 697 | + * @access protected |
|
| 698 | + * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | + */ |
|
| 700 | + protected $file_cache_service; |
|
| 701 | + |
|
| 702 | + /** |
|
| 703 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | + * |
|
| 705 | + * @since 3.16.3 |
|
| 706 | + * @access protected |
|
| 707 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | + */ |
|
| 709 | + protected $entity_uri_service; |
|
| 710 | + |
|
| 711 | + /** |
|
| 712 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | + * |
|
| 714 | + * @since 3.19.0 |
|
| 715 | + * @access protected |
|
| 716 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | + */ |
|
| 718 | + protected $publisher_service; |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * {@link Wordlift}'s singleton instance. |
|
| 722 | + * |
|
| 723 | + * @since 3.11.2 |
|
| 724 | + * @access private |
|
| 725 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | + */ |
|
| 727 | + private static $instance; |
|
| 728 | + |
|
| 729 | + //</editor-fold> |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Define the core functionality of the plugin. |
|
| 733 | + * |
|
| 734 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | + * the public-facing side of the site. |
|
| 737 | + * |
|
| 738 | + * @since 1.0.0 |
|
| 739 | + */ |
|
| 740 | + public function __construct() { |
|
| 741 | + |
|
| 742 | + self::$instance = $this; |
|
| 743 | + |
|
| 744 | + $this->plugin_name = 'wordlift'; |
|
| 745 | + $this->version = '3.21.1'; |
|
| 746 | + $this->load_dependencies(); |
|
| 747 | + $this->set_locale(); |
|
| 748 | + $this->define_admin_hooks(); |
|
| 749 | + $this->define_public_hooks(); |
|
| 750 | + |
|
| 751 | + // If we're in `WP_CLI` load the related files. |
|
| 752 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | + $this->load_cli_dependencies(); |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + /** |
|
| 759 | + * Get the singleton instance. |
|
| 760 | + * |
|
| 761 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 762 | + * @since 3.11.2 |
|
| 763 | + * |
|
| 764 | + */ |
|
| 765 | + public static function get_instance() { |
|
| 766 | + |
|
| 767 | + return self::$instance; |
|
| 768 | + } |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * Load the required dependencies for this plugin. |
|
| 772 | + * |
|
| 773 | + * Include the following files that make up the plugin: |
|
| 774 | + * |
|
| 775 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | + * |
|
| 780 | + * Create an instance of the loader which will be used to register the hooks |
|
| 781 | + * with WordPress. |
|
| 782 | + * |
|
| 783 | + * @since 1.0.0 |
|
| 784 | + * @access private |
|
| 785 | + */ |
|
| 786 | + private function load_dependencies() { |
|
| 787 | + |
|
| 788 | + /** |
|
| 789 | + * The class responsible for orchestrating the actions and filters of the |
|
| 790 | + * core plugin. |
|
| 791 | + */ |
|
| 792 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | + |
|
| 794 | + // The class responsible for plugin uninstall. |
|
| 795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * The class responsible for defining internationalization functionality |
|
| 799 | + * of the plugin. |
|
| 800 | + */ |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * WordLift's supported languages. |
|
| 805 | + */ |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * WordLift's supported countries. |
|
| 810 | + */ |
|
| 811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * Provide support functions to sanitize data. |
|
| 815 | + */ |
|
| 816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | + |
|
| 818 | + /** Services. */ |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * The Query builder. |
|
| 832 | + */ |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | + |
|
| 835 | + /** |
|
| 836 | + * The Schema service. |
|
| 837 | + */ |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | + |
|
| 840 | + /** |
|
| 841 | + * The schema:url property service. |
|
| 842 | + */ |
|
| 843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The UI service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * The Thumbnail service. |
|
| 853 | + */ |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | + |
|
| 856 | + /** |
|
| 857 | + * The Entity Types Taxonomy service. |
|
| 858 | + */ |
|
| 859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | + |
|
| 861 | + /** |
|
| 862 | + * The Entity service. |
|
| 863 | + */ |
|
| 864 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | + |
|
| 867 | + // Add the entity rating service. |
|
| 868 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | + |
|
| 870 | + /** |
|
| 871 | + * The User service. |
|
| 872 | + */ |
|
| 873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * The Timeline service. |
|
| 877 | + */ |
|
| 878 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | + |
|
| 880 | + /** |
|
| 881 | + * The Topic Taxonomy service. |
|
| 882 | + */ |
|
| 883 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | + |
|
| 885 | + /** |
|
| 886 | + * The SPARQL service. |
|
| 887 | + */ |
|
| 888 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * The WordLift import service. |
|
| 892 | + */ |
|
| 893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | + |
|
| 895 | + /** |
|
| 896 | + * The WordLift URI service. |
|
| 897 | + */ |
|
| 898 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | + |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | + |
|
| 914 | + /** |
|
| 915 | + * Load the converters. |
|
| 916 | + */ |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | + |
|
| 924 | + /** |
|
| 925 | + * Load cache-related files. |
|
| 926 | + */ |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | + |
|
| 929 | + /** |
|
| 930 | + * Load the content filter. |
|
| 931 | + */ |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | + |
|
| 934 | + /* |
|
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | - |
|
| 939 | - /** |
|
| 940 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | - * |
|
| 942 | - * @since 3.8.0 |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | - |
|
| 946 | - // The Publisher Service and the AJAX adapter. |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | - |
|
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * Load the WordLift key validation service. |
|
| 954 | - */ |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | - |
|
| 957 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | - |
|
| 960 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | - |
|
| 965 | - /** Linked Data. */ |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | - |
|
| 978 | - /** Linked Data Rendition. */ |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | - |
|
| 984 | - /** Services. */ |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | - |
|
| 989 | - /** Adapters. */ |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | - |
|
| 997 | - /** Async Tasks. */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | - |
|
| 1004 | - /** Autocomplete. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | - |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | - |
|
| 1010 | - /** Analytics */ |
|
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | - |
|
| 1013 | - /** |
|
| 1014 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | - */ |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * The class to customize the entity list admin page. |
|
| 1020 | - */ |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | - |
|
| 1023 | - /** |
|
| 1024 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | - */ |
|
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | - |
|
| 1028 | - /** |
|
| 1029 | - * The Notice service. |
|
| 1030 | - */ |
|
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | - |
|
| 1033 | - /** |
|
| 1034 | - * The PrimaShop adapter. |
|
| 1035 | - */ |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | - |
|
| 1038 | - /** |
|
| 1039 | - * The WordLift Dashboard service. |
|
| 1040 | - */ |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | - |
|
| 1043 | - /** |
|
| 1044 | - * The admin 'Install wizard' page. |
|
| 1045 | - */ |
|
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | - |
|
| 1048 | - /** |
|
| 1049 | - * The WordLift entity type list admin page controller. |
|
| 1050 | - */ |
|
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | - |
|
| 1053 | - /** |
|
| 1054 | - * The WordLift entity type settings admin page controller. |
|
| 1055 | - */ |
|
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * The admin 'Download Your Data' page. |
|
| 1060 | - */ |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | - |
|
| 1063 | - /** |
|
| 1064 | - * The admin 'WordLift Settings' page. |
|
| 1065 | - */ |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | - |
|
| 1083 | - /** Admin Pages */ |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | - |
|
| 1089 | - /** |
|
| 1090 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1091 | - * side of the site. |
|
| 1092 | - */ |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | - |
|
| 1095 | - /** |
|
| 1096 | - * The shortcode abstract class. |
|
| 1097 | - */ |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | - |
|
| 1100 | - /** |
|
| 1101 | - * The Timeline shortcode. |
|
| 1102 | - */ |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | - |
|
| 1105 | - /** |
|
| 1106 | - * The Navigator shortcode. |
|
| 1107 | - */ |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * The chord shortcode. |
|
| 1112 | - */ |
|
| 1113 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | - |
|
| 1115 | - /** |
|
| 1116 | - * The geomap shortcode. |
|
| 1117 | - */ |
|
| 1118 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | - |
|
| 1120 | - /** |
|
| 1121 | - * The entity cloud shortcode. |
|
| 1122 | - */ |
|
| 1123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | - |
|
| 1125 | - /** |
|
| 1126 | - * The entity glossary shortcode. |
|
| 1127 | - */ |
|
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | - |
|
| 1131 | - /** |
|
| 1132 | - * Faceted Search shortcode. |
|
| 1133 | - */ |
|
| 1134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | - |
|
| 1136 | - /** |
|
| 1137 | - * The ShareThis service. |
|
| 1138 | - */ |
|
| 1139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | - |
|
| 1141 | - /** |
|
| 1142 | - * The SEO service. |
|
| 1143 | - */ |
|
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | - |
|
| 1146 | - /** |
|
| 1147 | - * The AMP service. |
|
| 1148 | - */ |
|
| 1149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | - |
|
| 1151 | - /** Widgets */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | - |
|
| 1155 | - /* |
|
| 937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | + |
|
| 939 | + /** |
|
| 940 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | + * |
|
| 942 | + * @since 3.8.0 |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | + |
|
| 946 | + // The Publisher Service and the AJAX adapter. |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | + |
|
| 950 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * Load the WordLift key validation service. |
|
| 954 | + */ |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | + |
|
| 957 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | + |
|
| 960 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | + |
|
| 965 | + /** Linked Data. */ |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | + |
|
| 978 | + /** Linked Data Rendition. */ |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | + |
|
| 984 | + /** Services. */ |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | + |
|
| 989 | + /** Adapters. */ |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | + |
|
| 997 | + /** Async Tasks. */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | + |
|
| 1004 | + /** Autocomplete. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | + |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | + |
|
| 1010 | + /** Analytics */ |
|
| 1011 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | + |
|
| 1013 | + /** |
|
| 1014 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | + */ |
|
| 1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * The class to customize the entity list admin page. |
|
| 1020 | + */ |
|
| 1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | + |
|
| 1023 | + /** |
|
| 1024 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | + */ |
|
| 1026 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | + |
|
| 1028 | + /** |
|
| 1029 | + * The Notice service. |
|
| 1030 | + */ |
|
| 1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * The PrimaShop adapter. |
|
| 1035 | + */ |
|
| 1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | + |
|
| 1038 | + /** |
|
| 1039 | + * The WordLift Dashboard service. |
|
| 1040 | + */ |
|
| 1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | + |
|
| 1043 | + /** |
|
| 1044 | + * The admin 'Install wizard' page. |
|
| 1045 | + */ |
|
| 1046 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | + |
|
| 1048 | + /** |
|
| 1049 | + * The WordLift entity type list admin page controller. |
|
| 1050 | + */ |
|
| 1051 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | + |
|
| 1053 | + /** |
|
| 1054 | + * The WordLift entity type settings admin page controller. |
|
| 1055 | + */ |
|
| 1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * The admin 'Download Your Data' page. |
|
| 1060 | + */ |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | + |
|
| 1063 | + /** |
|
| 1064 | + * The admin 'WordLift Settings' page. |
|
| 1065 | + */ |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | + |
|
| 1083 | + /** Admin Pages */ |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | + |
|
| 1089 | + /** |
|
| 1090 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1091 | + * side of the site. |
|
| 1092 | + */ |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | + |
|
| 1095 | + /** |
|
| 1096 | + * The shortcode abstract class. |
|
| 1097 | + */ |
|
| 1098 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | + |
|
| 1100 | + /** |
|
| 1101 | + * The Timeline shortcode. |
|
| 1102 | + */ |
|
| 1103 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | + |
|
| 1105 | + /** |
|
| 1106 | + * The Navigator shortcode. |
|
| 1107 | + */ |
|
| 1108 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * The chord shortcode. |
|
| 1112 | + */ |
|
| 1113 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | + |
|
| 1115 | + /** |
|
| 1116 | + * The geomap shortcode. |
|
| 1117 | + */ |
|
| 1118 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | + |
|
| 1120 | + /** |
|
| 1121 | + * The entity cloud shortcode. |
|
| 1122 | + */ |
|
| 1123 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | + |
|
| 1125 | + /** |
|
| 1126 | + * The entity glossary shortcode. |
|
| 1127 | + */ |
|
| 1128 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | + |
|
| 1131 | + /** |
|
| 1132 | + * Faceted Search shortcode. |
|
| 1133 | + */ |
|
| 1134 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | + |
|
| 1136 | + /** |
|
| 1137 | + * The ShareThis service. |
|
| 1138 | + */ |
|
| 1139 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | + |
|
| 1141 | + /** |
|
| 1142 | + * The SEO service. |
|
| 1143 | + */ |
|
| 1144 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | + |
|
| 1146 | + /** |
|
| 1147 | + * The AMP service. |
|
| 1148 | + */ |
|
| 1149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | + |
|
| 1151 | + /** Widgets */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | + |
|
| 1155 | + /* |
|
| 1156 | 1156 | * Schema.org Services. |
| 1157 | 1157 | * |
| 1158 | 1158 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1159 | 1159 | */ |
| 1160 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1161 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1164 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1165 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1166 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1167 | - } else { |
|
| 1168 | - $schemaorg_property_service = null; |
|
| 1169 | - } |
|
| 1160 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1161 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1164 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1165 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1166 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1167 | + } else { |
|
| 1168 | + $schemaorg_property_service = null; |
|
| 1169 | + } |
|
| 1170 | 1170 | |
| 1171 | - $this->loader = new Wordlift_Loader(); |
|
| 1171 | + $this->loader = new Wordlift_Loader(); |
|
| 1172 | 1172 | |
| 1173 | - // Instantiate a global logger. |
|
| 1174 | - global $wl_logger; |
|
| 1175 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1173 | + // Instantiate a global logger. |
|
| 1174 | + global $wl_logger; |
|
| 1175 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1176 | 1176 | |
| 1177 | - // Load the `wl-api` end-point. |
|
| 1178 | - new Wordlift_Http_Api(); |
|
| 1177 | + // Load the `wl-api` end-point. |
|
| 1178 | + new Wordlift_Http_Api(); |
|
| 1179 | 1179 | |
| 1180 | - // Load the Install Service. |
|
| 1181 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1180 | + // Load the Install Service. |
|
| 1181 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1182 | 1182 | |
| 1183 | - /** Services. */ |
|
| 1184 | - // Create the configuration service. |
|
| 1185 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1186 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1183 | + /** Services. */ |
|
| 1184 | + // Create the configuration service. |
|
| 1185 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1186 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1187 | 1187 | |
| 1188 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1189 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1188 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1189 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1190 | 1190 | |
| 1191 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1192 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1191 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1192 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1193 | 1193 | |
| 1194 | - // Create an instance of the UI service. |
|
| 1195 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1194 | + // Create an instance of the UI service. |
|
| 1195 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1196 | 1196 | |
| 1197 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1198 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1197 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1198 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1199 | 1199 | |
| 1200 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1201 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1202 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1203 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1200 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1201 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1202 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1203 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1204 | 1204 | |
| 1205 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1206 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1207 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1208 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1209 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1205 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1206 | + $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1207 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1208 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1209 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1210 | 1210 | |
| 1211 | - // Instantiate the JSON-LD service. |
|
| 1212 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1211 | + // Instantiate the JSON-LD service. |
|
| 1212 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1213 | 1213 | |
| 1214 | - /** Linked Data. */ |
|
| 1215 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1216 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1214 | + /** Linked Data. */ |
|
| 1215 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1216 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1217 | 1217 | |
| 1218 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1218 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1219 | 1219 | |
| 1220 | - // Create a new instance of the Redirect service. |
|
| 1221 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1222 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1223 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1220 | + // Create a new instance of the Redirect service. |
|
| 1221 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1222 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1223 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1224 | 1224 | |
| 1225 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1226 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1225 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1226 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1227 | 1227 | |
| 1228 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1228 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1229 | 1229 | |
| 1230 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1230 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1231 | 1231 | |
| 1232 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1233 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1232 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1233 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1234 | 1234 | |
| 1235 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1236 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1235 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1236 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1237 | 1237 | |
| 1238 | - // Create an instance of the PrimaShop adapter. |
|
| 1239 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1238 | + // Create an instance of the PrimaShop adapter. |
|
| 1239 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1240 | 1240 | |
| 1241 | - // Create an import service instance to hook later to WP's import function. |
|
| 1242 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1241 | + // Create an import service instance to hook later to WP's import function. |
|
| 1242 | + $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1243 | 1243 | |
| 1244 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1244 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1245 | 1245 | |
| 1246 | - // Create the entity rating service. |
|
| 1247 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1246 | + // Create the entity rating service. |
|
| 1247 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1248 | 1248 | |
| 1249 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1250 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1249 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1250 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1251 | 1251 | |
| 1252 | - // Create a new instance of the Redirect service. |
|
| 1253 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1252 | + // Create a new instance of the Redirect service. |
|
| 1253 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1254 | 1254 | |
| 1255 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1256 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1257 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1258 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1255 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1256 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1257 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1258 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1259 | 1259 | |
| 1260 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1260 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1261 | 1261 | |
| 1262 | - // Instantiate the JSON-LD service. |
|
| 1263 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1264 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1265 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1266 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1267 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1268 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1269 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1262 | + // Instantiate the JSON-LD service. |
|
| 1263 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1264 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1265 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1266 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1267 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1268 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1269 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1270 | 1270 | |
| 1271 | 1271 | |
| 1272 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1273 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1274 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1275 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1276 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1277 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1272 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1273 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1274 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1275 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1276 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1277 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1278 | 1278 | |
| 1279 | - // Initialize the shortcodes. |
|
| 1280 | - new Wordlift_Navigator_Shortcode(); |
|
| 1281 | - new Wordlift_Chord_Shortcode(); |
|
| 1282 | - new Wordlift_Geomap_Shortcode(); |
|
| 1283 | - new Wordlift_Timeline_Shortcode(); |
|
| 1284 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1285 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1286 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1279 | + // Initialize the shortcodes. |
|
| 1280 | + new Wordlift_Navigator_Shortcode(); |
|
| 1281 | + new Wordlift_Chord_Shortcode(); |
|
| 1282 | + new Wordlift_Geomap_Shortcode(); |
|
| 1283 | + new Wordlift_Timeline_Shortcode(); |
|
| 1284 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1285 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1286 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1287 | 1287 | |
| 1288 | - // Initialize the SEO service. |
|
| 1289 | - new Wordlift_Seo_Service(); |
|
| 1288 | + // Initialize the SEO service. |
|
| 1289 | + new Wordlift_Seo_Service(); |
|
| 1290 | 1290 | |
| 1291 | - // Initialize the AMP service. |
|
| 1292 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1291 | + // Initialize the AMP service. |
|
| 1292 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1293 | 1293 | |
| 1294 | - /** Services. */ |
|
| 1295 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1296 | - new Wordlift_Image_Service(); |
|
| 1294 | + /** Services. */ |
|
| 1295 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1296 | + new Wordlift_Image_Service(); |
|
| 1297 | 1297 | |
| 1298 | - /** Adapters. */ |
|
| 1299 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1300 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1301 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1302 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1303 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1298 | + /** Adapters. */ |
|
| 1299 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1300 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1301 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1302 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1303 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1304 | 1304 | |
| 1305 | - /* |
|
| 1305 | + /* |
|
| 1306 | 1306 | * Exclude our public js from WP-Rocket. |
| 1307 | 1307 | * |
| 1308 | 1308 | * @since 3.19.4 |
| 1309 | 1309 | * |
| 1310 | 1310 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1311 | 1311 | */ |
| 1312 | - new Wordlift_WpRocket_Adapter(); |
|
| 1313 | - |
|
| 1314 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1315 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1316 | - $this->sparql_service, |
|
| 1317 | - $uri_service |
|
| 1318 | - ); |
|
| 1319 | - |
|
| 1320 | - /** Async Tasks. */ |
|
| 1321 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1322 | - new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1323 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1324 | - new Wordlift_Push_References_Async_Task(); |
|
| 1325 | - |
|
| 1326 | - /** WL Autocomplete. */ |
|
| 1327 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1328 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1329 | - |
|
| 1330 | - /** WordPress Admin UI. */ |
|
| 1331 | - |
|
| 1332 | - // UI elements. |
|
| 1333 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1334 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1335 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1336 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1337 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1338 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1339 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1340 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1341 | - |
|
| 1342 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1343 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1344 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1345 | - |
|
| 1346 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1347 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1348 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1349 | - |
|
| 1350 | - // Pages. |
|
| 1351 | - /* |
|
| 1312 | + new Wordlift_WpRocket_Adapter(); |
|
| 1313 | + |
|
| 1314 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1315 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1316 | + $this->sparql_service, |
|
| 1317 | + $uri_service |
|
| 1318 | + ); |
|
| 1319 | + |
|
| 1320 | + /** Async Tasks. */ |
|
| 1321 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1322 | + new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1323 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1324 | + new Wordlift_Push_References_Async_Task(); |
|
| 1325 | + |
|
| 1326 | + /** WL Autocomplete. */ |
|
| 1327 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1328 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1329 | + |
|
| 1330 | + /** WordPress Admin UI. */ |
|
| 1331 | + |
|
| 1332 | + // UI elements. |
|
| 1333 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1334 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1335 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1336 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1337 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1338 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1339 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1340 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1341 | + |
|
| 1342 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1343 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1344 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1345 | + |
|
| 1346 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1347 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1348 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1349 | + |
|
| 1350 | + // Pages. |
|
| 1351 | + /* |
|
| 1352 | 1352 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1353 | 1353 | * |
| 1354 | 1354 | * @since 3.20.3 |
| 1355 | 1355 | * |
| 1356 | 1356 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1357 | 1357 | */ |
| 1358 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1359 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1361 | - } |
|
| 1362 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1358 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1359 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1361 | + } |
|
| 1362 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1363 | 1363 | |
| 1364 | - // create an instance of the entity type list admin page controller. |
|
| 1365 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1364 | + // create an instance of the entity type list admin page controller. |
|
| 1365 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1366 | 1366 | |
| 1367 | - // create an instance of the entity type setting admin page controller. |
|
| 1368 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1367 | + // create an instance of the entity type setting admin page controller. |
|
| 1368 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1369 | 1369 | |
| 1370 | - /** Widgets */ |
|
| 1371 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1370 | + /** Widgets */ |
|
| 1371 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1372 | 1372 | |
| 1373 | - /* WordPress Admin. */ |
|
| 1374 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1375 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1373 | + /* WordPress Admin. */ |
|
| 1374 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1375 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1376 | 1376 | |
| 1377 | - // Create an instance of the install wizard. |
|
| 1378 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1377 | + // Create an instance of the install wizard. |
|
| 1378 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1379 | 1379 | |
| 1380 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1380 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1381 | 1381 | |
| 1382 | - // User Profile. |
|
| 1383 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1382 | + // User Profile. |
|
| 1383 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1384 | 1384 | |
| 1385 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1385 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1386 | 1386 | |
| 1387 | - // Load the debug service if WP is in debug mode. |
|
| 1388 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1389 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1390 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1391 | - } |
|
| 1387 | + // Load the debug service if WP is in debug mode. |
|
| 1388 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1389 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1390 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1391 | + } |
|
| 1392 | 1392 | |
| 1393 | - // Remote Image Service. |
|
| 1394 | - new Wordlift_Remote_Image_Service(); |
|
| 1393 | + // Remote Image Service. |
|
| 1394 | + new Wordlift_Remote_Image_Service(); |
|
| 1395 | 1395 | |
| 1396 | - /* |
|
| 1396 | + /* |
|
| 1397 | 1397 | * Provides mappings between post types and entity types. |
| 1398 | 1398 | * |
| 1399 | 1399 | * @since 3.20.0 |
| 1400 | 1400 | * |
| 1401 | 1401 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1402 | 1402 | */ |
| 1403 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1403 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1404 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1406 | 1406 | |
| 1407 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1408 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1407 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1408 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1409 | 1409 | |
| 1410 | - /* |
|
| 1410 | + /* |
|
| 1411 | 1411 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1412 | 1412 | * |
| 1413 | 1413 | * Eventually Batch Actions will become Batch Operations. |
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 3.20.0 |
| 1416 | 1416 | */ |
| 1417 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1417 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1419 | 1419 | |
| 1420 | - /* |
|
| 1420 | + /* |
|
| 1421 | 1421 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1422 | 1422 | * |
| 1423 | 1423 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1424 | 1424 | * |
| 1425 | 1425 | * @since 3.20.0 |
| 1426 | 1426 | */ |
| 1427 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1427 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1429 | 1429 | |
| 1430 | - /* |
|
| 1430 | + /* |
|
| 1431 | 1431 | * Load dependencies for the front-end. |
| 1432 | 1432 | * |
| 1433 | 1433 | * @since 3.20.0 |
| 1434 | 1434 | */ |
| 1435 | - if ( ! is_admin() ) { |
|
| 1436 | - /* |
|
| 1435 | + if ( ! is_admin() ) { |
|
| 1436 | + /* |
|
| 1437 | 1437 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1438 | 1438 | * |
| 1439 | 1439 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1440 | 1440 | * |
| 1441 | 1441 | * @since 3.20.0 |
| 1442 | 1442 | */ |
| 1443 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1445 | - } |
|
| 1446 | - |
|
| 1447 | - } |
|
| 1448 | - |
|
| 1449 | - /** |
|
| 1450 | - * Define the locale for this plugin for internationalization. |
|
| 1451 | - * |
|
| 1452 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1453 | - * with WordPress. |
|
| 1454 | - * |
|
| 1455 | - * @since 1.0.0 |
|
| 1456 | - * @access private |
|
| 1457 | - */ |
|
| 1458 | - private function set_locale() { |
|
| 1459 | - |
|
| 1460 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1461 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1462 | - |
|
| 1463 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1464 | - |
|
| 1465 | - } |
|
| 1466 | - |
|
| 1467 | - /** |
|
| 1468 | - * Register all of the hooks related to the admin area functionality |
|
| 1469 | - * of the plugin. |
|
| 1470 | - * |
|
| 1471 | - * @since 1.0.0 |
|
| 1472 | - * @access private |
|
| 1473 | - */ |
|
| 1474 | - private function define_admin_hooks() { |
|
| 1475 | - |
|
| 1476 | - $plugin_admin = new Wordlift_Admin( |
|
| 1477 | - $this->get_plugin_name(), |
|
| 1478 | - $this->get_version(), |
|
| 1479 | - $this->configuration_service, |
|
| 1480 | - $this->notice_service, |
|
| 1481 | - $this->user_service |
|
| 1482 | - ); |
|
| 1483 | - |
|
| 1484 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1486 | - |
|
| 1487 | - // Hook the init action to taxonomy services. |
|
| 1488 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1489 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1490 | - |
|
| 1491 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1492 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1493 | - |
|
| 1494 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1495 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1496 | - |
|
| 1497 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1498 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1499 | - |
|
| 1500 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1501 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1502 | - |
|
| 1503 | - // Register custom allowed redirect hosts. |
|
| 1504 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1505 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1506 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1507 | - |
|
| 1508 | - /* |
|
| 1443 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | + new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1445 | + } |
|
| 1446 | + |
|
| 1447 | + } |
|
| 1448 | + |
|
| 1449 | + /** |
|
| 1450 | + * Define the locale for this plugin for internationalization. |
|
| 1451 | + * |
|
| 1452 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1453 | + * with WordPress. |
|
| 1454 | + * |
|
| 1455 | + * @since 1.0.0 |
|
| 1456 | + * @access private |
|
| 1457 | + */ |
|
| 1458 | + private function set_locale() { |
|
| 1459 | + |
|
| 1460 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1461 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1462 | + |
|
| 1463 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1464 | + |
|
| 1465 | + } |
|
| 1466 | + |
|
| 1467 | + /** |
|
| 1468 | + * Register all of the hooks related to the admin area functionality |
|
| 1469 | + * of the plugin. |
|
| 1470 | + * |
|
| 1471 | + * @since 1.0.0 |
|
| 1472 | + * @access private |
|
| 1473 | + */ |
|
| 1474 | + private function define_admin_hooks() { |
|
| 1475 | + |
|
| 1476 | + $plugin_admin = new Wordlift_Admin( |
|
| 1477 | + $this->get_plugin_name(), |
|
| 1478 | + $this->get_version(), |
|
| 1479 | + $this->configuration_service, |
|
| 1480 | + $this->notice_service, |
|
| 1481 | + $this->user_service |
|
| 1482 | + ); |
|
| 1483 | + |
|
| 1484 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1486 | + |
|
| 1487 | + // Hook the init action to taxonomy services. |
|
| 1488 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1489 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1490 | + |
|
| 1491 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1492 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1493 | + |
|
| 1494 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1495 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1496 | + |
|
| 1497 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1498 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1499 | + |
|
| 1500 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1501 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1502 | + |
|
| 1503 | + // Register custom allowed redirect hosts. |
|
| 1504 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1505 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1506 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1507 | + |
|
| 1508 | + /* |
|
| 1509 | 1509 | * The old dashboard is replaced with dashboard v2. |
| 1510 | 1510 | * |
| 1511 | 1511 | * The old dashboard service is still loaded because its functions are used. |
@@ -1514,299 +1514,299 @@ discard block |
||
| 1514 | 1514 | * |
| 1515 | 1515 | * @since 3.20.0 |
| 1516 | 1516 | */ |
| 1517 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1518 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1519 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1520 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1521 | - |
|
| 1522 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1523 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1524 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1525 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1526 | - |
|
| 1527 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1528 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1529 | - |
|
| 1530 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1531 | - // Add custom columns. |
|
| 1532 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1533 | - // no explicit entity as it prevents handling of other post types. |
|
| 1534 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1535 | - // Add 4W selection. |
|
| 1536 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1537 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1538 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1539 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1540 | - |
|
| 1541 | - /* |
|
| 1517 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1518 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1519 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1520 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1521 | + |
|
| 1522 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1523 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1524 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1525 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1526 | + |
|
| 1527 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1528 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1529 | + |
|
| 1530 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1531 | + // Add custom columns. |
|
| 1532 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1533 | + // no explicit entity as it prevents handling of other post types. |
|
| 1534 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1535 | + // Add 4W selection. |
|
| 1536 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1537 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1538 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1539 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1540 | + |
|
| 1541 | + /* |
|
| 1542 | 1542 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1543 | 1543 | * |
| 1544 | 1544 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1545 | 1545 | */ |
| 1546 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1547 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1548 | - } |
|
| 1546 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1547 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1548 | + } |
|
| 1549 | 1549 | |
| 1550 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1551 | - // entities. |
|
| 1552 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1550 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1551 | + // entities. |
|
| 1552 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1553 | 1553 | |
| 1554 | - // Filter imported post meta. |
|
| 1555 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1554 | + // Filter imported post meta. |
|
| 1555 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1556 | 1556 | |
| 1557 | - // Notify the import service when an import starts and ends. |
|
| 1558 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1559 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1557 | + // Notify the import service when an import starts and ends. |
|
| 1558 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1559 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1560 | 1560 | |
| 1561 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1562 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1563 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1561 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1562 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1563 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1564 | 1564 | |
| 1565 | - // Hook the menu to the Download Your Data page. |
|
| 1566 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1567 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1568 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1565 | + // Hook the menu to the Download Your Data page. |
|
| 1566 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1567 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1568 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1569 | 1569 | |
| 1570 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1571 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1570 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1571 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1572 | 1572 | |
| 1573 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1574 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1575 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1576 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1573 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1574 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1575 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1576 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1577 | 1577 | |
| 1578 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1579 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1578 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1579 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1580 | 1580 | |
| 1581 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1582 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1581 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1582 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1583 | 1583 | |
| 1584 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1585 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1584 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1585 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1586 | 1586 | |
| 1587 | - // Hook the admin_init to the settings page. |
|
| 1588 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1589 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1587 | + // Hook the admin_init to the settings page. |
|
| 1588 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1589 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1590 | 1590 | |
| 1591 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1591 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1592 | 1592 | |
| 1593 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1594 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1595 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1596 | - // Add the functionality only if a flag is set in wp-config.php . |
|
| 1597 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1598 | - } |
|
| 1593 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1594 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1595 | + if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1596 | + // Add the functionality only if a flag is set in wp-config.php . |
|
| 1597 | + $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1598 | + } |
|
| 1599 | 1599 | |
| 1600 | - /* |
|
| 1600 | + /* |
|
| 1601 | 1601 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1602 | 1602 | * |
| 1603 | 1603 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1604 | 1604 | * |
| 1605 | 1605 | * @since 3.20.0 |
| 1606 | 1606 | */ |
| 1607 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1608 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1609 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1610 | - } |
|
| 1607 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1608 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1609 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1610 | + } |
|
| 1611 | 1611 | |
| 1612 | - // Hook key update. |
|
| 1613 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1614 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1612 | + // Hook key update. |
|
| 1613 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1614 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1615 | 1615 | |
| 1616 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1617 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1616 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1617 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1618 | 1618 | |
| 1619 | - /* |
|
| 1619 | + /* |
|
| 1620 | 1620 | * Remove the Analytics Settings link from the plugin page. |
| 1621 | 1621 | * |
| 1622 | 1622 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1623 | 1623 | * @since 3.21.1 |
| 1624 | 1624 | */ |
| 1625 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1626 | - |
|
| 1627 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1628 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1629 | - |
|
| 1630 | - // Hook row actions for the entity type list admin. |
|
| 1631 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1632 | - |
|
| 1633 | - /** Ajax actions. */ |
|
| 1634 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1635 | - |
|
| 1636 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1637 | - // page on WordPress versions before 4.7. |
|
| 1638 | - global $wp_version; |
|
| 1639 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1640 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1641 | - } |
|
| 1642 | - |
|
| 1643 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1644 | - |
|
| 1645 | - /** Adapters. */ |
|
| 1646 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1647 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1648 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1649 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1650 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1651 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1652 | - |
|
| 1653 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1654 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1655 | - |
|
| 1656 | - |
|
| 1657 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1658 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1659 | - |
|
| 1660 | - // Handle the autocomplete request. |
|
| 1661 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1662 | - $this->autocomplete_adapter, |
|
| 1663 | - 'wl_autocomplete', |
|
| 1664 | - ) ); |
|
| 1665 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1666 | - $this->autocomplete_adapter, |
|
| 1667 | - 'wl_autocomplete', |
|
| 1668 | - ) ); |
|
| 1669 | - |
|
| 1670 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1671 | - if ( is_multisite() ) { |
|
| 1672 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1673 | - } |
|
| 1674 | - |
|
| 1675 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1676 | - |
|
| 1677 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1678 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1679 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1680 | - } |
|
| 1681 | - |
|
| 1682 | - /** |
|
| 1683 | - * Register all of the hooks related to the public-facing functionality |
|
| 1684 | - * of the plugin. |
|
| 1685 | - * |
|
| 1686 | - * @since 1.0.0 |
|
| 1687 | - * @access private |
|
| 1688 | - */ |
|
| 1689 | - private function define_public_hooks() { |
|
| 1690 | - |
|
| 1691 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1692 | - |
|
| 1693 | - // Register the entity post type. |
|
| 1694 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1695 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1696 | - |
|
| 1697 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1698 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1699 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1700 | - $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 ); |
|
| 1701 | - $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 ); |
|
| 1702 | - |
|
| 1703 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1704 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1705 | - |
|
| 1706 | - // Hook the content filter service to add entity links. |
|
| 1707 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1708 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1709 | - } |
|
| 1710 | - |
|
| 1711 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1712 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1713 | - |
|
| 1714 | - // Hook the ShareThis service. |
|
| 1715 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1716 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1717 | - |
|
| 1718 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1719 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1720 | - |
|
| 1721 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1722 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1723 | - // to categories. |
|
| 1724 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1725 | - |
|
| 1726 | - /* |
|
| 1625 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1626 | + |
|
| 1627 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1628 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1629 | + |
|
| 1630 | + // Hook row actions for the entity type list admin. |
|
| 1631 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1632 | + |
|
| 1633 | + /** Ajax actions. */ |
|
| 1634 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1635 | + |
|
| 1636 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1637 | + // page on WordPress versions before 4.7. |
|
| 1638 | + global $wp_version; |
|
| 1639 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1640 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1641 | + } |
|
| 1642 | + |
|
| 1643 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1644 | + |
|
| 1645 | + /** Adapters. */ |
|
| 1646 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1647 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1648 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1649 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1650 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1651 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1652 | + |
|
| 1653 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1654 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1655 | + |
|
| 1656 | + |
|
| 1657 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1658 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1659 | + |
|
| 1660 | + // Handle the autocomplete request. |
|
| 1661 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1662 | + $this->autocomplete_adapter, |
|
| 1663 | + 'wl_autocomplete', |
|
| 1664 | + ) ); |
|
| 1665 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1666 | + $this->autocomplete_adapter, |
|
| 1667 | + 'wl_autocomplete', |
|
| 1668 | + ) ); |
|
| 1669 | + |
|
| 1670 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1671 | + if ( is_multisite() ) { |
|
| 1672 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1673 | + } |
|
| 1674 | + |
|
| 1675 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1676 | + |
|
| 1677 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1678 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1679 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1680 | + } |
|
| 1681 | + |
|
| 1682 | + /** |
|
| 1683 | + * Register all of the hooks related to the public-facing functionality |
|
| 1684 | + * of the plugin. |
|
| 1685 | + * |
|
| 1686 | + * @since 1.0.0 |
|
| 1687 | + * @access private |
|
| 1688 | + */ |
|
| 1689 | + private function define_public_hooks() { |
|
| 1690 | + |
|
| 1691 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1692 | + |
|
| 1693 | + // Register the entity post type. |
|
| 1694 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1695 | + $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1696 | + |
|
| 1697 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1698 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1699 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1700 | + $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 ); |
|
| 1701 | + $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 ); |
|
| 1702 | + |
|
| 1703 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1704 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1705 | + |
|
| 1706 | + // Hook the content filter service to add entity links. |
|
| 1707 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1708 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1709 | + } |
|
| 1710 | + |
|
| 1711 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1712 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1713 | + |
|
| 1714 | + // Hook the ShareThis service. |
|
| 1715 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1716 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1717 | + |
|
| 1718 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1719 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1720 | + |
|
| 1721 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1722 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1723 | + // to categories. |
|
| 1724 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1725 | + |
|
| 1726 | + /* |
|
| 1727 | 1727 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1728 | 1728 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1729 | 1729 | * order of start time. |
| 1730 | 1730 | */ |
| 1731 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1732 | - |
|
| 1733 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1734 | - |
|
| 1735 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1736 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1737 | - |
|
| 1738 | - // Analytics Script Frontend. |
|
| 1739 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1740 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1741 | - } |
|
| 1742 | - |
|
| 1743 | - } |
|
| 1744 | - |
|
| 1745 | - /** |
|
| 1746 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1747 | - * |
|
| 1748 | - * @since 1.0.0 |
|
| 1749 | - */ |
|
| 1750 | - public function run() { |
|
| 1751 | - $this->loader->run(); |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - /** |
|
| 1755 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1756 | - * WordPress and to define internationalization functionality. |
|
| 1757 | - * |
|
| 1758 | - * @return string The name of the plugin. |
|
| 1759 | - * @since 1.0.0 |
|
| 1760 | - */ |
|
| 1761 | - public function get_plugin_name() { |
|
| 1762 | - return $this->plugin_name; |
|
| 1763 | - } |
|
| 1764 | - |
|
| 1765 | - /** |
|
| 1766 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1767 | - * |
|
| 1768 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1769 | - * @since 1.0.0 |
|
| 1770 | - */ |
|
| 1771 | - public function get_loader() { |
|
| 1772 | - return $this->loader; |
|
| 1773 | - } |
|
| 1774 | - |
|
| 1775 | - /** |
|
| 1776 | - * Retrieve the version number of the plugin. |
|
| 1777 | - * |
|
| 1778 | - * @return string The version number of the plugin. |
|
| 1779 | - * @since 1.0.0 |
|
| 1780 | - */ |
|
| 1781 | - public function get_version() { |
|
| 1782 | - return $this->version; |
|
| 1783 | - } |
|
| 1784 | - |
|
| 1785 | - /** |
|
| 1786 | - * Load dependencies for WP-CLI. |
|
| 1787 | - * |
|
| 1788 | - * @throws Exception |
|
| 1789 | - * @since 3.18.0 |
|
| 1790 | - */ |
|
| 1791 | - private function load_cli_dependencies() { |
|
| 1792 | - |
|
| 1793 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1794 | - |
|
| 1795 | - $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 ); |
|
| 1796 | - |
|
| 1797 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1798 | - |
|
| 1799 | - } |
|
| 1800 | - |
|
| 1801 | - /** |
|
| 1802 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1803 | - * |
|
| 1804 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1805 | - * @since 3.20.0 |
|
| 1806 | - */ |
|
| 1807 | - public function get_dashboard_service() { |
|
| 1808 | - |
|
| 1809 | - return $this->dashboard_service; |
|
| 1810 | - } |
|
| 1731 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1732 | + |
|
| 1733 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1734 | + |
|
| 1735 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1736 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1737 | + |
|
| 1738 | + // Analytics Script Frontend. |
|
| 1739 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1740 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1741 | + } |
|
| 1742 | + |
|
| 1743 | + } |
|
| 1744 | + |
|
| 1745 | + /** |
|
| 1746 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1747 | + * |
|
| 1748 | + * @since 1.0.0 |
|
| 1749 | + */ |
|
| 1750 | + public function run() { |
|
| 1751 | + $this->loader->run(); |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + /** |
|
| 1755 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1756 | + * WordPress and to define internationalization functionality. |
|
| 1757 | + * |
|
| 1758 | + * @return string The name of the plugin. |
|
| 1759 | + * @since 1.0.0 |
|
| 1760 | + */ |
|
| 1761 | + public function get_plugin_name() { |
|
| 1762 | + return $this->plugin_name; |
|
| 1763 | + } |
|
| 1764 | + |
|
| 1765 | + /** |
|
| 1766 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1767 | + * |
|
| 1768 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1769 | + * @since 1.0.0 |
|
| 1770 | + */ |
|
| 1771 | + public function get_loader() { |
|
| 1772 | + return $this->loader; |
|
| 1773 | + } |
|
| 1774 | + |
|
| 1775 | + /** |
|
| 1776 | + * Retrieve the version number of the plugin. |
|
| 1777 | + * |
|
| 1778 | + * @return string The version number of the plugin. |
|
| 1779 | + * @since 1.0.0 |
|
| 1780 | + */ |
|
| 1781 | + public function get_version() { |
|
| 1782 | + return $this->version; |
|
| 1783 | + } |
|
| 1784 | + |
|
| 1785 | + /** |
|
| 1786 | + * Load dependencies for WP-CLI. |
|
| 1787 | + * |
|
| 1788 | + * @throws Exception |
|
| 1789 | + * @since 3.18.0 |
|
| 1790 | + */ |
|
| 1791 | + private function load_cli_dependencies() { |
|
| 1792 | + |
|
| 1793 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1794 | + |
|
| 1795 | + $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 ); |
|
| 1796 | + |
|
| 1797 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1798 | + |
|
| 1799 | + } |
|
| 1800 | + |
|
| 1801 | + /** |
|
| 1802 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1803 | + * |
|
| 1804 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1805 | + * @since 3.20.0 |
|
| 1806 | + */ |
|
| 1807 | + public function get_dashboard_service() { |
|
| 1808 | + |
|
| 1809 | + return $this->dashboard_service; |
|
| 1810 | + } |
|
| 1811 | 1811 | |
| 1812 | 1812 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $this->define_public_hooks(); |
| 750 | 750 | |
| 751 | 751 | // If we're in `WP_CLI` load the related files. |
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 752 | + if (class_exists('WP_CLI')) { |
|
| 753 | 753 | $this->load_cli_dependencies(); |
| 754 | 754 | } |
| 755 | 755 | |
@@ -789,378 +789,378 @@ discard block |
||
| 789 | 789 | * The class responsible for orchestrating the actions and filters of the |
| 790 | 790 | * core plugin. |
| 791 | 791 | */ |
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 792 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 793 | 793 | |
| 794 | 794 | // The class responsible for plugin uninstall. |
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 795 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * The class responsible for defining internationalization functionality |
| 799 | 799 | * of the plugin. |
| 800 | 800 | */ |
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 801 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | 804 | * WordLift's supported languages. |
| 805 | 805 | */ |
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 806 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * WordLift's supported countries. |
| 810 | 810 | */ |
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 811 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 812 | 812 | |
| 813 | 813 | /** |
| 814 | 814 | * Provide support functions to sanitize data. |
| 815 | 815 | */ |
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 816 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 817 | 817 | |
| 818 | 818 | /** Services. */ |
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 819 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 829 | 829 | |
| 830 | 830 | /** |
| 831 | 831 | * The Query builder. |
| 832 | 832 | */ |
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 834 | 834 | |
| 835 | 835 | /** |
| 836 | 836 | * The Schema service. |
| 837 | 837 | */ |
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | 841 | * The schema:url property service. |
| 842 | 842 | */ |
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 843 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | 847 | * The UI service. |
| 848 | 848 | */ |
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 850 | 850 | |
| 851 | 851 | /** |
| 852 | 852 | * The Thumbnail service. |
| 853 | 853 | */ |
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | 857 | * The Entity Types Taxonomy service. |
| 858 | 858 | */ |
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 859 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * The Entity service. |
| 863 | 863 | */ |
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 864 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | // Add the entity rating service. |
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 868 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 869 | 869 | |
| 870 | 870 | /** |
| 871 | 871 | * The User service. |
| 872 | 872 | */ |
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 873 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | 876 | * The Timeline service. |
| 877 | 877 | */ |
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 878 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 879 | 879 | |
| 880 | 880 | /** |
| 881 | 881 | * The Topic Taxonomy service. |
| 882 | 882 | */ |
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 883 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | 884 | |
| 885 | 885 | /** |
| 886 | 886 | * The SPARQL service. |
| 887 | 887 | */ |
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 888 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 889 | 889 | |
| 890 | 890 | /** |
| 891 | 891 | * The WordLift import service. |
| 892 | 892 | */ |
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 893 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 894 | 894 | |
| 895 | 895 | /** |
| 896 | 896 | * The WordLift URI service. |
| 897 | 897 | */ |
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 898 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | 910 | |
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 913 | 913 | |
| 914 | 914 | /** |
| 915 | 915 | * Load the converters. |
| 916 | 916 | */ |
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | 923 | |
| 924 | 924 | /** |
| 925 | 925 | * Load cache-related files. |
| 926 | 926 | */ |
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 927 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 928 | 928 | |
| 929 | 929 | /** |
| 930 | 930 | * Load the content filter. |
| 931 | 931 | */ |
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | 933 | |
| 934 | 934 | /* |
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 937 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | 938 | |
| 939 | 939 | /** |
| 940 | 940 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 941 | 941 | * |
| 942 | 942 | * @since 3.8.0 |
| 943 | 943 | */ |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | 945 | |
| 946 | 946 | // The Publisher Service and the AJAX adapter. |
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | 949 | |
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 950 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 951 | 951 | |
| 952 | 952 | /** |
| 953 | 953 | * Load the WordLift key validation service. |
| 954 | 954 | */ |
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | 956 | |
| 957 | 957 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | 959 | |
| 960 | 960 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | 964 | |
| 965 | 965 | /** Linked Data. */ |
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 966 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | 977 | |
| 978 | 978 | /** Linked Data Rendition. */ |
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 979 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | 983 | |
| 984 | 984 | /** Services. */ |
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 988 | 988 | |
| 989 | 989 | /** Adapters. */ |
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** Async Tasks. */ |
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | 1003 | |
| 1004 | 1004 | /** Autocomplete. */ |
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | 1007 | |
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1008 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | 1009 | |
| 1010 | 1010 | /** Analytics */ |
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1011 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | 1012 | |
| 1013 | 1013 | /** |
| 1014 | 1014 | * The class responsible for defining all actions that occur in the admin area. |
| 1015 | 1015 | */ |
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1016 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1017 | 1017 | |
| 1018 | 1018 | /** |
| 1019 | 1019 | * The class to customize the entity list admin page. |
| 1020 | 1020 | */ |
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1021 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | 1022 | |
| 1023 | 1023 | /** |
| 1024 | 1024 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1025 | 1025 | */ |
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1026 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | 1027 | |
| 1028 | 1028 | /** |
| 1029 | 1029 | * The Notice service. |
| 1030 | 1030 | */ |
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1031 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1032 | 1032 | |
| 1033 | 1033 | /** |
| 1034 | 1034 | * The PrimaShop adapter. |
| 1035 | 1035 | */ |
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1036 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | 1039 | * The WordLift Dashboard service. |
| 1040 | 1040 | */ |
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1041 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | 1042 | |
| 1043 | 1043 | /** |
| 1044 | 1044 | * The admin 'Install wizard' page. |
| 1045 | 1045 | */ |
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1046 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | 1049 | * The WordLift entity type list admin page controller. |
| 1050 | 1050 | */ |
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1051 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | 1052 | |
| 1053 | 1053 | /** |
| 1054 | 1054 | * The WordLift entity type settings admin page controller. |
| 1055 | 1055 | */ |
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1056 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | 1057 | |
| 1058 | 1058 | /** |
| 1059 | 1059 | * The admin 'Download Your Data' page. |
| 1060 | 1060 | */ |
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1061 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | 1062 | |
| 1063 | 1063 | /** |
| 1064 | 1064 | * The admin 'WordLift Settings' page. |
| 1065 | 1065 | */ |
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1066 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | 1082 | |
| 1083 | 1083 | /** Admin Pages */ |
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1084 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | 1088 | |
| 1089 | 1089 | /** |
| 1090 | 1090 | * The class responsible for defining all actions that occur in the public-facing |
| 1091 | 1091 | * side of the site. |
| 1092 | 1092 | */ |
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1093 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1094 | 1094 | |
| 1095 | 1095 | /** |
| 1096 | 1096 | * The shortcode abstract class. |
| 1097 | 1097 | */ |
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1098 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1099 | 1099 | |
| 1100 | 1100 | /** |
| 1101 | 1101 | * The Timeline shortcode. |
| 1102 | 1102 | */ |
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1103 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | 1104 | |
| 1105 | 1105 | /** |
| 1106 | 1106 | * The Navigator shortcode. |
| 1107 | 1107 | */ |
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1108 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | 1109 | |
| 1110 | 1110 | /** |
| 1111 | 1111 | * The chord shortcode. |
| 1112 | 1112 | */ |
| 1113 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1113 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | 1114 | |
| 1115 | 1115 | /** |
| 1116 | 1116 | * The geomap shortcode. |
| 1117 | 1117 | */ |
| 1118 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1118 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | 1119 | |
| 1120 | 1120 | /** |
| 1121 | 1121 | * The entity cloud shortcode. |
| 1122 | 1122 | */ |
| 1123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1123 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | 1124 | |
| 1125 | 1125 | /** |
| 1126 | 1126 | * The entity glossary shortcode. |
| 1127 | 1127 | */ |
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1128 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | 1130 | |
| 1131 | 1131 | /** |
| 1132 | 1132 | * Faceted Search shortcode. |
| 1133 | 1133 | */ |
| 1134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1134 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | 1135 | |
| 1136 | 1136 | /** |
| 1137 | 1137 | * The ShareThis service. |
| 1138 | 1138 | */ |
| 1139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1139 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | 1140 | |
| 1141 | 1141 | /** |
| 1142 | 1142 | * The SEO service. |
| 1143 | 1143 | */ |
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1144 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1145 | 1145 | |
| 1146 | 1146 | /** |
| 1147 | 1147 | * The AMP service. |
| 1148 | 1148 | */ |
| 1149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1149 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1150 | 1150 | |
| 1151 | 1151 | /** Widgets */ |
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1152 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1153 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | 1154 | |
| 1155 | 1155 | /* |
| 1156 | 1156 | * Schema.org Services. |
| 1157 | 1157 | * |
| 1158 | 1158 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1159 | 1159 | */ |
| 1160 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1161 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1160 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1161 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1162 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1163 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1164 | 1164 | new Wordlift_Schemaorg_Sync_Service(); |
| 1165 | 1165 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1166 | 1166 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | |
| 1173 | 1173 | // Instantiate a global logger. |
| 1174 | 1174 | global $wl_logger; |
| 1175 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1175 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1176 | 1176 | |
| 1177 | 1177 | // Load the `wl-api` end-point. |
| 1178 | 1178 | new Wordlift_Http_Api(); |
@@ -1183,13 +1183,13 @@ discard block |
||
| 1183 | 1183 | /** Services. */ |
| 1184 | 1184 | // Create the configuration service. |
| 1185 | 1185 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1186 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1186 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1187 | 1187 | |
| 1188 | 1188 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1189 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1189 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1190 | 1190 | |
| 1191 | 1191 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1192 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1192 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1193 | 1193 | |
| 1194 | 1194 | // Create an instance of the UI service. |
| 1195 | 1195 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1198,34 +1198,34 @@ discard block |
||
| 1198 | 1198 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1199 | 1199 | |
| 1200 | 1200 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1201 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1201 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1202 | 1202 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1203 | 1203 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1204 | 1204 | |
| 1205 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1206 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1207 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1208 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1209 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1205 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1206 | + $this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/'); |
|
| 1207 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1208 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1209 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1210 | 1210 | |
| 1211 | 1211 | // Instantiate the JSON-LD service. |
| 1212 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1212 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1213 | 1213 | |
| 1214 | 1214 | /** Linked Data. */ |
| 1215 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1216 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1215 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1216 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1217 | 1217 | |
| 1218 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1218 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1219 | 1219 | |
| 1220 | 1220 | // Create a new instance of the Redirect service. |
| 1221 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1222 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1223 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1221 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1222 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1223 | + $this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
| 1224 | 1224 | |
| 1225 | 1225 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1226 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1226 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1227 | 1227 | |
| 1228 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1228 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service); |
|
| 1229 | 1229 | |
| 1230 | 1230 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1231 | 1231 | |
@@ -1239,68 +1239,68 @@ discard block |
||
| 1239 | 1239 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1240 | 1240 | |
| 1241 | 1241 | // Create an import service instance to hook later to WP's import function. |
| 1242 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1242 | + $this->import_service = new Wordlift_Import_Service($this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri()); |
|
| 1243 | 1243 | |
| 1244 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1244 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1245 | 1245 | |
| 1246 | 1246 | // Create the entity rating service. |
| 1247 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1247 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1248 | 1248 | |
| 1249 | 1249 | // Create entity list customization (wp-admin/edit.php). |
| 1250 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1250 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1251 | 1251 | |
| 1252 | 1252 | // Create a new instance of the Redirect service. |
| 1253 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1253 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1254 | 1254 | |
| 1255 | 1255 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1256 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1257 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1258 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1256 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1257 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1258 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1259 | 1259 | |
| 1260 | 1260 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1261 | 1261 | |
| 1262 | 1262 | // Instantiate the JSON-LD service. |
| 1263 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1264 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1265 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1266 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1267 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1268 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1269 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1270 | - |
|
| 1271 | - |
|
| 1272 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1273 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1274 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1275 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1276 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1277 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1263 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1264 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service); |
|
| 1265 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1266 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter($this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter); |
|
| 1267 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1268 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service); |
|
| 1269 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1270 | + |
|
| 1271 | + |
|
| 1272 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1273 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1274 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1275 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1276 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1277 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service); |
|
| 1278 | 1278 | |
| 1279 | 1279 | // Initialize the shortcodes. |
| 1280 | 1280 | new Wordlift_Navigator_Shortcode(); |
| 1281 | 1281 | new Wordlift_Chord_Shortcode(); |
| 1282 | 1282 | new Wordlift_Geomap_Shortcode(); |
| 1283 | 1283 | new Wordlift_Timeline_Shortcode(); |
| 1284 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1285 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1284 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1285 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1286 | 1286 | new Wordlift_Faceted_Search_Shortcode(); |
| 1287 | 1287 | |
| 1288 | 1288 | // Initialize the SEO service. |
| 1289 | 1289 | new Wordlift_Seo_Service(); |
| 1290 | 1290 | |
| 1291 | 1291 | // Initialize the AMP service. |
| 1292 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1292 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1293 | 1293 | |
| 1294 | 1294 | /** Services. */ |
| 1295 | 1295 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1296 | 1296 | new Wordlift_Image_Service(); |
| 1297 | 1297 | |
| 1298 | 1298 | /** Adapters. */ |
| 1299 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1300 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1301 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1302 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1303 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1299 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1300 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1301 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1302 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service); |
|
| 1303 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1304 | 1304 | |
| 1305 | 1305 | /* |
| 1306 | 1306 | * Exclude our public js from WP-Rocket. |
@@ -1324,8 +1324,8 @@ discard block |
||
| 1324 | 1324 | new Wordlift_Push_References_Async_Task(); |
| 1325 | 1325 | |
| 1326 | 1326 | /** WL Autocomplete. */ |
| 1327 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1328 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1327 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service); |
|
| 1328 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service); |
|
| 1329 | 1329 | |
| 1330 | 1330 | /** WordPress Admin UI. */ |
| 1331 | 1331 | |
@@ -1336,15 +1336,15 @@ discard block |
||
| 1336 | 1336 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1337 | 1337 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1338 | 1338 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1339 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1340 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1339 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1340 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1341 | 1341 | |
| 1342 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1343 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1344 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1342 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element); |
|
| 1343 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service); |
|
| 1344 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1345 | 1345 | |
| 1346 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1347 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1346 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1347 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1348 | 1348 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1349 | 1349 | |
| 1350 | 1350 | // Pages. |
@@ -1355,9 +1355,9 @@ discard block |
||
| 1355 | 1355 | * |
| 1356 | 1356 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1357 | 1357 | */ |
| 1358 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1359 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1358 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1359 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1360 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1361 | 1361 | } |
| 1362 | 1362 | new Wordlift_Entity_Type_Admin_Service(); |
| 1363 | 1363 | |
@@ -1371,23 +1371,23 @@ discard block |
||
| 1371 | 1371 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1372 | 1372 | |
| 1373 | 1373 | /* WordPress Admin. */ |
| 1374 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1375 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1374 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1375 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1376 | 1376 | |
| 1377 | 1377 | // Create an instance of the install wizard. |
| 1378 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1378 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element); |
|
| 1379 | 1379 | |
| 1380 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1380 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1381 | 1381 | |
| 1382 | 1382 | // User Profile. |
| 1383 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1383 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1384 | 1384 | |
| 1385 | 1385 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1386 | 1386 | |
| 1387 | 1387 | // Load the debug service if WP is in debug mode. |
| 1388 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1389 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1390 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1388 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1389 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1390 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | 1393 | // Remote Image Service. |
@@ -1400,12 +1400,12 @@ discard block |
||
| 1400 | 1400 | * |
| 1401 | 1401 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1402 | 1402 | */ |
| 1403 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1403 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1404 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1405 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1406 | 1406 | |
| 1407 | 1407 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1408 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1408 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1409 | 1409 | |
| 1410 | 1410 | /* |
| 1411 | 1411 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1414,8 +1414,8 @@ discard block |
||
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 3.20.0 |
| 1416 | 1416 | */ |
| 1417 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1417 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1418 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1419 | 1419 | |
| 1420 | 1420 | /* |
| 1421 | 1421 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1424,15 +1424,15 @@ discard block |
||
| 1424 | 1424 | * |
| 1425 | 1425 | * @since 3.20.0 |
| 1426 | 1426 | */ |
| 1427 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1427 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1428 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1429 | 1429 | |
| 1430 | 1430 | /* |
| 1431 | 1431 | * Load dependencies for the front-end. |
| 1432 | 1432 | * |
| 1433 | 1433 | * @since 3.20.0 |
| 1434 | 1434 | */ |
| 1435 | - if ( ! is_admin() ) { |
|
| 1435 | + if ( ! is_admin()) { |
|
| 1436 | 1436 | /* |
| 1437 | 1437 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1438 | 1438 | * |
@@ -1440,8 +1440,8 @@ discard block |
||
| 1440 | 1440 | * |
| 1441 | 1441 | * @since 3.20.0 |
| 1442 | 1442 | */ |
| 1443 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1443 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1444 | + new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | } |
@@ -1458,9 +1458,9 @@ discard block |
||
| 1458 | 1458 | private function set_locale() { |
| 1459 | 1459 | |
| 1460 | 1460 | $plugin_i18n = new Wordlift_i18n(); |
| 1461 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1461 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1462 | 1462 | |
| 1463 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1463 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1464 | 1464 | |
| 1465 | 1465 | } |
| 1466 | 1466 | |
@@ -1481,29 +1481,29 @@ discard block |
||
| 1481 | 1481 | $this->user_service |
| 1482 | 1482 | ); |
| 1483 | 1483 | |
| 1484 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1484 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1485 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1486 | 1486 | |
| 1487 | 1487 | // Hook the init action to taxonomy services. |
| 1488 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1489 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1488 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1489 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1490 | 1490 | |
| 1491 | 1491 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1492 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1492 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1493 | 1493 | |
| 1494 | 1494 | // Hook the added_post_meta action to the Thumbnail service. |
| 1495 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1495 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1496 | 1496 | |
| 1497 | 1497 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1498 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1498 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1499 | 1499 | |
| 1500 | 1500 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1501 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1501 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1502 | 1502 | |
| 1503 | 1503 | // Register custom allowed redirect hosts. |
| 1504 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1504 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1505 | 1505 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1506 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1506 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1507 | 1507 | |
| 1508 | 1508 | /* |
| 1509 | 1509 | * The old dashboard is replaced with dashboard v2. |
@@ -1521,80 +1521,80 @@ discard block |
||
| 1521 | 1521 | |
| 1522 | 1522 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1523 | 1523 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1524 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1525 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1524 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1525 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1526 | 1526 | |
| 1527 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1528 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1527 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1528 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1529 | 1529 | |
| 1530 | 1530 | // Entity listing customization (wp-admin/edit.php) |
| 1531 | 1531 | // Add custom columns. |
| 1532 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1532 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1533 | 1533 | // no explicit entity as it prevents handling of other post types. |
| 1534 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1534 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1535 | 1535 | // Add 4W selection. |
| 1536 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1537 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1538 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1539 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1536 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1537 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1538 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1539 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1540 | 1540 | |
| 1541 | 1541 | /* |
| 1542 | 1542 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1543 | 1543 | * |
| 1544 | 1544 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1545 | 1545 | */ |
| 1546 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1547 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1546 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1547 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1551 | 1551 | // entities. |
| 1552 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1552 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1553 | 1553 | |
| 1554 | 1554 | // Filter imported post meta. |
| 1555 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1555 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1556 | 1556 | |
| 1557 | 1557 | // Notify the import service when an import starts and ends. |
| 1558 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1559 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1558 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1559 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1560 | 1560 | |
| 1561 | 1561 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1562 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1563 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1562 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1563 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1564 | 1564 | |
| 1565 | 1565 | // Hook the menu to the Download Your Data page. |
| 1566 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1567 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1568 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1566 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1567 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1568 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1569 | 1569 | |
| 1570 | 1570 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1571 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1571 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1572 | 1572 | |
| 1573 | 1573 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1574 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1575 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1576 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1574 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1575 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1576 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1577 | 1577 | |
| 1578 | 1578 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1579 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1579 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1580 | 1580 | |
| 1581 | 1581 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1582 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1582 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1583 | 1583 | |
| 1584 | 1584 | // Hook the `admin_init` function to the Admin Setup. |
| 1585 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1585 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1586 | 1586 | |
| 1587 | 1587 | // Hook the admin_init to the settings page. |
| 1588 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1589 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1588 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1589 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1590 | 1590 | |
| 1591 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1591 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1592 | 1592 | |
| 1593 | 1593 | // Hook the menu creation on the general wordlift menu creation. |
| 1594 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1595 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1594 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1595 | + if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) { |
|
| 1596 | 1596 | // Add the functionality only if a flag is set in wp-config.php . |
| 1597 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1597 | + $this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2); |
|
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | /* |
@@ -1604,17 +1604,17 @@ discard block |
||
| 1604 | 1604 | * |
| 1605 | 1605 | * @since 3.20.0 |
| 1606 | 1606 | */ |
| 1607 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1607 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
| 1608 | 1608 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
| 1609 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1609 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | // Hook key update. |
| 1613 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1614 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1613 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1614 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1615 | 1615 | |
| 1616 | 1616 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1617 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1617 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1618 | 1618 | |
| 1619 | 1619 | /* |
| 1620 | 1620 | * Remove the Analytics Settings link from the plugin page. |
@@ -1625,58 +1625,58 @@ discard block |
||
| 1625 | 1625 | // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1626 | 1626 | |
| 1627 | 1627 | // Hook the AJAX `wl_publisher` action name. |
| 1628 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1628 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1629 | 1629 | |
| 1630 | 1630 | // Hook row actions for the entity type list admin. |
| 1631 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1631 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1632 | 1632 | |
| 1633 | 1633 | /** Ajax actions. */ |
| 1634 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1634 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1635 | 1635 | |
| 1636 | 1636 | // Hook capabilities manipulation to allow access to entity type admin |
| 1637 | 1637 | // page on WordPress versions before 4.7. |
| 1638 | 1638 | global $wp_version; |
| 1639 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1640 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1639 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1640 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1643 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1644 | 1644 | |
| 1645 | 1645 | /** Adapters. */ |
| 1646 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1647 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1648 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1649 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1650 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1651 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1646 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1647 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit'); |
|
| 1648 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts'); |
|
| 1649 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel'); |
|
| 1650 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning'); |
|
| 1651 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1652 | 1652 | |
| 1653 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1654 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1653 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1654 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1655 | 1655 | |
| 1656 | 1656 | |
| 1657 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1658 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1657 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1658 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1659 | 1659 | |
| 1660 | 1660 | // Handle the autocomplete request. |
| 1661 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1661 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1662 | 1662 | $this->autocomplete_adapter, |
| 1663 | 1663 | 'wl_autocomplete', |
| 1664 | - ) ); |
|
| 1665 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1664 | + )); |
|
| 1665 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1666 | 1666 | $this->autocomplete_adapter, |
| 1667 | 1667 | 'wl_autocomplete', |
| 1668 | - ) ); |
|
| 1668 | + )); |
|
| 1669 | 1669 | |
| 1670 | 1670 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1671 | - if ( is_multisite() ) { |
|
| 1672 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1671 | + if (is_multisite()) { |
|
| 1672 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1673 | 1673 | } |
| 1674 | 1674 | |
| 1675 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1675 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1676 | 1676 | |
| 1677 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1678 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1679 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1677 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1678 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1679 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | 1682 | /** |
@@ -1688,56 +1688,56 @@ discard block |
||
| 1688 | 1688 | */ |
| 1689 | 1689 | private function define_public_hooks() { |
| 1690 | 1690 | |
| 1691 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1691 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1692 | 1692 | |
| 1693 | 1693 | // Register the entity post type. |
| 1694 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1695 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1694 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1695 | + $this->loader->add_action('init', $this->install_service, 'install'); |
|
| 1696 | 1696 | |
| 1697 | 1697 | // Bind the link generation and handling hooks to the entity link service. |
| 1698 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1699 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1700 | - $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 ); |
|
| 1701 | - $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 ); |
|
| 1698 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1699 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1700 | + $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); |
|
| 1701 | + $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); |
|
| 1702 | 1702 | |
| 1703 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1704 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1703 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1704 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1705 | 1705 | |
| 1706 | 1706 | // Hook the content filter service to add entity links. |
| 1707 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1708 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1707 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1708 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1712 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1712 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1713 | 1713 | |
| 1714 | 1714 | // Hook the ShareThis service. |
| 1715 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1716 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1715 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1716 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1717 | 1717 | |
| 1718 | 1718 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1719 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1719 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1720 | 1720 | |
| 1721 | 1721 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1722 | 1722 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1723 | 1723 | // to categories. |
| 1724 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1724 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1725 | 1725 | |
| 1726 | 1726 | /* |
| 1727 | 1727 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1728 | 1728 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1729 | 1729 | * order of start time. |
| 1730 | 1730 | */ |
| 1731 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1731 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1732 | 1732 | |
| 1733 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1733 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1734 | 1734 | |
| 1735 | 1735 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1736 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1736 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1737 | 1737 | |
| 1738 | 1738 | // Analytics Script Frontend. |
| 1739 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1740 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1739 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1740 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1741 | 1741 | } |
| 1742 | 1742 | |
| 1743 | 1743 | } |
@@ -1790,11 +1790,11 @@ discard block |
||
| 1790 | 1790 | */ |
| 1791 | 1791 | private function load_cli_dependencies() { |
| 1792 | 1792 | |
| 1793 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1793 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1794 | 1794 | |
| 1795 | - $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 ); |
|
| 1795 | + $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); |
|
| 1796 | 1796 | |
| 1797 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1797 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1798 | 1798 | |
| 1799 | 1799 | } |
| 1800 | 1800 | |