Posted on Leave a comment

Lean and Mean PHP Email Class


( ! ) Notice: A non well formed numeric value encountered in /var/www/html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Call Stack
#TimeMemoryFunctionLocation
10.0002395944{main}( ).../index.php:0
20.0003396232require( '/var/www/html/wp-blog-header.php' ).../index.php:17
31.384912809544require_once( '/var/www/html/wp-includes/template-loader.php' ).../wp-blog-header.php:19
41.393012939616include( '/var/www/html/wp-content/themes/storefront/archive.php' ).../template-loader.php:98
51.473513361288get_template_part( ).../archive.php:25
61.473513361752locate_template( ).../general-template.php:168
71.473613361832load_template( ).../template.php:671
81.473713362120require( '/var/www/html/wp-content/themes/storefront/loop.php' ).../template.php:724
91.474413363624get_template_part( ).../loop.php:21
101.474413364096locate_template( ).../general-template.php:168
111.474513364176load_template( ).../template.php:671
121.474513370056require( '/var/www/html/wp-content/themes/storefront/content.php' ).../template.php:724
131.476213370808do_action( ).../content.php:19
141.476213371184WP_Hook->do_action( ).../plugin.php:478
151.476213371184WP_Hook->apply_filters( ).../class-wp-hook.php:312
161.480913375216storefront_post_content( ).../class-wp-hook.php:288
171.481113380384the_content( ).../storefront-template-functions.php:414
181.481113380984apply_filters( ).../post-template.php:253
191.481113381384WP_Hook->apply_filters( ).../plugin.php:206
201.487613389976CrayonWP::the_content( ).../class-wp-hook.php:288
211.491613521992CrayonHighlighter->output( ).../crayon_wp.class.php:703
221.499613551144CrayonFormatter::print_code( ).../crayon_highlighter.class.php:189

( ! ) Notice: A non well formed numeric value encountered in /var/www/html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Call Stack
#TimeMemoryFunctionLocation
10.0002395944{main}( ).../index.php:0
20.0003396232require( '/var/www/html/wp-blog-header.php' ).../index.php:17
31.384912809544require_once( '/var/www/html/wp-includes/template-loader.php' ).../wp-blog-header.php:19
41.393012939616include( '/var/www/html/wp-content/themes/storefront/archive.php' ).../template-loader.php:98
51.473513361288get_template_part( ).../archive.php:25
61.473513361752locate_template( ).../general-template.php:168
71.473613361832load_template( ).../template.php:671
81.473713362120require( '/var/www/html/wp-content/themes/storefront/loop.php' ).../template.php:724
91.474413363624get_template_part( ).../loop.php:21
101.474413364096locate_template( ).../general-template.php:168
111.474513364176load_template( ).../template.php:671
121.474513370056require( '/var/www/html/wp-content/themes/storefront/content.php' ).../template.php:724
131.476213370808do_action( ).../content.php:19
141.476213371184WP_Hook->do_action( ).../plugin.php:478
151.476213371184WP_Hook->apply_filters( ).../class-wp-hook.php:312
161.480913375216storefront_post_content( ).../class-wp-hook.php:288
171.481113380384the_content( ).../storefront-template-functions.php:414
181.481113380984apply_filters( ).../post-template.php:253
191.481113381384WP_Hook->apply_filters( ).../plugin.php:206
201.487613389976CrayonWP::the_content( ).../class-wp-hook.php:288
211.491613521992CrayonHighlighter->output( ).../crayon_wp.class.php:703
221.499613551144CrayonFormatter::print_code( ).../crayon_highlighter.class.php:189

Sending beautiful emails and attaching files with PHP can be a real hassle. I wrote this class as part of one of my side projects but I have recently used it as a teaching tool.

 

Posted on Leave a comment

Simple & Light PHP MySql Db Class


( ! ) Notice: A non well formed numeric value encountered in /var/www/html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Call Stack
#TimeMemoryFunctionLocation
10.0002395944{main}( ).../index.php:0
20.0003396232require( '/var/www/html/wp-blog-header.php' ).../index.php:17
31.384912809544require_once( '/var/www/html/wp-includes/template-loader.php' ).../wp-blog-header.php:19
41.393012939616include( '/var/www/html/wp-content/themes/storefront/archive.php' ).../template-loader.php:98
51.473513361288get_template_part( ).../archive.php:25
61.473513361752locate_template( ).../general-template.php:168
71.473613361832load_template( ).../template.php:671
81.473713362120require( '/var/www/html/wp-content/themes/storefront/loop.php' ).../template.php:724
91.506013566000get_template_part( ).../loop.php:21
101.506013566416locate_template( ).../general-template.php:168
111.506013566496load_template( ).../template.php:671
121.506113566744require( '/var/www/html/wp-content/themes/storefront/content.php' ).../template.php:724
131.507413566744do_action( ).../content.php:19
141.507413567120WP_Hook->do_action( ).../plugin.php:478
151.507413567120WP_Hook->apply_filters( ).../class-wp-hook.php:312
161.511113567496storefront_post_content( ).../class-wp-hook.php:288
171.511313567816the_content( ).../storefront-template-functions.php:414
181.511313568456apply_filters( ).../post-template.php:253
191.511313568856WP_Hook->apply_filters( ).../plugin.php:206
201.516313574136CrayonWP::the_content( ).../class-wp-hook.php:288
211.520413639368CrayonHighlighter->output( ).../crayon_wp.class.php:703
221.527113573328CrayonFormatter::print_code( ).../crayon_highlighter.class.php:189

( ! ) Notice: A non well formed numeric value encountered in /var/www/html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Call Stack
#TimeMemoryFunctionLocation
10.0002395944{main}( ).../index.php:0
20.0003396232require( '/var/www/html/wp-blog-header.php' ).../index.php:17
31.384912809544require_once( '/var/www/html/wp-includes/template-loader.php' ).../wp-blog-header.php:19
41.393012939616include( '/var/www/html/wp-content/themes/storefront/archive.php' ).../template-loader.php:98
51.473513361288get_template_part( ).../archive.php:25
61.473513361752locate_template( ).../general-template.php:168
71.473613361832load_template( ).../template.php:671
81.473713362120require( '/var/www/html/wp-content/themes/storefront/loop.php' ).../template.php:724
91.506013566000get_template_part( ).../loop.php:21
101.506013566416locate_template( ).../general-template.php:168
111.506013566496load_template( ).../template.php:671
121.506113566744require( '/var/www/html/wp-content/themes/storefront/content.php' ).../template.php:724
131.507413566744do_action( ).../content.php:19
141.507413567120WP_Hook->do_action( ).../plugin.php:478
151.507413567120WP_Hook->apply_filters( ).../class-wp-hook.php:312
161.511113567496storefront_post_content( ).../class-wp-hook.php:288
171.511313567816the_content( ).../storefront-template-functions.php:414
181.511313568456apply_filters( ).../post-template.php:253
191.511313568856WP_Hook->apply_filters( ).../plugin.php:206
201.516313574136CrayonWP::the_content( ).../class-wp-hook.php:288
211.520413639368CrayonHighlighter->output( ).../crayon_wp.class.php:703
221.527113573328CrayonFormatter::print_code( ).../crayon_highlighter.class.php:189

In my world, a PHP db class in essence should be a black box that handles the concerns of direct interaction with the MySql database and provides an abstract but functional alone basis for my model classes. The Db class must handle connecting to the database, and have inheritable static methods for executing both statements and queries. Also it must be tested before it is put into production. This code is tested and ready for production.

I originally wrote this class in a side-project of mine, and I’ve been using it recently as a teaching tool.