Egenverk Lagom · Documentation
Reference
Admin addresses
| Address | What it opens |
|---|---|
admin.php?page=egenverk-lagom | Overview |
admin.php?page=egenverk-lagom&tab=performance | Performance |
admin.php?page=egenverk-lagom&tab=orders | Order search |
admin.php?page=egenverk-lagom&tab=appearance | Appearance |
admin.php?page=egenverk-lagom&tab=advanced | Advanced, 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
| Parameter | What it does |
|---|---|
?egenverk_lagom_skin=0 | Shows an admin page without the skin. ?lagom_skin=0 does the same. |
?egenverk_lagom_assets=scan | Records the page's CSS and JS files. Needs the CSS and JS per page module on and an administrator. |
?egenverk_lagom_assets=preview | Shows the page with the rules in preview, for administrators |
?egenverk_lagom_assets=off | Turns every rule off for one request |
Constants in wp-config.php
| Constant | What it does |
|---|---|
EGENVERK_LAGOM_PSI_KEY | API key for PageSpeed Insights. Takes precedence over a key saved on the page. |
EGENVERK_LAGOM_RULES_OFF | Set 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
nullto 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:
| Key | Value |
|---|---|
term | The trimmed search term |
type | Lagom's reading: order_id, email, transaction_id, phone, postcode, name, or ambiguous when the term can be read more than one way |
candidates | For ambiguous: reading and value, for example order_id and postcode for five digits. Otherwise empty. |
limit | 500 |
lookups | Lagom's full reading, one entry per reading |
Each entry in lookups has type and value:
type | value | More keys |
|---|---|---|
order_id | The digits, without # | — |
email | Lower case, without * | prefix: whether the term ended with * |
transaction | UUID in lower case | — |
phone | +46… | — |
postcode | NNN NN | — |
name | Lower 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.
| Route | Method | What it does |
|---|---|---|
/coverage/plan | GET | Fetches the plan |
/coverage/results | POST | Uploads a coverage run |
/coverage/verify | POST | Uploads 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.