that enables horizontal scrolling.
*
* Only runs on singular post pages.
*
* Side effects: modifies post HTML content via the_content filter.
*
* @param string $content Post HTML content.
* @return string Modified content with tables wrapped.
*/
public function on_wrap_tables( string $content ): string {
if ( ! is_singular( 'post' ) ) {
return $content;
}
if ( '1' !== get_option( self::OPT_TABLE_BORDERS, '1' ) ) {
return $content;
}
// Wrap
elements not already inside a .prab-table-wrap.
return (string) preg_replace(
'/(?)\s*(])/i',
'$1',
(string) preg_replace(
'/<\/table>\s*/i',
'
',
$content
)
);
}
}