WL_CONFIG_ANALYSIS_NAME
WL_CONFIG_ANALYSIS_NAME
Flow |
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 |
rl_execute_sparql_update_query(string $query, boolean $queue = WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING) : boolean
Execute a query on Redlink.
string | $query | The query to execute. |
boolean | $queue | Whether to queue the update. |
True if successful otherwise false.
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.
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(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.
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_permalink_html(string $html, integer $post_id, string $new_title, string $new_slug) : \The
Add custom buttons to the buttons below the post title.
string | $html | The current html. |
integer | $post_id | The post ID. |
string | $new_title | Optional. New title. |
string | $new_slug | Optional. New slug. |
enhanced html.
wl_admin_shortcode_buttons_register_tinymce_javascript(array $plugin_array) : array
Registers the WordLift shortcodes plugin in TinyMCE.
array | $plugin_array | An array of TinyMCE plugins. |
The TinyMCE plugins array including WordLift shortcodes plugin.
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.
string | $content | The content to analyze. |
Returns null on failure, or the WP_Error, or a WP_Response with the response.
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.
string | $schema_name | Slug or full uri of a schema property or type (es. 'location' or 'http://schema.org/location') |
The full schema uri (es. 'latitude' returns 'http://schema.org/latitude')
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.
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. |
The remote response.
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.
string | $parent_slug | The parent slug for the menu. |
string | $capability | The required capability to access the page. |
wl_configuration_get_query_select_url(string $output, string|null $dataset = null) : string
Get the URL to perform SELECT queries.
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. |
The URL to call to perform the SELECT query.
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.
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. |
The content with embedded 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.
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 |
The content with embedded microdata.
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 ).
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(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.
string | $meta_name | Name of the meta |
The complementary meta, if any, otherwise null.
wl_core_merge_old_related_with_new(integer $subject_id, string $relation, array $new_related_ids)
Update post meta with new related ids.
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(integer $subject_id, string $relation)
Reset relations between a post/entity and another ( A --> B ).
The complmentary relation is reset too ( B --> A ).
integer | $subject_id | The post ID. |
string | $relation | Name of the relation. |
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.
\WP_Post | $post | The current post. |
$info | Array The custom_field the method must manage. |
wl_entity_props_save_prop(integer $post_id, string $key, string $values, array $mappings)
Save the specified prop.
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(integer $entity_id = null) : mixed
Retrieve entity type custom fields
integer | $entity_id | id of the entity, if any |
if $entity_id was specified, return custom_fields for that entity's type. Otherwise returns all custom_fields
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.
string | $template | The template selected by WordPress. |
The template selected by this function.
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.
$child_term_custom_fields | Custom fields of the child entity type. |
|
$parent_term_ids | Array containing the ids of the parent types. |
Merged custom fields.
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.
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. |
if option value has changed, false if not or if update failed.
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.
integer | $parent_post_id | The parent post ID. |
string | $source_url | The source URL. |
A post instance or null if not found.
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.
$property_name | as defined by schema.org or WL internal constants |
containing constraint(s) or null (in case of error or no constraint).
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.
$property_name | as defined by schema.org or WL internal constants |
containing type(s) or null (in case of error or no types).
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.
integer | $entity_id | The entity ID. |
string | $field_name | Name of the meta (used for the 4W) |
An array of post IDs.
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.
integer | $entity_id | The entity ID. |
string | $field_name | Name of the meta |
An array of entity IDs related to the one specified.
wl_get_sparql_time(string $time) : string
Convert a time string to a SPARQL datetime.
string | $time | The time string (in 2014-03-03T08:15:55+00:00 format). |
A sparql dateTime string (e.g. "2014-03-03T08:15:55.000Z"^^http://www.w3.org/2001/XMLSchema#dateTime)
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.
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 |
The value or null if not found.
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.
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 |
A new graph if the property is a reference, or a value.
wl_linked_data_content_get_embedded_entities(string $content) : array
Get an array of entities from the *itemid* attributes embedded in the provided content.
string | $content | The content with itemid attributes. |
An array of entity posts.
wl_plugins_url( $url, $path, $plugin) : string
Change *plugins_url* response to return the correct path of WordLift files when working in development mode.
$url | The URL as set by the plugins_url method. |
|
$path | The request path. |
|
$plugin | The plugin folder. |
The URL.
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.
string | $parent_slug | The parent slug for the menu. |
string | $capability | The required capability to access the page. |
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.
array | $columns | An array of existing columns. |
The new array of columns.
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.
string | $column | The column name (as defined in wl_profiling_posts_columns). |
integer | $post_id | The post Id. |
wl_profiling_sparql_post_request(string $url, string $args, string $query, array $response)
Records the end of the execution of a query.
string | $url | The remote URL. |
string | $args | The request parameters. |
string | $query | The SPARQL query. |
array | $response | The response. |
wl_sanitize_uri_path(string $path, string $char = '_') : \The
Sanitizes an URI path by replacing the non allowed characters with an underscore.
string | $path | The path to sanitize. |
string | $char | The replacement character (by default an underscore). |
sanitized path.
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.
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. |
A post instance or null in case of failure.
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.
string | $url | The image remote URL. |
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( $property_name) : array
Retrieves the property expected type, according to the schema.org specifications, where:
$property_name | string Name of the property (e.g. name, for the http://schema.org/name property) |
of allowed types or NULL in case of property not found.
The following types are supported (defined as constants):
wl_schema_get_type_properties( $type_name) : array
Retrieves the list of supported properties for the specified type.
$type_name | string Name of the type (e.g. Type, for the http://schema.org/Type) |
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( $post_id) : array
Retrieves the entity types for the specified post ID, where
$post_id | numeric The numeric post ID. |
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( $post_id, $property_name) : array
Retrieves the value of the specified property for the entity, where
$post_id | numeric The numeric post ID. |
|
$property_name | string Name of the property (e.g. name, for the http://schema.org/name property). |
An array of values or NULL in case of no values (or error).
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.
$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) |
True if everything went ok, an error string otherwise.
wl_schema_set_value( $post_id, $property_name, $property_value) : boolean
Set the value for the specified property and post ID, where
$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. |
The method returns true if everything went ok, an error string otherwise.
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.
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(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.
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_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.
integer | $post_id | The entity post ID. |
integer | $depth | Max number of entities in output. |
array | $related | An existing array of related entities. |
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
array | $places | An array of place posts. |
An array of place posts.
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.
Note that any status to published is handled by the save post routines.
string | $new_status | The new post status |
string | $old_status | The old post status |
array | $post | An array with the post data |
wordlift_allowed_html(array $allowedtags, string $context) : array
Hooked to *wp_kses_allowed_html* filter, adds microdata attributes.
array | $allowedtags | The array with the currently configured elements and attributes. |
string | $context | The context. |
An array which contains allowed microdata attributes.
wordlift_allowed_post_tags()
Enable microdata schema.org tagging.
see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/
wordlift_shortcode_get_related_posts(integer $post_id, string $post_status = 'published') : array
Get an array of posts related to the specified post id.
integer | $post_id | The post ID. |
string | $post_status | The post status, by default 'published'. |
An array of related posts (or an empty array).
wordlift_shortcode_navigator_populate(integer $post_id) : Array
Get list of posts that will populate the navigator.
integer | $post_id | Id of the post. |
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_timeline_widget_html( $element_id, $url, $iframe_url, $width = '100%', $height = '400', $language = 'en') : string
Produces the HTML code for the timeline widget.
$element_id | ||
$url | ||
$iframe_url | ||
$width | ||
$height | ||
$language |
The HTML code.
wordlift_timeline_widget_shortcode(array $atts, string|null $content = null) : string
Process the *wl_timeline* shortcode, producing HTML code to embed the control.
array | $atts | The configuration attributes. |
string|null | $content | The shortcode inner content, or null if not existing. |
The widget HTML code.