Egenverk Lagom · Documentation

Reference

v0.33.2WP 6.5+PHP 7.4+Updated

Admin addresses

AddressWhat it opens
admin.php?page=egenverk-lagomOverview
admin.php?page=egenverk-lagom&tab=performancePerformance
admin.php?page=egenverk-lagom&tab=ordersOrder search
admin.php?page=egenverk-lagom&tab=appearanceAppearance
admin.php?page=egenverk-lagom&tab=advancedAdvanced, when it is on for you. tab=database and tab=assets lead here too.

tools.php?page=egenverk-lagom and tools.php?page=lagom lead to the overview.

Address parameters

ParameterWhat it does
?egenverk_lagom_skin=0Shows an admin page without the skin. ?lagom_skin=0 does the same.
?egenverk_lagom_assets=scanRecords the page's CSS and JS files. Needs the CSS and JS per page module on and an administrator.
?egenverk_lagom_assets=previewShows the page with the rules in preview, for administrators
?egenverk_lagom_assets=offTurns every rule off for one request

Constants in wp-config.php

ConstantWhat it does
EGENVERK_LAGOM_PSI_KEYAPI key for PageSpeed Insights. Takes precedence over a key saved on the page.
EGENVERK_LAGOM_RULES_OFFSet to true, it stops every plugin rule, whatever is saved
define( 'EGENVERK_LAGOM_PSI_KEY', 'your-api-key' );
define( 'EGENVERK_LAGOM_RULES_OFF', true );

The egenverk_lagom_order_search filter

Another plugin with an order index of its own can answer Lagom's fast order search, so the site does not need two indexes. The filter runs once per search term, only when Fast order search is on and someone searches the order list.

apply_filters( 'egenverk_lagom_order_search', null, array $query );
  • Return a list of order ids, newest first, to answer. Lagom removes duplicates and keeps at most 500.
  • An empty list means no orders match.
  • Return null to let Lagom look the term up itself. Do so also when your index cannot answer the whole term, so you never leave a partial list.

$query holds:

KeyValue
termThe trimmed search term
typeLagom's reading: order_id, email, transaction_id, phone, postcode, name, or ambiguous when the term can be read more than one way
candidatesFor ambiguous: reading and value, for example order_id and postcode for five digits. Otherwise empty.
limit500
lookupsLagom's full reading, one entry per reading

Each entry in lookups has type and value:

typevalueMore keys
order_idThe digits, without #—
emailLower case, without *prefix: whether the term ended with *
transactionUUID in lower case—
phone+46…—
postcodeNNN NN—
nameLower case, without *prefix (always true), first, last (empty for one word) and company

An example for a plugin with a table of its own, my_orders:

add_filter(
	'egenverk_lagom_order_search',
	function ( $ids, array $query ) {
		if ( null !== $ids ) {
			return $ids; // Someone already answered.
		}
		global $wpdb;
		$found = array();
		foreach ( $query['lookups'] as $lookup ) {
			if ( 'phone' !== $lookup['type'] ) {
				return null; // Let Lagom handle the whole term.
			}
			$found = array_merge(
				$found,
				$wpdb->get_col( $wpdb->prepare( "SELECT order_id FROM {$wpdb->prefix}my_orders WHERE phone_e164 = %s ORDER BY order_id DESC LIMIT %d", $lookup['value'], $query['limit'] ) )
			);
		}
		return $found;
	},
	10,
	2
);

REST routes

The coverage tool uses three routes under egenverk-lagom/v1. Every call needs a valid run key from the Advanced tab.

RouteMethodWhat it does
/coverage/planGETFetches the plan
/coverage/resultsPOSTUploads a coverage run
/coverage/verifyPOSTUploads a verification run

Scheduled jobs

Lagom's WP-Cron and Action Scheduler jobs are listed in Data and privacy. The Action Scheduler jobs sit in the egenverk-lagom group.

Resources