Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Logs_List_Table::format_human_readable_sentence( string $sentence = '' )
Contents
Parameters Parameters
- $sentence
-
(Optional)
Default value: ''
Return Return
(string)
Source Source
File: src/core/admin/class-logs-list-table.php
private function format_human_readable_sentence( $sentence = '' ) { // Check if it's not empty if ( ! empty( $sentence ) ) { // Wrap the sentence tokens with <span>s // This will convert convert // > input: "User views {{Homepage}}" // > output: "User views <span>Homepage</span>" // // Note: Consider that if a sentence token has an item token // like {{user_email}}, then the sentence would be // > input: "Send an email to {{{{user_email}}}}" // in that case, we want to keep the curly brackets from the item token, // and replace the curly brackets of the sentence token with the <span> // > output: "Send an email to <span>{{user_email}}</span>" $sentence = preg_replace( '(\{\{(.*?)\}\}(?=\s|$))', "<span class=\"uap-logs-table-item-name__token\">$1</span>", $sentence ); } // Return the sentence return $sentence; }
Expand full source code Collapse full source code View on Github