Changeset 1404847
- Timestamp:
- 04/26/2016 06:50:22 PM (10 years ago)
- Location:
- drafty-in-here/trunk
- Files:
-
- 2 added
- 2 deleted
- 14 edited
-
. (modified) (2 props)
-
.gitignore (deleted)
-
CONTRIBUTING.md (added)
-
README.md (added)
-
Repositories/Admin/Admin.php (modified) (2 diffs)
-
Repositories/Admin/AdminInterface.php (modified) (1 diff)
-
Repositories/Email/Email.php (modified) (3 diffs)
-
Repositories/Email/EmailInterface.php (modified) (1 diff)
-
Repositories/Options/Options.php (modified) (1 diff)
-
Repositories/Options/OptionsInterface.php (modified) (1 diff)
-
Repositories/Scheduler/Scheduler.php (modified) (1 diff)
-
Repositories/Scheduler/SchedulerInterface.php (modified) (1 diff)
-
composer.json (deleted)
-
drafty-in-here.php (modified) (1 diff)
-
drafty-main.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/composer/LICENSE (modified) (1 diff)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
drafty-in-here/trunk
-
Property
svn:global-ignores
set to
.git
tests
-
Property
svn:ignore
set to
*.sublime-project
*.sublime-workspace
.gitignore
.travis.yml
phpunit.xml.dist
-
Property
svn:global-ignores
set to
-
drafty-in-here/trunk/Repositories/Admin/Admin.php
r1392348 r1404847 1 <?php namespace Repositories\Admin;1 <?php namespace Drafty\Repositories\Admin; 2 2 3 3 use \Drafty_In_Here; 4 use Repositories\Scheduler\Scheduler;5 use Repositories\Options\Options;4 use Drafty\Repositories\Scheduler\Scheduler; 5 use Drafty\Repositories\Options\Options; 6 6 7 7 class Admin extends Drafty_In_Here implements AdminInterface … … 136 136 public function validate_basic_options_section($settings_array = array()) 137 137 { 138 if ( ! is_email( $settings_array['email_address'] ) ) {138 if ( empty($settings_array['email_address']) || ! is_email( $settings_array['email_address'] ) ) { 139 139 $settings_array['email_address'] = ''; 140 140 add_settings_error( 'email_address', 'invalid_email', __( 'Please enter a valid email address.', 'drafty-in-here' ), 'error' ); 141 141 } 142 142 143 if ( ! in_array( $settings_array['drafty_frequency'], array('never', 'hourly', 'daily', 'weekly') ) ) {143 if ( empty($settings_array['drafty_frequency']) || ! in_array( $settings_array['drafty_frequency'], array('never', 'hourly', 'daily', 'weekly') ) ) { 144 144 $settings_array['drafty_frequency'] = ''; 145 145 add_settings_error( 'email_address', 'invalid_email', __( 'Please select how often we send emails.', 'drafty-in-here' ), 'error' ); -
drafty-in-here/trunk/Repositories/Admin/AdminInterface.php
r1364715 r1404847 1 <?php namespace Repositories\Admin;1 <?php namespace Drafty\Repositories\Admin; 2 2 3 3 interface AdminInterface -
drafty-in-here/trunk/Repositories/Email/Email.php
r1364715 r1404847 1 <?php namespace Repositories\Email;1 <?php namespace Drafty\Repositories\Email; 2 2 3 3 use Repositories\Email\EmailerInterface; 4 use Drafty\Repositories\Email\EmailInterface; 4 5 5 6 class Email implements EmailInterface … … 58 59 { 59 60 self::buildMessage(); 60 if ( self::validate(self::$to, self::$subject, self::$message)) {61 if (true === self::validate(self::$to, self::$subject, self::$message)) { 61 62 return wp_mail(self::$to, self::$subject, self::$message, self::$headers); 62 63 } … … 71 72 * @param string $subject The subject of the email. 72 73 * @param string $message The content of the email. 73 * @return bool Weather validation passes.74 * @return bool|\WP_Error 74 75 */ 75 p rivatestatic function validate($to='', $subject='', $message='')76 public static function validate($to='', $subject='', $message='') 76 77 { 77 $valid = true;78 78 if (! is_email($to)) { 79 79 return new \WP_Error( 'drafty-email', __( "Can't send email because email is not valid.", 'drafty-in-here' ) ); 80 $valid = false;81 80 } 82 81 if (empty($subject)) { 83 82 return new \WP_Error( 'drafty-email', __( "Can't send email because there is no subject.", 'drafty-in-here' ) ); 84 $valid = false;85 83 } 86 84 if (empty($message)) { 87 85 return new \WP_Error( 'drafty-email', __( "Can't send email because there is no message.", 'drafty-in-here' ) ); 88 $valid = false;89 86 } 90 87 91 return $valid;88 return true; 92 89 } 93 90 -
drafty-in-here/trunk/Repositories/Email/EmailInterface.php
r1364715 r1404847 1 <?php namespace Repositories\Email;1 <?php namespace Drafty\Repositories\Email; 2 2 3 3 interface EmailInterface -
drafty-in-here/trunk/Repositories/Options/Options.php
r1392348 r1404847 1 <?php namespace Repositories\Options; 1 <?php namespace Drafty\Repositories\Options; 2 3 use Drafty\Repositories\Options\OptionsInterface; 2 4 3 5 class Options implements OptionsInterface -
drafty-in-here/trunk/Repositories/Options/OptionsInterface.php
r1364715 r1404847 1 <?php namespace Repositories\Options;1 <?php namespace Drafty\Repositories\Options; 2 2 3 3 interface OptionsInterface -
drafty-in-here/trunk/Repositories/Scheduler/Scheduler.php
r1394736 r1404847 1 <?php namespace Repositories\Scheduler;1 <?php namespace Drafty\Repositories\Scheduler; 2 2 3 use Repositories\Options\Options; 3 use Drafty\Repositories\Options\Options; 4 use Drafty\Repositories\Scheduler\SchedulerInterface; 4 5 5 6 class Scheduler implements SchedulerInterface -
drafty-in-here/trunk/Repositories/Scheduler/SchedulerInterface.php
r1364715 r1404847 1 <?php namespace Repositories\Scheduler;1 <?php namespace Drafty\Repositories\Scheduler; 2 2 3 3 interface SchedulerInterface -
drafty-in-here/trunk/drafty-in-here.php
r1394736 r1404847 2 2 /** 3 3 * Plugin Name: Drafty In Here 4 * Version: 1.1. 24 * Version: 1.1.3 5 5 * Plugin URI: https://wordpress.org/plugins/drafty-in-here/ 6 6 * Author: Aron Marriott-Smith <aron@atomace.com> -
drafty-in-here/trunk/drafty-main.php
r1392348 r1404847 11 11 */ 12 12 require_once 'vendor/autoload.php'; 13 use Repositories\Admin\Admin;14 use Repositories\Email\Email;15 use Repositories\Options\Options;16 use Repositories\Scheduler\Scheduler;13 use Drafty\Repositories\Admin\Admin; 14 use Drafty\Repositories\Email\Email; 15 use Drafty\Repositories\Options\Options; 16 use Drafty\Repositories\Scheduler\Scheduler; 17 17 18 18 … … 210 210 * 211 211 * Here we build up the email contents and pass it to our Email class. 212 * 212 * @todo: return a call to an event rather than boolean 213 * 213 214 * @param bool $test Weather we are testing the callback or not 214 215 * @return bool|void If no draft posts are found returns false … … 221 222 // we have no posts 222 223 if (false === $test) return false; 223 $posts=null; 224 } 225 226 $to = self::$options['email_address']; 227 $subject = __('You have drafts waiting to be published', 'drafty-in-here'); 228 $text = $this->build_message($posts, $test); 229 $html = nl2br($text); 230 231 return Email::to($to)->subject($subject)->text($text)->HTML($html)->send(); 224 $posts = null; 225 } 226 227 if ( $test || $posts) { 228 $to = self::$options['email_address']; 229 $subject = __('You have drafts waiting to be published', 'drafty-in-here'); 230 $text = $this->build_message($posts, $test); 231 $html = nl2br($text); 232 233 Email::to($to)->subject($subject)->text($text)->HTML($html)->send(); 234 235 return true; 236 } 237 238 return false; 232 239 } 233 240 -
drafty-in-here/trunk/readme.txt
r1394736 r1404847 2 2 Contributors: AronMS 3 3 Tags: productivity, focus, motivation, drafts, draft posts, notify, emails, drafty 4 Requires at least: 4. 04 Requires at least: 4.3 5 5 Tested up to: 4.5 6 Stable tag: 1.1. 26 Stable tag: 1.1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 78 78 = 1.1.2 = 79 79 * Fixed a bug which was causing a PHP fatal error in the drafty settings page. 80 = 1.1.3 = 81 * Fixed potential namespacing issue 82 * Several bug fixes identified while writing unit tests 80 83 81 84 -
drafty-in-here/trunk/vendor/composer/LICENSE
r1364715 r1404847 1 1 2 Copyright (c) 201 5Nils Adermann, Jordi Boggiano2 Copyright (c) 2016 Nils Adermann, Jordi Boggiano 3 3 4 4 Permission is hereby granted, free of charge, to any person obtaining a copy -
drafty-in-here/trunk/vendor/composer/autoload_psr4.php
r1392348 r1404847 7 7 8 8 return array( 9 ' Repositories\\' => array($baseDir . '/Repositories'),9 'Drafty\\Repositories\\' => array($baseDir . '/Repositories'), 10 10 );
Note: See TracChangeset
for help on using the changeset viewer.