User Tools

Site Tools


plugin:common

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
plugin:common [2020/06/06 20:58]
duncanc
plugin:common [2021/11/29 06:55] (current)
duncanc [Inline CSS styles]
Line 1: Line 1:
 +====== Common Plugin ======
  
 +---- plugin ----
 +description: Supporting classes required by some other plugins.
 +author     : Duncan Cameron
 +type       : 
 +lastupdate : 2020-06-06
 +compatible : phplist 3
 +depends    : php 5.6
 +conflicts 
 +similar    : 
 +tags       : 
 +
 +sourcerepo : https://github.com/bramley/phplist-plugin-common
 +donationurl: 
 +----
 +
 +This plugin provides support classes required by some other plugins. It also provides three pages which are added to the Config menu
 +
 +  * display the output of the phpinfo() function
 +  * display the config.php file (user id and passwords are removed)
 +  * display the contents of the php session
 +
 +The plugin also provides an option to inline CSS styles when phplist sends campaign emails.
 +
 +This plugin is now included with phplist, so you need to only enable it on the Manage Plugins page.
 +
 +
 +====== Installation ======
 +
 +See the README file on the GitHub page https://github.com/bramley/phplist-plugin-common for how to install the plugin.
 +
 +====== Inline CSS styles ======
 +The plugin provides an option to inline CSS styles when phplist builds the email content. This allows you to include <style> elements in the template for ease of maintenance, but those styles are added to the appropriate elements as style attributes when the email is built.
 +
 +Some email clients have limited or no support for <style> elements in an HTML email, so inlining styles helps to ensure that the final email can be displayed properly on a wider range of clients.
 +
 +For example, having a set of styles defined as
 +<code css>
 +<style type="text/css">
 +p { margin-bottom: 0.5em; font-size: 15px; line-height: 20px; color: rgb(102, 102, 102); font-family: Tahoma,Verdana,Arial,sans-serif;}
 +p.small { font-size: 13px; line-height: 18px;}
 +h2 { margin-bottom: 0.5em; font-size: 20px; line-height: 20px; color: rgb(0, 36, 75); font-family: Georgia,Times New Roman,Times,serif;}
 +h3 { margin-bottom: 0.5em; font-size: 16px; line-height: 20px; color: rgb(0, 36, 75); font-family: Georgia,Times New Roman,Times,serif;}
 +td { padding: 5px 10px 5px 10px; }
 +td.border { border-bottom: thin solid rgb(0, 36, 75);}
 +ul { font-size: 15px; color: rgb(102, 102, 102); font-family: Tahoma,Verdana,Arial,sans-serif;}
 +</style>
 +</code>
 +An h3 element in the template 
 +<HTML><h3>EPTUG public meeting</h3></HTML>
 +will be changed to
 +<HTML><h3 style="margin-bottom: 0.5em; font-size: 16px; line-height: 20px; color: rgb(0, 36, 75); font-family: Georgia,Times New Roman,Times,serif;">EPTUG public meeting</h3></HTML>
 +
 +There are two packages to do the inlining that are included in the plugin - PreMailer (https://github.com/crossjoin/PreMailer), and Emogrifier (https://github.com/MyIntervals/emogrifier). You can choose which package to use, or select not to inline CSS styles, in the Campaigns group of the Settings page.
 +{{ :plugin:inline_css.png?nolink |}}
 +
 +<WRAP center round info 60%>
 +This feature requires php 7.1 or later. You should not try to use this if you are running an earlier version of php.
 +</WRAP>
 +
 +
 +====== Logging database queries ======
 +
 +There is a mechanism to log the sql queries created by most plugins. This might be useful in debugging or to be able to run a query manually.
 +
 +Add the following to the config.php file (at the end of the file is ok)
 +
 +<code>$log_options = array(
 +    'threshold' => 'DEBUG',
 +    'classes' => array(
 +        'phpList\plugin\Common\DB' => true,
 +    ),
 +);</code>
 +
 +Now queries will be logged to a file in the phplist temporary directory, identfied by the ''$tmpdir'' variable in config.php. The file will be named for the current day, e.g. log_2018-07-13.txt.
 +
 +Alternatively you can specify a particular directory for the log file. The directory must be writeable by the web server process.
 +
 +<code>$log_options = array(
 +    'threshold' => 'DEBUG',
 +    'classes' => array(
 +        'phpList\plugin\Common\DB' => true,
 +    ),
 +    'dir' => '/path/to/directory',
 +);</code>
 +
 +Each query will be logged similar to this
 +
 +<code>[Fri 13 Jul 2018 10:09:15] [debug] phpList\plugin\Common\DB::_query, line 39
 +elapsed time 11.165857315063 ms
 +SELECT id, email, confirmed, blacklisted
 +            FROM phplist_user_user u
 +            LEFT JOIN phplist_listuser lu ON u.id = lu.userid
 +            WHERE userid is NULL
 +</code>
 +
 +To stop logging queries simply change DEBUG to OFF.
plugin/common.txt · Last modified: 2021/11/29 06:55 by duncanc

Resources
Contact Us

e: info@phplist.com

Boring Bit

phpList is a registered limited company

UK Company No. 07582966

VAT Registration 122 0788 37

© phpList 2016