Open blobaugh opened 11 years ago
Note that you could also update the count_unread() and count_all() methods to call the create_connection() method with the site-wide options to skip one additional step during development. Make sure that you are not constantly recreating the connection though. Check to see if the connection is there first and if not create it.
Settings page: Add settings page in wp-admin
IMAP method in plugin controller
The get_imap method only connects once, and only when the cache is busted.
get_unread_count and get_total_count
both check cache first, then transparently connect to IMAP if needed.
I've also put in magic methods, so if a programmer accesses $inbox->unread_count
, the get method runs transparently, handling IMAP connection if needed.
For example:
$inbox = IS_Inbox_Status::get_instance();
// These output the same thing. Both lazy load the IMAP connection.
echo $inbox->get_unread_count();
echo $inbox->unread_count;
// Both of these return a connected and authenticated IMAP object.
$imap = $inbox->get_imap();
$imap = $inbox->imap;
We should have a config page for site-wide email settings so they do not need to be typed in every time.
http://codex.wordpress.org/Function_Reference/add_submenu_page
After the site-wide settings are available the widget needs to be updated to use them instead of requiring the user to enter them again. It should only ask for the widget title