\

Namespaces

Flow

Classes

SU_Configuration
SU_Prefixes
WL_Prefixes_List_Table The prefixes list table class.
WL_View The WL_View class provides access to remote JSON-LD resources.
Wordlift_Chord_Widget
WordLift_Geo_Widget Class WordLift_Geo_Widget
Wordlift_Timeline_Widget

Constants

WL_CONFIG_ANALYSIS_NAME

WL_CONFIG_ANALYSIS_NAME

WL_CONFIG_API_URL

WL_CONFIG_API_URL

WL_CONFIG_APPLICATION_KEY_NAME

WL_CONFIG_APPLICATION_KEY_NAME

WL_CONFIG_DATASET_BASE_URI_NAME

WL_CONFIG_DATASET_BASE_URI_NAME

WL_CONFIG_DATASET_NAME

WL_CONFIG_DATASET_NAME

WL_CONFIG_DEFAULT_SITE_LANGUAGE

WL_CONFIG_DEFAULT_SITE_LANGUAGE

WL_CONFIG_ENABLE_COLOR_CODING_ON_FRONTEND_NAME

WL_CONFIG_ENABLE_COLOR_CODING_ON_FRONTEND_NAME

WL_CONFIG_ENTITY_DISPLAY_AS_DEFAULT_NAME

WL_CONFIG_ENTITY_DISPLAY_AS_DEFAULT_NAME

WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING

WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING

WL_CONFIG_SITE_LANGUAGE_NAME

WL_CONFIG_SITE_LANGUAGE_NAME

WL_CONFIG_USER_ID_NAME

WL_CONFIG_USER_ID_NAME

WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE

WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE

WL_CONFIG_WORDLIFT_KEY

WL_CONFIG_WORDLIFT_KEY

WL_CORE_POST_CLASSIFICATION_BOXES

WL_CORE_POST_CLASSIFICATION_BOXES

WL_CORE_POST_ENTITY_RELATIONS_MAPPING

WL_CORE_POST_ENTITY_RELATIONS_MAPPING

WL_CUSTOM_FIELD_ADDRESS

WL_CUSTOM_FIELD_ADDRESS

WL_CUSTOM_FIELD_CAL_DATE_END

WL_CUSTOM_FIELD_CAL_DATE_END

WL_CUSTOM_FIELD_CAL_DATE_START

WL_CUSTOM_FIELD_CAL_DATE_START

WL_CUSTOM_FIELD_ENTITY_DISPLAY_AS_SINGLE_PAGE

WL_CUSTOM_FIELD_ENTITY_DISPLAY_AS_SINGLE_PAGE

WL_CUSTOM_FIELD_FOUNDER

WL_CUSTOM_FIELD_FOUNDER

WL_CUSTOM_FIELD_GEO_LATITUDE

WL_CUSTOM_FIELD_GEO_LATITUDE

WL_CUSTOM_FIELD_GEO_LONGITUDE

WL_CUSTOM_FIELD_GEO_LONGITUDE

WL_CUSTOM_FIELD_IS_REFERENCED_BY_POSTS

WL_CUSTOM_FIELD_IS_REFERENCED_BY_POSTS

WL_CUSTOM_FIELD_IS_WHAT_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHAT_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHEN_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHEN_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHERE_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHERE_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHO_FOR_POSTS

WL_CUSTOM_FIELD_IS_WHO_FOR_POSTS

WL_CUSTOM_FIELD_LOCATION

WL_CUSTOM_FIELD_LOCATION

WL_CUSTOM_FIELD_REFERENCED_ENTITIES

WL_CUSTOM_FIELD_REFERENCED_ENTITIES

WL_CUSTOM_FIELD_SAME_AS

WL_CUSTOM_FIELD_SAME_AS

WL_CUSTOM_FIELD_WHAT_ENTITIES

WL_CUSTOM_FIELD_WHAT_ENTITIES

WL_CUSTOM_FIELD_WHEN_ENTITIES

WL_CUSTOM_FIELD_WHEN_ENTITIES

WL_CUSTOM_FIELD_WHERE_ENTITIES

WL_CUSTOM_FIELD_WHERE_ENTITIES

WL_CUSTOM_FIELD_WHO_ENTITIES

WL_CUSTOM_FIELD_WHO_ENTITIES

WL_DATA_TYPE_BOOLEAN

WL_DATA_TYPE_BOOLEAN

WL_DATA_TYPE_DATE

WL_DATA_TYPE_DATE

WL_DATA_TYPE_DOUBLE

WL_DATA_TYPE_DOUBLE

WL_DATA_TYPE_INTEGER

WL_DATA_TYPE_INTEGER

WL_DATA_TYPE_STRING

WL_DATA_TYPE_STRING

WL_DATA_TYPE_URI

WL_DATA_TYPE_URI

WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING

WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING

WL_ENTITY_TYPE_NAME

WL_ENTITY_TYPE_NAME

WL_ENTITY_TYPE_TAXONOMY_NAME

WL_ENTITY_TYPE_TAXONOMY_NAME

WL_ENTITY_URL_META_NAME

WL_ENTITY_URL_META_NAME

WL_ENTITY_VIEW_ENTITY_ID_QUERY_VAR

WL_ENTITY_VIEW_ENTITY_ID_QUERY_VAR

WL_OPTIONS_NAME

WL_OPTIONS_NAME

WL_POST_ENTITY_PROPS

WL_POST_ENTITY_PROPS

WL_PROFILING_DURATION_META_KEY

WL_PROFILING_DURATION_META_KEY

WL_PROFILING_POST_TYPE

WL_PROFILING_POST_TYPE

WL_PROFILING_SPARQL_QUERY_META_KEY

WL_PROFILING_SPARQL_QUERY_META_KEY

WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING

WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING

WL_REQUEST_ID

WL_REQUEST_ID

WL_REWRITE_RULE_PATTERN

WL_REWRITE_RULE_PATTERN

For more information, see http://codex.wordpress.org/Class_Reference/WP_Rewrite

WL_SPARQL_QUERY_DATASET_META_BOX_FIELD_NAME

WL_SPARQL_QUERY_DATASET_META_BOX_FIELD_NAME

WL_SPARQL_QUERY_DATASET_META_KEY

WL_SPARQL_QUERY_DATASET_META_KEY

WL_SPARQL_QUERY_META_BOX_FIELD_NAME

WL_SPARQL_QUERY_META_BOX_FIELD_NAME

WL_SPARQL_QUERY_META_BOX_NONCE_ACTION

WL_SPARQL_QUERY_META_BOX_NONCE_ACTION

WL_SPARQL_QUERY_META_BOX_NONCE_NAME

WL_SPARQL_QUERY_META_BOX_NONCE_NAME

WL_SPARQL_QUERY_META_KEY

WL_SPARQL_QUERY_META_KEY

WL_SPARQL_QUERY_POST_TYPE

WL_SPARQL_QUERY_POST_TYPE

WL_TEMP_DIR

WL_TEMP_DIR

Functions

_wl_content_embed_microdata()

_wl_content_embed_microdata(integer  $post_id, string  $content) : string

Lift the post content with the microdata (skipping the is_single check).

Parameters

integer $post_id

The post ID.

string $content

The post content.

Returns

string —

The updated post content.

rl_delete_post()

rl_delete_post(array|integer  $post) 

Delete the specified post from the triple store.

Parameters

array|integer $post

An array of post data

rl_execute_sparql_update_query()

rl_execute_sparql_update_query(string  $query, boolean  $queue = WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING) : boolean

Execute a query on Redlink.

Parameters

string $query

The query to execute.

boolean $queue

Whether to queue the update.

Returns

boolean —

True if successful otherwise false.

rl_sparql_prefixes()

rl_sparql_prefixes() : string

Get a string representing the NS prefixes for a SPARQL query.

Returns

string —

The PREFIX lines.

wl_add_referenced_entities()

wl_add_referenced_entities(integer  $post_id, integer|array  $new_entity_ids, string  $field_name = WL_CUSTOM_FIELD_REFERENCED_ENTITIES) 

Add the referenced entity IDs for the specified post ID.

Parameters

integer $post_id

A post ID.

integer|array $new_entity_ids

An array of referenced entity IDs.

string $field_name

Name of the meta (used for the 4W)

wl_add_related_entities()

wl_add_related_entities(integer  $entity_id, integer|array  $new_entities_ids, string  $field_name = WL_CUSTOM_FIELD_RELATED_ENTITIES) 

Add the related entity IDs for the specified entity ID.

Parameters

integer $entity_id

An entity ID.

integer|array $new_entities_ids

An array of related entity IDs.

string $field_name

Name of the meta

wl_admin_add_entities_meta_box()

wl_admin_add_entities_meta_box(string  $post_type) 

Adds the entities meta box (called from *add_meta_boxes* hook).

Parameters

string $post_type

The type of the current open post.

wl_admin_ajax_sync_to_redlink()

wl_admin_ajax_sync_to_redlink() 

AJAX hook for the *wl_admin_sync_to_redlink* call.

wl_admin_bar()

wl_admin_bar(\WP_Admin_Bar  $wp_admin_bar) 

Adds WordLift to the Admin bar.

Parameters

\WP_Admin_Bar $wp_admin_bar

The existing admin bar.

wl_admin_inject_chord_dialog_dependencies()

wl_admin_inject_chord_dialog_dependencies() 

Loads the styles and scripts. Echoes the HTML dialog on the page.

This method is called by the admin_footer hook.

wl_admin_menu()

wl_admin_menu() 

This function is called by the *admin_menu* hook to create and configure the WordLift administration menu. It raises the *wl_admin_menu* action to have modules add their own submenu.

wl_admin_menu_callback()

wl_admin_menu_callback() 

This function is called as a callback by the *wl_admin_menu* to display the actual page.

wl_admin_permalink_html()

wl_admin_permalink_html(string  $html, integer  $post_id, string  $new_title, string  $new_slug) : \The

Add custom buttons to the buttons below the post title.

Parameters

string $html

The current html.

integer $post_id

The post ID.

string $new_title

Optional. New title.

string $new_slug

Optional. New slug.

Returns

\The —

enhanced html.

wl_admin_post_publish_meta_box()

wl_admin_post_publish_meta_box() 

This file contains methods that intercept the *publish* box and add the display as option for entities.

wl_admin_pre_post_update()

wl_admin_pre_post_update(integer  $post_id) 

Intercept the post updates and set the display as for entities.

Parameters

integer $post_id

The post ID.

wl_admin_set_entity_display_as_default()

wl_admin_set_entity_display_as_default(integer  $post_id) 

Receive notifications when an entity is created and set its default *display as* value.

Parameters

integer $post_id

The entity post ID.

wl_admin_shortcode_buttons()

wl_admin_shortcode_buttons() 

Loads the buttons in TinyMCE.

wl_admin_shortcode_buttons_register_tinymce_javascript()

wl_admin_shortcode_buttons_register_tinymce_javascript(array  $plugin_array) : array

Registers the WordLift shortcodes plugin in TinyMCE.

Parameters

array $plugin_array

An array of TinyMCE plugins.

Returns

array —

The TinyMCE plugins array including WordLift shortcodes plugin.

wl_admin_shortcode_register_buttons()

wl_admin_shortcode_register_buttons(array  $buttons) : array

Register shortcodes menu.

Parameters

array $buttons

An array of buttons.

Returns

array —

The buttons array including the wl_shortcodes_menu.

wl_admin_sync_to_redlink()

wl_admin_sync_to_redlink() 

Sync the site to Redlink triple store and print out the post title being processed.

wl_ajax_analyze_action()

wl_ajax_analyze_action() 

Receive some content, run a remote analysis task and return the results. The content is read from the body input (php://input).

wl_ajax_sparql()

wl_ajax_sparql() 

wl_analyze_content()

wl_analyze_content(string  $content) : string

Analyze the provided content. The analysis will make use of the method *wl_ajax_analyze_action* provided by the WordLift plugin.

Parameters

string $content

The content to analyze.

Returns

string —

Returns null on failure, or the WP_Error, or a WP_Response with the response.

wl_before_delete_user()

wl_before_delete_user(integer  $user_id) 

Delete a user from the remote triple store (hooked to the *delete_user* hook).

Parameters

integer $user_id

The user ID.

wl_build_entity_uri()

wl_build_entity_uri(integer  $post_id) : string

Build the entity URI given the entity's post.

Parameters

integer $post_id

The post ID

Returns

string —

The URI of the entity

wl_build_full_schema_uri_from_schema_slug()

wl_build_full_schema_uri_from_schema_slug(string  $schema_name) : string

Build full schema uri starting from a slug. If the uri is already correct, nothing is done.

Parameters

string $schema_name

Slug or full uri of a schema property or type (es. 'location' or 'http://schema.org/location')

Returns

string —

The full schema uri (es. 'latitude' returns 'http://schema.org/latitude')

wl_build_user_uri()

wl_build_user_uri(integer  $user_id) : null|string

Build an URI for the specified user ID.

Parameters

integer $user_id

The user ID.

Returns

null|string —

Null if the user is not found, or the URI.

wl_caching_delete()

wl_caching_delete(string  $hash) 

Delete the cache file bound to the specified hash.

Parameters

string $hash

The hash file.

wl_caching_delete_file()

wl_caching_delete_file(string  $filename) 

Delete a cache file.

Parameters

string $filename

The cache file to delete.

wl_caching_get()

wl_caching_get(string  $hash) : array|false

Get a cached response for the specified hash.

Parameters

string $hash

The document hash

Returns

array|false —

The cached response or false if the document is not found in the cache.

wl_caching_get_cache_folder()

wl_caching_get_cache_folder() : string

Get the base cache folder path.

Returns

string —

The base cache folder path.

wl_caching_get_filename()

wl_caching_get_filename(string  $hash) : string|false

Get the cache filename. If a file is found but is expired, it is deleted and false is returned.

Parameters

string $hash

The hash.

Returns

string|false —

The cache filename or false if not found.

wl_caching_get_temp_path()

wl_caching_get_temp_path(string  $hash) : string

Return the full path of a temporary file for the specified hash.

Parameters

string $hash

The hash.

Returns

string —

The full path to the file.

wl_caching_hash()

wl_caching_hash(string  $url, string  $args) : string

Create an hash for the specified url and parameters.

Parameters

string $url

The remote URL.

string $args

The request parameters.

Returns

string —

The hash.

wl_caching_put()

wl_caching_put(string  $hash, array  $response, integer  $expires_in_seconds = 3600) 

Stores a response with the specified hash.

Parameters

string $hash

The hash.

array $response

The response.

integer $expires_in_seconds

How many seconds the cache is valid.

wl_caching_remote_request()

wl_caching_remote_request(string  $url, array  $args, boolean  $refresh = false, integer  $expires_in_seconds = 3600) : array

Perform a remote request and return the local copy if any.

Parameters

string $url

The remote URL.

array $args

The request parameters.

boolean $refresh

If true, a remote request will be made and the cache will be refreshed.

integer $expires_in_seconds

How many seconds the cache is valid.

Returns

array —

The remote response.

wl_caching_response_is_cached()

wl_caching_response_is_cached(array  $response) : boolean

Determines whether a response is cached.

Parameters

array $response

The response structure.

Returns

boolean —

True if cached otherwise false.

wl_config_get_recursion_depth()

wl_config_get_recursion_depth() : string

Get the default recursion depth limitation on *entity metadata rendering*.

Returns

string —

The default setting.

wl_configuration_admin_menu()

wl_configuration_admin_menu(string  $parent_slug, string  $capability) 

This function is called by the *wl_admin_menu* hook which is raised when WordLift builds the admin_menu.

Parameters

string $parent_slug

The parent slug for the menu.

string $capability

The required capability to access the page.

wl_configuration_admin_menu_callback()

wl_configuration_admin_menu_callback(boolean  $display_page_title = true) 

Displays the page content.

Parameters

boolean $display_page_title

If true, prints out the page title.

wl_configuration_admin_notices()

wl_configuration_admin_notices() 

Display admin notices.

wl_configuration_advanced_settings_section_callback()

wl_configuration_advanced_settings_section_callback() 

Display the advanced settings description. Called from a hook set by *wl_configuration_settings*.

wl_configuration_check()

wl_configuration_check() 

Check WordLift configuration. If something is missing, display an admin notice.

wl_configuration_checkbox()

wl_configuration_checkbox(array  $args) 

Display a checkbox.

Parameters

array $args

The checkbox parameters.

wl_configuration_general_settings_section_callback()

wl_configuration_general_settings_section_callback() 

Display the general settings description. Called from a hook set by *wl_configuration_settings*.

wl_configuration_get_accounts_by_key_dataset_uri()

wl_configuration_get_accounts_by_key_dataset_uri(string  $key) : string

Get the API URI to retrieve the dataset URI using the WordLift Key.

Parameters

string $key

The WordLift key to use.

Returns

string —

The API URI.

wl_configuration_get_analyzer_url()

wl_configuration_get_analyzer_url() : string

Get the URL to use for running analyses. If a WordLift key is set, then a WordLift Server URL is returned, otherwise a Redlink URL.

Returns

string —

The analysis URL.

wl_configuration_get_api_url()

wl_configuration_get_api_url() : string

Get the API URL.

Returns

string —

Get the API URL.

wl_configuration_get_dataset_index_url()

wl_configuration_get_dataset_index_url() : string

Get the URL to perform indexing operations.

Returns

string —

The URL to call to perform the indexing operation.

wl_configuration_get_enable_color_coding()

wl_configuration_get_enable_color_coding() : boolean

Get the *Enable Color Coding* configuration setting.

Returns

boolean —

Whether color coding should be enabled or not.

wl_configuration_get_entity_display_as()

wl_configuration_get_entity_display_as() : string

Get the *Entity Display As* configuration setting.

Returns

string —

It returns 'index' to display pages as indexes or 'page' to display them as pages.

wl_configuration_get_key()

wl_configuration_get_key() : string

Get the configured WordLift key.

Returns

string —

The configured WordLift key or an empty string.

wl_configuration_get_languages()

wl_configuration_get_languages() : array

Get the available languages.

Returns

array —

An array of languages key values (key being the language code and values the language names).

wl_configuration_get_query_select_url()

wl_configuration_get_query_select_url(string  $output, string|null  $dataset = null) : string

Get the URL to perform SELECT queries.

Parameters

string $output

The output format, either 'json', 'xml', 'tabs' or 'csv'.

string|null $dataset

The dataset to use for the query. Only valid for queries straight to Redlink.

Returns

string —

The URL to call to perform the SELECT query.

wl_configuration_get_query_update_url()

wl_configuration_get_query_update_url() : string

Get the URL to perform UPDATE queries.

Returns

string —

The URL to call to perform the UPDATE query.

wl_configuration_get_redlink_application_name()

wl_configuration_get_redlink_application_name() : string

Get the Redlink application name.

Returns

string —

The Redlink application name.

wl_configuration_get_redlink_dataset_name()

wl_configuration_get_redlink_dataset_name() : string

Get the Redlink dataset name.

Returns

string —

The Redlink dataset name.

wl_configuration_get_redlink_dataset_uri()

wl_configuration_get_redlink_dataset_uri() : string

Get the Redlink dataset URI.

Returns

string —

The Redlink dataset URI.

wl_configuration_get_redlink_key()

wl_configuration_get_redlink_key() : string

Get the Redlink application key.

Returns

string —

The Redlink application key.

wl_configuration_get_redlink_user_id()

wl_configuration_get_redlink_user_id() : string

Get the Redlink user id.

Returns

string —

The Redlink user id.

wl_configuration_get_site_language()

wl_configuration_get_site_language() : string

Get the *Site Language* configuration setting.

Returns

string —

It returns the two-letter code of the site language.

wl_configuration_input_box()

wl_configuration_input_box(array  $args) 

Draw an input text with the provided parameters.

Parameters

array $args

An array of configuration parameters.

wl_configuration_sanitize_settings()

wl_configuration_sanitize_settings(array  $input) : mixed

Sanitize the configuration settings to be stored. Configured as a hook from *wl_configuration_settings*.

Parameters

array $input

The configuration settings array.

Returns

mixed

wl_configuration_select()

wl_configuration_select(array  $args) 

Display a select.

Parameters

array $args

The select configuration parameters.

wl_configuration_set()

wl_configuration_set(string  $settings, string  $key, string  $value) 

Set a configuration option.

Parameters

string $settings

The configuration settings group.

string $key

The setting name.

string $value

The setting value.

wl_configuration_set_api_url()

wl_configuration_set_api_url(string  $value) 

Set the API URL.

Parameters

string $value

The API URL.

wl_configuration_set_enable_color_coding()

wl_configuration_set_enable_color_coding(boolean  $value) 

Set the *Enable Color Coding* configuration setting.

Parameters

boolean $value

True or false.

wl_configuration_set_entity_display_as()

wl_configuration_set_entity_display_as(string  $value) 

Set the *Entity Display As* setting.

Parameters

string $value

Either index to display the entities as a list of links or page to display the entity page.

wl_configuration_set_key()

wl_configuration_set_key(string  $value) 

Set the WordLift key.

Parameters

string $value

The WordLift key.

wl_configuration_set_redlink_application_name()

wl_configuration_set_redlink_application_name(string  $value) 

Set the Redlink application name (once called the Analysis name).

Parameters

string $value

The Redlink application name.

wl_configuration_set_redlink_dataset_name()

wl_configuration_set_redlink_dataset_name(string  $value) 

Set the Redlink dataset name.

Parameters

string $value

The Redlink dataset name.

wl_configuration_set_redlink_dataset_uri()

wl_configuration_set_redlink_dataset_uri(string  $value) 

Set the Redlink dataset URI.

Parameters

string $value

The Redlink dataset URI.

wl_configuration_set_redlink_key()

wl_configuration_set_redlink_key(string  $value) 

Set the Redlink application key.

Parameters

string $value

The Redlink application key.

wl_configuration_set_redlink_user_id()

wl_configuration_set_redlink_user_id(string  $value) 

Set the Redlink user id.

Parameters

string $value

The Redlink user id.

wl_configuration_set_site_language()

wl_configuration_set_site_language(string  $value) 

Set the *Site Language* configuration setting.

Parameters

string $value

The two-letter language code.

wl_configuration_settings()

wl_configuration_settings() 

Configure all the configuration parameters. The configuration parameters are grouped in two tabs: * General * Advanced

Called by the admin_init hook.

wl_configuration_settings_links()

wl_configuration_settings_links(array  $links) : array

Create a link to WordLift settings page.

Parameters

array $links

An array of links.

Returns

array —

An array of links including those added by the plugin.

wl_configuration_update_key()

wl_configuration_update_key(array  $old_value, array  $new_value) 

Intercept the change of the WordLift key in order to set the dataset URI.

Parameters

array $old_value

The old settings.

array $new_value

The new settings.

wl_configuration_validate()

wl_configuration_validate() : boolean

Check WordLift's configuration.

Returns

boolean —

True if the configuration is set otherwise false.

wl_content_embed_compile_microdata_template()

wl_content_embed_compile_microdata_template(string  $entity_id, string  $entity_type, integer  $recursion_level) : string

Fills up the microdata_template with entity's values.

Parameters

string $entity_id

An entity ID.

string $entity_type

Entity type stracture.

integer $recursion_level

Recursion depth level in microdata compiling. Recursion depth limit is defined by WL_MAX_NUM_RECURSIONS_WHEN_PRINTING_MICRODATA constant.

Returns

string —

The content with embedded microdata.

wl_content_embed_item_microdata()

wl_content_embed_item_microdata(string  $content, string  $uri, string  $itemprop = null,   $recursion_level) : string

Embed the entity properties as microdata in the content.

Parameters

string $content

A content.

string $uri

An entity URI.

string $itemprop

Specifies which property this entity is for another entity. Useful for recursive markup.

$recursion_level

Returns

string —

The content with embedded microdata.

wl_content_embed_microdata()

wl_content_embed_microdata(string  $content) : string

Lift the post content with the microdata.

Parameters

string $content

The post content.

Returns

string —

The updated post content.

wl_core_add_relation_between_posts_and_entities()

wl_core_add_relation_between_posts_and_entities(integer  $subject_id, string  $relation, array  $object_ids) 

Add a relation between a post/entity and another ( A --> B ).

The complmentary relation is also added ( B --> A ).

Parameters

integer $subject_id

The post ID.

string $relation

Name of the relation.

array $object_ids

Ids of the related posts.

wl_core_get_complementary_relation()

wl_core_get_complementary_relation(string  $meta_name) : string

Get the name of the post meta complementary to the one given as parameter.

See wordlift_core_constants.php for more details.

Parameters

string $meta_name

Name of the meta

Returns

string —

The complementary meta, if any, otherwise null.

wl_core_get_related_post_and_entities()

wl_core_get_related_post_and_entities(integer  $subject_id, string  $relation) : array

Get a post/entity related ids.

Parameters

integer $subject_id

The post ID.

string $relation

Name of the relation.

Returns

array —

Ids of the related posts/entities.

wl_core_merge_old_related_with_new()

wl_core_merge_old_related_with_new(integer  $subject_id, string  $relation, array  $new_related_ids) 

Update post meta with new related ids.

Parameters

integer $subject_id

The post ID.

string $relation

Name of the relation.

array $new_related_ids

Ids of the related posts to add.

wl_core_reset_relation_between_posts_and_entities()

wl_core_reset_relation_between_posts_and_entities(integer  $subject_id, string  $relation) 

Reset relations between a post/entity and another ( A --> B ).

The complmentary relation is reset too ( B --> A ).

Parameters

integer $subject_id

The post ID.

string $relation

Name of the relation.

wl_csv_to_geojson()

wl_csv_to_geojson(  $body) 

Parameters

$body

wl_csv_to_geojson_parse_body()

wl_csv_to_geojson_parse_body(string  $body) 

Parse a CSV body and output the GeoJSON features. The CSV must contain and header row. The result is output using echo.

Parameters

string $body

The body.

wl_csv_to_json()

wl_csv_to_json(  $body) 

Parameters

$body

wl_csv_to_json_parse_body()

wl_csv_to_json_parse_body(string  $body) 

Parse a CSV body and output the JSON.

Parameters

string $body

The body.

wl_echo_nonce()

wl_echo_nonce(  $meta_name) 

Parameters

$meta_name

wl_enqueue_scripts()

wl_enqueue_scripts() 

wl_entities_box_content()

wl_entities_box_content(\WP_Post  $post) 

Displays the meta box contents (called by *add_meta_box* callback).

Parameters

\WP_Post $post

The current post.

wl_entities_coordinates_box_content()

wl_entities_coordinates_box_content(\WP_Post  $post) 

Displays the coordinates meta box contents (called by *add_meta_box* callback).

Parameters

\WP_Post $post

The current post.

wl_entities_date_box_content()

wl_entities_date_box_content(\WP_Post  $post,   $info) 

Displays the date meta box contents (called by *add_meta_box* callback).

Parameters

\WP_Post $post

The current post.

$info

Array The custom_field the method must manage.

wl_entities_metaboxes_group_properties_by_input_field()

wl_entities_metaboxes_group_properties_by_input_field(array  $custom_fields) 

Separes metaboxes in simple and grouped (called from *wl_admin_add_entities_meta_box*).

Parameters

array $custom_fields

Information on the entity type.

wl_entities_string_box_content()

wl_entities_string_box_content(\WP_Post  $post,   $info) 

Displays the string meta box contents (called by *add_meta_box* callback).

Parameters

\WP_Post $post

The current post.

$info

Array The custom_field the method must manage.

wl_entities_uri_box_content()

wl_entities_uri_box_content(\WP_Post  $post,   $info) 

Displays jQuery autocomplete in a meta box, to assign an entity as property value (e.g. location of an Event).

The assigned entity can also be created on the fly.

Parameters

\WP_Post $post

The current post.

$info

Array The custom_field the method must manage.

wl_entity_date_shortcode()

wl_entity_date_shortcode(  $atts,   $content = null) 

Parameters

$atts
$content

wl_entity_duration_shortcode()

wl_entity_duration_shortcode(  $atts,   $content = null) 

Parameters

$atts
$content

wl_entity_image_shortcode()

wl_entity_image_shortcode(  $atts,   $content = null) 

Parameters

$atts
$content

wl_entity_metabox_save()

wl_entity_metabox_save(  $post_id) 

Saves the values of wordlift metaboxes set in the entity editor page

Parameters

$post_id

wl_entity_property_shortcode()

wl_entity_property_shortcode(  $atts,   $content = null) 

Parameters

$atts
$content

wl_entity_props_get_mappings()

wl_entity_props_get_mappings() 

Get the entity properties mappings to custom field names.

wl_entity_props_save()

wl_entity_props_save(  $entity_uri, array  $props) 

Save the entity properties.

Parameters

$entity_uri
array $props

An array of entity properties.

wl_entity_props_save_prop()

wl_entity_props_save_prop(integer  $post_id, string  $key, string  $values, array  $mappings) 

Save the specified prop.

Parameters

integer $post_id

The post ID.

string $key

The property name.

string $values

The property values.

array $mappings

An array of mappings from property URIs to field names.

wl_entity_taxonomy_get_custom_fields()

wl_entity_taxonomy_get_custom_fields(integer  $entity_id = null) : mixed

Retrieve entity type custom fields

Parameters

integer $entity_id

id of the entity, if any

Returns

mixed —

if $entity_id was specified, return custom_fields for that entity's type. Otherwise returns all custom_fields

wl_entity_template()

wl_entity_template(string  $template) : string

Intercept the call to display the entity page and redirect it to the *home.php* template with a list of posts referencing this entity.

Parameters

string $template

The template selected by WordPress.

Returns

string —

The template selected by this function.

wl_entity_type_meta_boxes()

wl_entity_type_meta_boxes() 

Adds the Entity URL box and the Entity SameAs box (from the hook *add_meta_boxes*).

wl_entity_type_meta_boxes_content()

wl_entity_type_meta_boxes_content(\WP_Post  $post) 

Displays the content of the entity URL box (called from the *entity_url* method).

Parameters

\WP_Post $post

The post.

wl_entity_type_register()

wl_entity_type_register() 

Registers the entity custom post type (from the *init* hook).

wl_entity_type_save_custom_fields()

wl_entity_type_save_custom_fields(integer  $post_id) : integer|null

Saves the entity URL for the specified post ID (set via the *save_post* hook).

Parameters

integer $post_id

The post ID.

Returns

integer|null

wl_entity_type_taxonomy_add_term_fields()

wl_entity_type_taxonomy_add_term_fields() 

wl_entity_type_taxonomy_edit_term_fields()

wl_entity_type_taxonomy_edit_term_fields(  $term) 

Parameters

$term

wl_entity_type_taxonomy_get_term_options()

wl_entity_type_taxonomy_get_term_options(integer  $term_id) : mixed|void

Get the data for the specified entity type (term id).

Parameters

integer $term_id

A numeric term ID.

Returns

mixed|void —

The entity type data.

wl_entity_type_taxonomy_get_type()

wl_entity_type_taxonomy_get_type(integer  $post_id) : array|null

Get the entity main type for the specified post ID.

Parameters

integer $post_id

The post ID

Returns

array|null —

An array of type properties or null if no term is associated

wl_entity_type_taxonomy_register()

wl_entity_type_taxonomy_register() 

Add the type taxonomy to the entity (from the *init* hook).

wl_entity_type_taxonomy_save_custom_meta()

wl_entity_type_taxonomy_save_custom_meta(  $term_id) 

Save extra taxonomy fields callback function.

Parameters

$term_id

wl_entity_type_taxonomy_type_inheritage()

wl_entity_type_taxonomy_type_inheritage(  $child_term_custom_fields,   $parent_term_ids) : array

Merge the custom fields of an entity types with the custom fields inherited from parents.

This function is used by wl_install_entity_type_data at installation time.

Parameters

$child_term_custom_fields

Custom fields of the child entity type.

$parent_term_ids

Array containing the ids of the parent types.

Returns

array —

Merged custom fields.

wl_entity_type_taxonomy_update_term()

wl_entity_type_taxonomy_update_term(integer  $term_id, string  $css_class, string  $uri, array  $same_as = array(), array  $custom_fields = array(), array  $templates = array(), array  $microdata_template = array()) : True

Update an entity type with the provided data.

Parameters

integer $term_id

The numeric term ID.

string $css_class

The stylesheet class.

string $uri

The URI.

array $same_as

An array of sameAs URIs.

array $custom_fields

An array of custom fields and their properties mapping (with info on how to export them to the triple store).

array $templates
array $microdata_template

A template string to print microdata on the frontend.

Returns

True —

if option value has changed, false if not or if update failed.

wl_entity_view_add_query_vars()

wl_entity_view_add_query_vars(array  $vars) : array

Add support for our *wl_uri* parameter.

Parameters

array $vars

Existing query vars array.

Returns

array —

The query vars array including our wl_uri parameter.

wl_entity_view_add_rewrite_rules()

wl_entity_view_add_rewrite_rules(array  $rules) : array

Add the WordLift Entity View rule to the rewrite rules.

Parameters

array $rules

The array of existing rules.

Returns

array —

The rules array including ours.

wl_entity_view_before_header()

wl_entity_view_before_header() 

wl_entity_view_change_title()

wl_entity_view_change_title(string  $content) : string

Replaces the title.

Parameters

string $content

The buffered content.

Returns

string —

The updated content.

wl_entity_view_flush_rules()

wl_entity_view_flush_rules() 

Flush the rules if our own rules is not there yet.

wl_entity_view_shortcode()

wl_entity_view_shortcode(  $atts,   $content = null) 

Parameters

$atts
$content

wl_execute_saved_sparql_update_query()

wl_execute_saved_sparql_update_query(integer  $request_id) 

Execute the SPARQL query from the buffer saved for the specified request id.

Parameters

integer $request_id

The request ID.

wl_flush_rewrite_rules_hard()

wl_flush_rewrite_rules_hard(boolean  $hard) 

This function is called by the *flush_rewrite_rules_hard* hook. It recalculates the URI for all the posts.

Parameters

boolean $hard

True if the rewrite involves configuration updates in Apache/IIS.

wl_freebase_image_proxy()

wl_freebase_image_proxy() 

Load an image from Freebase.

wl_geo_widget_layer_shortcode()

wl_geo_widget_layer_shortcode(  $atts) 

Parameters

$atts

wl_geo_widget_marker_shortcode()

wl_geo_widget_marker_shortcode(  $atts) 

Parameters

$atts

wl_get_attachment_for_source_url()

wl_get_attachment_for_source_url(integer  $parent_post_id, string  $source_url) : \WP_Post|null

Get an attachment with the specified parent post ID and source URL.

Parameters

integer $parent_post_id

The parent post ID.

string $source_url

The source URL.

Returns

\WP_Post|null —

A post instance or null if not found.

wl_get_coordinates()

wl_get_coordinates(integer  $post_id) : array|null

Get the coordinates for the specified post ID.

Parameters

integer $post_id

The post ID.

Returns

array|null —

An array of coordinates or null.

wl_get_entity_display_as()

wl_get_entity_display_as(integer  $post_id) : string

Decide whether to show an entity as an index or as an entity page.

Parameters

integer $post_id

The entity post ID.

Returns

string —

The display as code (default: index).

wl_get_entity_is_4w_for_posts()

wl_get_entity_is_4w_for_posts(integer  $entity_id) : array

Get the IDs of posts for which an entity is a 4W.

Parameters

integer $entity_id

The entity ID.

Returns

array —

An array containing the posts ids. In case of non existent entity, an empty array is returned.

wl_get_entity_post_by_uri()

wl_get_entity_post_by_uri(string  $uri) : \WP_Post|null

Find entity posts by the entity URI. Entity as searched by their entity URI or same as.

Parameters

string $uri

The entity URI.

Returns

\WP_Post|null —

A WP_Post instance or null if not found.

wl_get_entity_rdf_types()

wl_get_entity_rdf_types(integer  $post_id) : array

Get the entity type URIs associated to the specified post.

Parameters

integer $post_id

The post ID.

Returns

array —

An array of terms.

wl_get_entity_uri()

wl_get_entity_uri(integer  $post_id) : string|null

Get the entity URI of the provided post.

Parameters

integer $post_id

The post ID.

Returns

string|null —

The URI of the entity or null if not configured.

wl_get_image_urls()

wl_get_image_urls(integer  $post_id) : array

Get all the images bound to a post.

Parameters

integer $post_id

The post ID.

Returns

array —

An array of image URLs.

wl_get_meta_constraints()

wl_get_meta_constraints(  $property_name) : array

Retrieve entity property constraints, starting from the schema.org's property name or from the WL_CUSTOM_FIELD_xxx name.

Parameters

$property_name

as defined by schema.org or WL internal constants

Returns

array —

containing constraint(s) or null (in case of error or no constraint).

wl_get_meta_type()

wl_get_meta_type(  $property_name) : array

Retrieve entity property type, starting from the schema.org's property name or from the WL_CUSTOM_FIELD_xxx name.

Parameters

$property_name

as defined by schema.org or WL internal constants

Returns

array —

containing type(s) or null (in case of error or no types).

wl_get_post_4w_entities()

wl_get_post_4w_entities(integer  $post_id) : array

Get the IDs of 4W related to the specified post.

Parameters

integer $post_id

The post ID.

Returns

array —

An array containing the 4W entitities ids. In case of non existent post, an empty array is returned.

wl_get_post_modified_time()

wl_get_post_modified_time(object  $post) : string

Get the modified time of the provided post. If the time is negative, return the published date.

Parameters

object $post

A post instance.

Returns

string —

A datetime.

wl_get_referenced_entities()

wl_get_referenced_entities(integer  $post_id, string  $field_name = WL_CUSTOM_FIELD_REFERENCED_ENTITIES) 

Get the referenced entity IDs for the specified post ID.

Parameters

integer $post_id

A post ID.

string $field_name

Name of the meta (used for the 4W)

wl_get_referencing_posts()

wl_get_referencing_posts(integer  $entity_id, string  $field_name = WL_CUSTOM_FIELD_IS_REFERENCED_BY_POSTS) : array

Get the post ids that reference the specified entity.

Parameters

integer $entity_id

The entity ID.

string $field_name

Name of the meta (used for the 4W)

Returns

array —

An array of post IDs.

wl_get_related_entities()

wl_get_related_entities(integer  $entity_id, string  $field_name = WL_CUSTOM_FIELD_RELATED_ENTITIES) : array

Get the IDs of the entities related to the specified entity.

Parameters

integer $entity_id

The entity ID.

string $field_name

Name of the meta

Returns

array —

An array of entity IDs related to the one specified.

wl_get_same_as()

wl_get_same_as(integer  $post_id) : array

Get the sameAs URIs for the specified post ID.

Parameters

integer $post_id

A post ID.

Returns

array —

An array of sameAs URIs.

wl_get_sparql_images()

wl_get_sparql_images(string  $uri, integer  $post_id) : string

Get a SPARQL fragment with schema:image predicates.

Parameters

string $uri

The URI subject of the statements.

integer $post_id

The post ID.

Returns

string —

The SPARQL fragment.

wl_get_sparql_post_references()

wl_get_sparql_post_references(integer  $post_id) : string

Get the SPARQL fragment to set the dc:references statements.

Parameters

integer $post_id

The post ID.

Returns

string —

The SPARQL fragment (or an empty string).

wl_get_sparql_time()

wl_get_sparql_time(string  $time) : string

Convert a time string to a SPARQL datetime.

Parameters

string $time

The time string (in 2014-03-03T08:15:55+00:00 format).

Returns

string —

A sparql dateTime string (e.g. "2014-03-03T08:15:55.000Z"^^http://www.w3.org/2001/XMLSchema#dateTime)

wl_get_the_post_thumbnail_src()

wl_get_the_post_thumbnail_src(string  $img) : string

Extract image URL from the output of *get_the_post_thumbnail*.

Parameters

string $img

Output of get_the_post_thumbnail.

Returns

string —

Url of the image.

wl_get_user()

wl_get_user(integer  $user_id) : boolean|\WP_User

Get a user by his/her ID.

Parameters

integer $user_id

The user ID.

Returns

boolean|\WP_User —

WP_User object or false if no user is found.

wl_get_user_by_uri()

wl_get_user_by_uri(string  $uri) : null|array

Get a user by his/her URI.

Parameters

string $uri

The URI

Returns

null|array —

The user data or null if not found.

wl_get_user_uri()

wl_get_user_uri(integer  $user_id) : string|null

Get the URI for the specified user ID (or create a new URI if the user's URI is not set yet).

Parameters

integer $user_id

The user ID.

Returns

string|null —

The user URI or null if the user is not found.

wl_install_entity_type_data()

wl_install_entity_type_data() 

Install known types in WordPress.

wl_jsonld_get_property()

wl_jsonld_get_property(object  $graph, string  $name, null|string  $language = null, string  $suffix = '',   $index) : null|string

Get a property value using the specified name, language and graph. The property name can be a concatenated tree of keys, e.g. schema:location>schema:latitude.

Parameters

object $graph

The graph.

string $name

The property tree.

null|string $language

If provided, a two-characters language code.

string $suffix

The suffix for remote requests (empty if not provided).

$index

Returns

null|string —

The value or null if not found.

wl_jsonld_get_property_value()

wl_jsonld_get_property_value(object  $graph, string  $key, string|null  $language = null,   $index) : object|string

Get the value for the property with the specified *key* in the provided *graph*. If the property is a reference to another entity, the remote graph is returned.

Parameters

object $graph

A JSON-LD graph.

string $key

The property key to load.

string|null $language

The desired language (if null, the value with no language set).

$index

Returns

object|string —

A new graph if the property is a reference, or a value.

wl_jsonld_load_remote()

wl_jsonld_load_remote(string  $url) : null|object

Load a remote graph. A suffix is added automatically to the URL using the $wl_entity_view_suffix.

Parameters

string $url

The URL.

Returns

null|object —

A graph instance or null if the JSON is invalid.

wl_linked_data_content_get_embedded_entities()

wl_linked_data_content_get_embedded_entities(string  $content) : array

Get an array of entities from the *itemid* attributes embedded in the provided content.

Parameters

string $content

The content with itemid attributes.

Returns

array —

An array of entity posts.

wl_linked_data_push_to_redlink()

wl_linked_data_push_to_redlink(integer  $post_id) 

Push the post with the specified ID to Redlink.

Parameters

integer $post_id

The post ID.

wl_linked_data_save_post()

wl_linked_data_save_post(integer  $post_id) 

Receive events from post saves, and split them according to the post type.

Parameters

integer $post_id

The post id.

wl_linked_data_save_post_and_related_entities()

wl_linked_data_save_post_and_related_entities(integer  $post_id) 

Save the post to the triple store. Also saves the entities locally and on the triple store.

Parameters

integer $post_id

The post id being saved.

wl_plugins_url()

wl_plugins_url(  $url,   $path,   $plugin) : string

Change *plugins_url* response to return the correct path of WordLift files when working in development mode.

Parameters

$url

The URL as set by the plugins_url method.

$path

The request path.

$plugin

The plugin folder.

Returns

string —

The URL.

wl_predicates()

wl_predicates() : array

Get an array with commonly used predicates.

Returns

array —

An array of predicates.

wl_prefixes()

wl_prefixes() : array

Get an array with commonly supported prefixes.

Returns

array —

An array of prefixes and URIs

wl_prefixes_add()

wl_prefixes_add(string  $prefix, string  $namespace) 

Add the specified prefix / namespace.

Parameters

string $prefix

The prefix

string $namespace

The namespace

wl_prefixes_admin_menu()

wl_prefixes_admin_menu(string  $parent_slug, string  $capability) 

This function is called by the *wl_admin_menu* hook which is raised when WordLift builds the admin_menu.

Parameters

string $parent_slug

The parent slug for the menu.

string $capability

The required capability to access the page.

wl_prefixes_admin_menu_callback()

wl_prefixes_admin_menu_callback(boolean  $display_page_title = true) 

Displays the page content.

Parameters

boolean $display_page_title

If true, prints out the page title.

wl_prefixes_compact()

wl_prefixes_compact(string  $uri) : string

Compacts the provided URI by replacing the namespaces with prefixes.

Parameters

string $uri

The uri to compact

Returns

string —

The compacted uri.

wl_prefixes_delete()

wl_prefixes_delete(string  $prefix) : array

Delete the specified prefix.

Parameters

string $prefix

The prefix to delete.

Returns

array —

The updated prefixes array.

wl_prefixes_expand()

wl_prefixes_expand(string  $uri) : string

Expands the provided URI by replacing the prefixes with namespaces.

Parameters

string $uri

The uri to expand

Returns

string —

The expanded uri.

wl_prefixes_get()

wl_prefixes_get(string  $prefix) : string|false

Get the namespace for a prefix.

Parameters

string $prefix

Returns

string|false —

The namespace or false if not found.

wl_prefixes_list()

wl_prefixes_list() : array

Get the list of prefixes.

Returns

array —

An array of prefixes, each made of a prefix and namespace key-values.

wl_print_entity_type_inline_js()

wl_print_entity_type_inline_js() 

Prints inline JavaScript with the entity types configuration removing duplicates.

wl_profiling_add_meta_box()

wl_profiling_add_meta_box() 

Adds a box to the profiling analysis custom post type to display the SPARQL Query. This function is called by the *add_meta_boxes* hook. It calls the *wl_profiling_sparql_query_meta_box_callback* function to display the box contents.

wl_profiling_get_duration()

wl_profiling_get_duration(integer  $post_id) : integer

Get the *duration* for the profiling analysis with the specified post Id.

Parameters

integer $post_id

The post Id.

Returns

integer —

The duration.

wl_profiling_get_sparql_query()

wl_profiling_get_sparql_query(integer  $post_id) : string

Get the *SPARQL query* for the profiling analysis with the specified post Id.

Parameters

integer $post_id

The post Id.

Returns

string —

The SPARQL query.

wl_profiling_insert()

wl_profiling_insert(string  $query, integer  $duration) : integer|false

Create a *profiling* post with the provided data.

Parameters

string $query

The SPARQL query.

integer $duration

The query duration.

Returns

integer|false —

The post Id or false in case of error.

wl_profiling_meta_box_callback()

wl_profiling_meta_box_callback(object  $post) 

Echoes the SPARQL query for the provided post.

Parameters

object $post

The post.

wl_profiling_post_type_register()

wl_profiling_post_type_register() 

Registers the profiling custom post type (from the *init* hook).

wl_profiling_posts_columns()

wl_profiling_posts_columns(array  $columns) : array

Removes the *author* column and adds the *duration* column do the *profiling* post type. This function is called by the manage_*profiling*_posts_columns hook.

Parameters

array $columns

An array of existing columns.

Returns

array —

The new array of columns.

wl_profiling_posts_custom_column()

wl_profiling_posts_custom_column(string  $column, integer  $post_id) 

Get the value for columns of the *profiling* type, such as *duration*. The value is echoed. This function is called by the manage_*profiling*_posts_custom_column hook.

Parameters

string $column

The column name (as defined in wl_profiling_posts_columns).

integer $post_id

The post Id.

wl_profiling_remove_meta_boxes()

wl_profiling_remove_meta_boxes() 

Removes unnecessary metaboxes from the profiling post type edit screen. This function is called by the *admin_menu* hook.

wl_profiling_sparql_post_request()

wl_profiling_sparql_post_request(string  $url, string  $args, string  $query, array  $response) 

Records the end of the execution of a query.

Parameters

string $url

The remote URL.

string $args

The request parameters.

string $query

The SPARQL query.

array $response

The response.

wl_profiling_sparql_pre_request()

wl_profiling_sparql_pre_request(string  $url, string  $args, string  $query) 

Records the execution of a query.

Parameters

string $url

The remote URL.

string $args

The request parameters.

string $query

The SPARQL query.

wl_push_entity_post_to_redlink()

wl_push_entity_post_to_redlink(object  $entity_post) 

Push the provided entity post to Redlink.

Parameters

object $entity_post

An entity post instance.

wl_push_post_to_redlink()

wl_push_post_to_redlink(object  $post) 

Push the provided post to Redlink (not suitable for entities).

Parameters

object $post

A post instance.

wl_push_to_redlink()

wl_push_to_redlink(  $post_id) 

Parameters

$post_id

wl_queue_sparql_update_query()

wl_queue_sparql_update_query(string  $query) 

Write the query to the buffer file.

Parameters

string $query

A SPARQL query.

wl_register_chord_widget()

wl_register_chord_widget() 

wl_register_geo_widget()

wl_register_geo_widget() 

wl_register_shortcode_field()

wl_register_shortcode_field() 

wl_register_timeline_widget()

wl_register_timeline_widget() 

wl_register_user()

wl_register_user(integer  $user_id) : true

Create a user on the remote triple store (hooked to the action *user_register*).

Parameters

integer $user_id

The user ID.

Returns

true —

if successful otherwise false.

wl_remove_text_annotations()

wl_remove_text_annotations(array  $data) : array

Removes empty text annotations from the post content.

Parameters

array $data

The post data.

Returns

array —

mixed The post data array.

wl_replace_item_id_with_uri()

wl_replace_item_id_with_uri(string  $content) : string

Replaces the *itemid* attributes URIs with the WordLift URIs.

Parameters

string $content

The post content.

Returns

string —

The updated post content.

wl_sanitize_uri_path()

wl_sanitize_uri_path(string  $path, string  $char = '_') : \The

Sanitizes an URI path by replacing the non allowed characters with an underscore.

Parameters

string $path

The path to sanitize.

string $char

The replacement character (by default an underscore).

Returns

\The —

sanitized path.

wl_save_entities()

wl_save_entities(array  $entities, integer  $related_post_id = null) : array

Save the specified entities to the local storage.

Parameters

array $entities

An array of entities.

integer $related_post_id

A related post ID.

Returns

array —

An array of posts.

wl_save_entity()

wl_save_entity(string  $uri, string  $label, string  $type_uri, string  $description, array  $entity_types = array(), array  $images = array(), integer  $related_post_id = null, array  $same_as = array()) : null|\WP_Post

Save the specified data as an entity in WordPress. This method only create new entities. When an existing entity is found (by its URI), then the original post is returned.

Parameters

string $uri

The entity URI.

string $label

The entity label.

string $type_uri

The entity type URI.

string $description

The entity description.

array $entity_types

An array of entity type URIs.

array $images

An array of image URLs.

integer $related_post_id

A related post ID.

array $same_as

An array of sameAs URLs.

Returns

null|\WP_Post —

A post instance or null in case of failure.

wl_save_image()

wl_save_image(string  $url) : array

Save the image with the specified URL locally. To the local filename a uniqe serial is appended to ensure its uniqueness.

Parameters

string $url

The image remote URL.

Returns

array —

An array with information about the saved image (path: the local path to the image, url: the local url, content_type: the image content type)

wl_schema_get_property_expected_type()

wl_schema_get_property_expected_type(  $property_name) : array

Retrieves the property expected type, according to the schema.org specifications, where:

Parameters

$property_name

string Name of the property (e.g. name, for the http://schema.org/name property)

Returns

array —

of allowed types or NULL in case of property not found.

The following types are supported (defined as constants):

  • WL_DATA_TYPE_URI
  • WL_DATA_TYPE_DATE
  • WL_DATA_TYPE_INTEGER
  • WL_DATA_TYPE_DOUBLE
  • WL_DATA_TYPE_BOOLEAN
  • WL_DATA_TYPE_STRING
  • a schema.org URI when the property type supports a schema.org entity (e.g. http://schema.org/Place)

wl_schema_get_type_properties()

wl_schema_get_type_properties(  $type_name) : array

Retrieves the list of supported properties for the specified type.

Parameters

$type_name

string Name of the type (e.g. Type, for the http://schema.org/Type)

Returns

array —

The method returns an array of supported properties for the type, e.g. (‘startDate’, ‘endDate’) for an Event. You can call wl_schema_get_property_expected_type on each to know which data type they expect.

wl_schema_get_types()

wl_schema_get_types(  $post_id) : array

Retrieves the entity types for the specified post ID, where

Parameters

$post_id

numeric The numeric post ID.

Returns

array —

Array of type(s) (e.g. Type, for the http://schema.org/Type) or NULL in case of no values (or error).

wl_schema_get_value()

wl_schema_get_value(  $post_id,   $property_name) : array

Retrieves the value of the specified property for the entity, where

Parameters

$post_id

numeric The numeric post ID.

$property_name

string Name of the property (e.g. name, for the http://schema.org/name property).

Returns

array —

An array of values or NULL in case of no values (or error).

wl_schema_set_types()

wl_schema_set_types(  $post_id,   $type_names) : boolean

Sets the entity type(s) for the specified post ID. Support is now for only one type per entity.

Parameters

$post_id

numeric The numeric post ID

$type_names

array An array of strings, each defining a type (e.g. Type, for the http://schema.org/Type)

Returns

boolean —

True if everything went ok, an error string otherwise.

wl_schema_set_value()

wl_schema_set_value(  $post_id,   $property_name,   $property_value) : boolean

Set the value for the specified property and post ID, where

Parameters

$post_id

numeric The numeric post ID.

$property_name

string Name of the property (e.g. name, for the http://schema.org/name property)

$property_value

mixed Value to save into the property.

Returns

boolean —

The method returns true if everything went ok, an error string otherwise.

wl_serialize_entity()

wl_serialize_entity(array  $entity) : array

Serialize an entity post.

Parameters

array $entity

The entity post.

Returns

array —

mixed The entity data array.

wl_set_entity_display_as()

wl_set_entity_display_as(integer  $post_id, string  $display_as) 

Set the entity display mode.

Parameters

integer $post_id

The entity post ID.

string $display_as

The display as value.

wl_set_entity_main_type()

wl_set_entity_main_type(integer  $post_id, string  $type_uri) 

Set the main type for the entity using the related taxonomy.

Parameters

integer $post_id

The numeric post ID.

string $type_uri

A type URI.

wl_set_entity_rdf_types()

wl_set_entity_rdf_types(integer  $post_id, array  $type_uris = array()) 

Set the types for the entity with the specified post ID.

Parameters

integer $post_id

The entity post ID.

array $type_uris

An array of type URIs.

wl_set_entity_uri()

wl_set_entity_uri(integer  $post_id, string  $uri) : boolean

Save the entity URI for the provided post ID.

Parameters

integer $post_id

The post ID.

string $uri

The post URI.

Returns

boolean —

True if successful, otherwise false.

wl_set_referenced_entities()

wl_set_referenced_entities(integer  $post_id, integer|array  $new_entity_ids, string  $field_name = WL_CUSTOM_FIELD_REFERENCED_ENTITIES) 

Set the referenced entity IDs for the specified post ID.

Parameters

integer $post_id

A post ID.

integer|array $new_entity_ids

An array of referenced entity IDs.

string $field_name

Name of the meta (used for the 4W)

wl_set_related_entities()

wl_set_related_entities(integer  $entity_id, integer|array  $new_entities_ids, string  $field_name = WL_CUSTOM_FIELD_RELATED_ENTITIES) 

Set the related entity IDs for the specified entity ID.

Parameters

integer $entity_id

An entity ID.

integer|array $new_entities_ids

An array of related entity IDs.

string $field_name

Name of the meta

wl_set_same_as()

wl_set_same_as(integer  $post_id, array|string  $same_as) 

Set the sameAs URIs for the specified post ID.

Parameters

integer $post_id

A post ID.

array|string $same_as

An array of same as URIs or a single URI string.

wl_set_source_url()

wl_set_source_url(integer  $post_id, string  $source_url) 

Set the source URL.

Parameters

integer $post_id

The post ID.

string $source_url

The source URL.

wl_set_user_uri()

wl_set_user_uri(integer  $user_id, string  $uri) 

Set the URI for the specified user.

Parameters

integer $user_id

The user ID.

string $uri

The URI.

wl_shortcode_chord()

wl_shortcode_chord(array  $atts) : string

Sets-up the widget. This is called by WordPress when the shortcode is inserted in the body.

Parameters

array $atts

An array of parameters set by the editor to customize the shortcode behaviour.

Returns

string

wl_shortcode_chord_ajax()

wl_shortcode_chord_ajax() 

Retrieve related entities and output them in JSON.

wl_shortcode_chord_get_relations()

wl_shortcode_chord_get_relations(integer  $post_id, integer  $depth = 2, array  $related = null) : array

Recursive function used to retrieve related content starting from a post ID.

Parameters

integer $post_id

The entity post ID.

integer $depth

Max number of entities in output.

array $related

An existing array of related entities.

Returns

array

wl_shortcode_chord_most_referenced_entity_id()

wl_shortcode_chord_most_referenced_entity_id() : mixed

Get entity with more relations (used for the global chord).

Returns

mixed

wl_shortcode_chord_register()

wl_shortcode_chord_register() 

Registers the *wl-chord* shortcode.

wl_shortcode_chord_relations_to_json()

wl_shortcode_chord_relations_to_json(  $data) : mixed|string|void

Optimize and convert retrieved content to JSON.

Parameters

$data

Returns

mixed|string|void

wl_shortcode_faceted_search()

wl_shortcode_faceted_search(  $atts) 

Parameters

$atts

wl_shortcode_faceted_search_ajax()

wl_shortcode_faceted_search_ajax() 

wl_shortcode_field()

wl_shortcode_field(array  $atts) : string

Print wl_field shortcode

Parameters

array $atts

An array of shortcode attributes.

Returns

string —

A dom element with requested property value(s).

wl_shortcode_geomap()

wl_shortcode_geomap(array  $atts) : string

Print geomap shortcode

Parameters

array $atts

An array of shortcode attributes.

Returns

string —

A dom element represneting a geomap.

wl_shortcode_geomap_ajax()

wl_shortcode_geomap_ajax() : array

Print both global or post related places in json. It's executed via Ajax

Returns

array —

An array of place posts.

wl_shortcode_geomap_get_places()

wl_shortcode_geomap_get_places(integer  $post_id = null) : array

Retrieve geomap places. If $post_id is null the return places blog wide

Parameters

integer $post_id

The post ID.

Returns

array —

An array of place posts.

wl_shortcode_geomap_to_json()

wl_shortcode_geomap_to_json(array  $places) : array

Encode places array in geojson compliant format (refer to http://leafletjs.com/examples/geojson.html) Define geomap boundaries according to $places Default boundaries are defined using PHP_INT_MAX value

Parameters

array $places

An array of place posts.

Returns

array —

An array of place posts.

wl_shortcode_timeline()

wl_shortcode_timeline(array  $atts) : string

Sets-up the widget. This is called by WordPress when the shortcode is inserted in the body.

Parameters

array $atts

An array of parameters set by the editor to customize the shortcode behaviour.

Returns

string

wl_shortcode_timeline_ajax()

wl_shortcode_timeline_ajax() 

Retrieve timeline events and output them in JSON.

wl_shortcode_timeline_get_events()

wl_shortcode_timeline_get_events(integer  $post_id = null) : array

Retrieve timeline events.

Parameters

integer $post_id

The post ID.

Returns

array —

An array of event posts.

wl_shortcode_timeline_register()

wl_shortcode_timeline_register() 

Registers the *wl-timeline* shortcode.

wl_shortcode_timeline_to_json()

wl_shortcode_timeline_to_json(  $posts) 

Convert timeline events to JSON.

Parameters

$posts

wl_shutdown()

wl_shutdown() 

Schedule the execution of SPARQL Update queries before the WordPress look ends.

wl_sparql_get_query_by_post_id()

wl_sparql_get_query_by_post_id(integer  $post_id) : string

Get the SPARQL Query associated with the SPARQL Query post with the specified Id.

Parameters

integer $post_id

The post Id.

Returns

string —

The SPARQL Query or an empty string if not found.

wl_sparql_get_query_by_slug()

wl_sparql_get_query_by_slug(string  $slug) : string

Get the SPARQL Query associated with the SPARQL Query post with the specified slug.

Parameters

string $slug

The post name.

Returns

string —

The SPARQL Query or an empty string if not found.

wl_sparql_get_query_dataset_by_post_id()

wl_sparql_get_query_dataset_by_post_id(integer  $post_id) : string

Get the SPARQL Query dataset to use for a SPARQL query.

Parameters

integer $post_id

The post Id.

Returns

string —

The dataset name.

wl_sparql_get_query_dataset_by_slug()

wl_sparql_get_query_dataset_by_slug(string  $slug) : string

Get the SPARQL Query dataset to use for a SPARQL query.

Parameters

string $slug

The post slug.

Returns

string —

The dataset name.

wl_sparql_query_add_meta_box()

wl_sparql_query_add_meta_box() 

Adds a box to the SPARQL Query entity type.

wl_sparql_query_meta_box_callback()

wl_sparql_query_meta_box_callback(object  $post) 

This function is called by the *wl_sparql_query_add_meta_box* callback in order to display the metabox contents.

Parameters

object $post

The post instance.

wl_sparql_query_post_type_register()

wl_sparql_query_post_type_register() 

Registers the entity custom post type (from the *init* hook).

wl_sparql_query_save_meta_box_data()

wl_sparql_query_save_meta_box_data(integer  $post_id) 

When the post is saved, saves our custom data.

Parameters

integer $post_id

The ID of the post being saved.

wl_sparql_replace_params()

wl_sparql_replace_params(string  $query, array  $params) : string

Replace the provided parameters map.

Parameters

string $query

The SPARQL query.

array $params

A key-value map of parameters.

Returns

string —

The query.

wl_transition_post_status()

wl_transition_post_status(string  $new_status, string  $old_status, array  $post) 

Receive events when a post (any type) status changes. We need to handle here the following cases: 1. *published* to any other status: a) delete from the triple store.

b) all the referenced entities that are not referenced by any other published post, are to be un-published.

  1. any other status to published: all referenced entities (only posts of type entity) must be published.

Note that any status to published is handled by the save post routines.

Parameters

string $new_status

The new post status

string $old_status

The old post status

array $post

An array with the post data

wl_update_post_status()

wl_update_post_status(integer  $post_id, string  $status) 

Update the status of a post.

Parameters

integer $post_id

The post ID

string $status

The new status

wl_update_user_profile()

wl_update_user_profile(integer  $user_id) : true

Called when a user is updated.

Parameters

integer $user_id

The user ID.

Returns

true —

if successful otherwise false.

wl_write_log()

wl_write_log(string|mixed  $log) 

Log to the debug.log file.

Parameters

string|mixed $log

The log data.

wl_write_log_handler()

wl_write_log_handler(string|array  $log, string  $caller = null) 

The default log handler prints out the log.

Parameters

string|array $log

The log data.

string $caller

The calling function.

wordlift_admin_add_related_posts_meta_box()

wordlift_admin_add_related_posts_meta_box() 

wordlift_admin_enqueue_scripts()

wordlift_admin_enqueue_scripts() 

Register additional scripts for the admin UI.

wordlift_admin_referencing_posts_meta_box_content()

wordlift_admin_referencing_posts_meta_box_content(\WP_Post  $post) 

Displays the meta box contents (called by *add_meta_box* callback).

Parameters

\WP_Post $post

The current post.

wordlift_ajax_add_entity()

wordlift_ajax_add_entity() 

wordlift_ajax_redirect()

wordlift_ajax_redirect() 

wordlift_ajax_search()

wordlift_ajax_search() 

wordlift_allowed_html()

wordlift_allowed_html(array  $allowedtags, string  $context) : array

Hooked to *wp_kses_allowed_html* filter, adds microdata attributes.

Parameters

array $allowedtags

The array with the currently configured elements and attributes.

string $context

The context.

Returns

array —

An array which contains allowed microdata attributes.

wordlift_buttonhooks()

wordlift_buttonhooks() 

Add buttons hook for the TinyMCE editor. This method is called by the WP init hook.

wordlift_esc_sparql()

wordlift_esc_sparql(string  $string) : string

Escape a sparql literal.

Parameters

string $string

The string to escape.

Returns

string —

The escaped string.

wordlift_filter_tiny_mce_before_init()

wordlift_filter_tiny_mce_before_init(  $options) : mixed

Set TinyMCE options, in particular enable microdata tagging.

Parameters

$options

Returns

mixed

wordlift_geo_widget_html()

wordlift_geo_widget_html(  $width,   $height,   $latitude,   $longitude,   $zoom,   $content) 

Parameters

$width
$height
$latitude
$longitude
$zoom
$content

wordlift_geo_widget_shortcode()

wordlift_geo_widget_shortcode(  $atts,   $content = null) 

Parameters

$atts
$content

wordlift_indepth_add_schema_org_tagging_to_content()

wordlift_indepth_add_schema_org_tagging_to_content(  $content) 

Parameters

$content

wordlift_indepth_article_end()

wordlift_indepth_article_end() 

wordlift_indepth_article_head()

wordlift_indepth_article_head() 

wordlift_indepth_article_init()

wordlift_indepth_article_init() 

wordlift_indepth_article_is_single()

wordlift_indepth_article_is_single() 

wordlift_indepth_article_ob_callback()

wordlift_indepth_article_ob_callback(  $content) 

Parameters

$content

wordlift_indepth_article_start()

wordlift_indepth_article_start() 

wordlift_indepth_end_buffering()

wordlift_indepth_end_buffering() 

wordlift_indepth_start_buffering()

wordlift_indepth_start_buffering(  $type) 

Parameters

$type

wordlift_mce_css()

wordlift_mce_css(  $mce_css) : \The

Add WordLift custom styles to the TinyMCE editor.

Parameters

$mce_css

The existing comma-separated list of styles.

Returns

\The —

updated list of styles, including the custom style provided by WordLift.

wordlift_override_content_type_header()

wordlift_override_content_type_header(string  $type) : string

Change the response content type.

Parameters

string $type

The preset content type.

Returns

string —

The new content type.

wordlift_register_buttons()

wordlift_register_buttons(array  $buttons) : array

Register the TinyMCE buttons. This method is called by the WP mce_buttons hook.

Parameters

array $buttons

The existing buttons array.

Returns

array —

The modified buttons array.

wordlift_register_shortcode_navigator()

wordlift_register_shortcode_navigator() 

Shortcode to print the in-post navigator

wordlift_register_shortcode_related_posts()

wordlift_register_shortcode_related_posts() 

wordlift_register_tinymce_javascript()

wordlift_register_tinymce_javascript(array  $plugin_array) : array

Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook.

Parameters

array $plugin_array

The existing plugins array.

Returns

array —

The modified plugins array.

wordlift_reindex_triple_store()

wordlift_reindex_triple_store() 

Reindex Redlink triple store, enabling local entities to be found in future analyses.

wordlift_save_post()

wordlift_save_post(  $post_id) 

Parameters

$post_id

wordlift_save_post_and_related_entities()

wordlift_save_post_and_related_entities(  $post_id) 

Parameters

$post_id

wordlift_shortcode_get_related_posts()

wordlift_shortcode_get_related_posts(integer  $post_id, string  $post_status = 'published') : array

Get an array of posts related to the specified post id.

Parameters

integer $post_id

The post ID.

string $post_status

The post status, by default 'published'.

Returns

array —

An array of related posts (or an empty array).

wordlift_shortcode_navigator()

wordlift_shortcode_navigator() : string

Execute the [wl_navigator] shortcode.

Returns

string —

HTML of the navigator.

wordlift_shortcode_navigator_populate()

wordlift_shortcode_navigator_populate(integer  $post_id) : Array

Get list of posts that will populate the navigator.

Parameters

integer $post_id

Id of the post.

Returns

Array —

List of posts organized in this way: Array[0] = Array( id_of_recommended_post_from_the_same_category, null ) Array[n] = Array( id_of_other_post_recommended_from_entity, id_of_that_entity )

wordlift_shortcode_related_posts()

wordlift_shortcode_related_posts() 

wordlift_timeline_widget_html()

wordlift_timeline_widget_html(  $element_id,   $url,   $iframe_url,   $width = '100%',   $height = '400',   $language = 'en') : string

Produces the HTML code for the timeline widget.

Parameters

$element_id
$url
$iframe_url
$width
$height
$language

Returns

string —

The HTML code.

wordlift_timeline_widget_shortcode()

wordlift_timeline_widget_shortcode(array  $atts, string|null  $content = null) : string

Process the *wl_timeline* shortcode, producing HTML code to embed the control.

Parameters

array $atts

The configuration attributes.

string|null $content

The shortcode inner content, or null if not existing.

Returns

string —

The widget HTML code.