Add gravity flow demo

This commit is contained in:
Almira Krdzic
2018-06-28 10:02:07 +02:00
parent 1b5076bf2f
commit 12a5066018
1106 changed files with 317603 additions and 4720 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

View File

@@ -0,0 +1,43 @@
/* globals jQuery */
jQuery( document ).ready( function ( $ ) {
$( '.wp-mail-smtp-mailer input' ).click( function () {
if ( $( this ).prop( 'disabled' ) ) {
return false;
}
// Deselect the current mailer.
$( '.wp-mail-smtp-mailer' ).removeClass( 'active' );
// Select the correct one.
$( this ).parents( '.wp-mail-smtp-mailer' ).addClass( 'active' );
$( '.wp-mail-smtp-mailer-option' ).addClass( 'hidden' ).removeClass( 'active' );
$( '.wp-mail-smtp-mailer-option-' + $( this ).val() ).addClass( 'active' ).removeClass( 'hidden' );
} );
$( '.wp-mail-smtp-mailer-image' ).click( function () {
$( this ).parents( '.wp-mail-smtp-mailer' ).find( 'input' ).trigger( 'click' );
} );
$( '.wp-mail-smtp-setting-copy' ).click( function ( e ) {
e.preventDefault();
var target = $( '#' + $( this ).data( 'source_id' ) ).get(0);
target.select();
document.execCommand( 'Copy' );
} );
$( '#wp-mail-smtp-setting-smtp-auth' ).change( function() {
$( '#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass' ).toggleClass( 'inactive' );
});
$( '#wp-mail-smtp-setting-row-smtp-encryption input').change( function() {
if ( 'tls' === $(this).val() ) {
$(' #wp-mail-smtp-setting-row-smtp-autotls' ).addClass( 'inactive' );
} else {
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
}
} );
} );

View File

@@ -0,0 +1 @@
jQuery(document).ready(function(t){t(".wp-mail-smtp-mailer input").click(function(){if(t(this).prop("disabled"))return!1;t(".wp-mail-smtp-mailer").removeClass("active"),t(this).parents(".wp-mail-smtp-mailer").addClass("active"),t(".wp-mail-smtp-mailer-option").addClass("hidden").removeClass("active"),t(".wp-mail-smtp-mailer-option-"+t(this).val()).addClass("active").removeClass("hidden")}),t(".wp-mail-smtp-mailer-image").click(function(){t(this).parents(".wp-mail-smtp-mailer").find("input").trigger("click")}),t(".wp-mail-smtp-setting-copy").click(function(i){i.preventDefault(),t("#"+t(this).data("source_id")).get(0).select(),document.execCommand("Copy")}),t("#wp-mail-smtp-setting-smtp-auth").change(function(){t("#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass").toggleClass("inactive")}),t("#wp-mail-smtp-setting-row-smtp-encryption input").change(function(){"tls"===t(this).val()?t(" #wp-mail-smtp-setting-row-smtp-autotls").addClass("inactive"):t("#wp-mail-smtp-setting-row-smtp-autotls").removeClass("inactive")})});

View File

@@ -0,0 +1,450 @@
<?php
/**
* Awesome Motive Notifications
*
* This creates a custom post type (if it doesn't exist) and calls the API to
* retrieve notifications for this product.
*
* @package AwesomeMotive
* @author Benjamin Rojas
* @license GPL-2.0+
* @copyright Copyright (c) 2017, Retyp LLC
* @version 1.0.2
*/
class WPMS_AM_Notification {
/**
* The api url we are calling.
*
* @since 1.0.0
*
* @var string
*/
public $api_url = 'https://api.awesomemotive.com/v1/notification/';
/**
* A unique slug for this plugin.
* (Not the WordPress plugin slug)
*
* @since 1.0.0
*
* @var string
*/
public $plugin;
/**
* The current plugin version.
*
* @since 1.0.0
*
* @var string
*/
public $plugin_version;
/**
* Flag if a notice has been registered.
*
* @since 1.0.0
*
* @var bool
*/
public static $registered = false;
/**
* Construct.
*
* @since 1.0.0
*
* @param string $plugin The plugin slug.
* @param mixed $version The version of the plugin.
*/
public function __construct( $plugin = '', $version = 0 ) {
$this->plugin = $plugin;
$this->plugin_version = $version;
add_action( 'init', array( $this, 'custom_post_type' ) );
add_action( 'admin_init', array( $this, 'get_remote_notifications' ), 100 );
add_action( 'admin_notices', array( $this, 'display_notifications' ) );
add_action( 'wp_ajax_am_notification_dismiss', array( $this, 'dismiss_notification' ) );
}
/**
* Registers a custom post type.
*
* @since 1.0.0
*/
public function custom_post_type() {
register_post_type( 'amn_' . $this->plugin, array(
'label' => $this->plugin . ' Announcements',
'can_export' => false,
'supports' => false,
) );
}
/**
* Retrieve the remote notifications if the time has expired.
*
* @since 1.0.0
*/
public function get_remote_notifications() {
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
return;
}
$last_checked = get_option( '_amn_' . $this->plugin . '_last_checked', strtotime( '-1 week' ) );
if ( $last_checked < strtotime( 'today midnight' ) ) {
$plugin_notifications = $this->get_plugin_notifications( 1 );
$notification_id = null;
if ( ! empty( $plugin_notifications ) ) {
// Unset it from the array.
$notification = $plugin_notifications[0];
$notification_id = get_post_meta( $notification->ID, 'notification_id', true );
}
$response = wp_remote_retrieve_body( wp_remote_post( $this->api_url, array(
'body' => array(
'slug' => $this->plugin,
'version' => $this->plugin_version,
'last_notification' => $notification_id,
),
) ) );
$data = json_decode( $response );
if ( ! empty( $data->id ) ) {
$notifications = array();
foreach ( (array) $data->slugs as $slug ) {
$notifications = array_merge(
$notifications,
(array) get_posts(
array(
'post_type' => 'amn_' . $slug,
'post_status' => 'all',
'meta_key' => 'notification_id',
'meta_value' => $data->id,
)
)
);
}
if ( empty( $notifications ) ) {
$new_notification_id = wp_insert_post( array(
'post_content' => wp_kses_post( $data->content ),
'post_type' => 'amn_' . $this->plugin,
) );
update_post_meta( $new_notification_id, 'notification_id', absint( $data->id ) );
update_post_meta( $new_notification_id, 'type', sanitize_text_field( trim( $data->type ) ) );
update_post_meta( $new_notification_id, 'dismissable', (bool) $data->dismissible ? 1 : 0 );
update_post_meta( $new_notification_id, 'location', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->location ) : json_encode( $data->location ) );
update_post_meta( $new_notification_id, 'version', sanitize_text_field( trim( $data->version ) ) );
update_post_meta( $new_notification_id, 'viewed', 0 );
update_post_meta( $new_notification_id, 'expiration', $data->expiration ? absint( $data->expiration ) : false );
update_post_meta( $new_notification_id, 'plans', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->plans ) : json_encode( $data->plans ) );
}
}
// Possibly revoke notifications.
if ( ! empty( $data->revoked ) ) {
$this->revoke_notifications( $data->revoked );
}
// Set the option now so we can't run this again until after 24 hours.
update_option( '_amn_' . $this->plugin . '_last_checked', strtotime( 'today midnight' ) );
}
}
/**
* Get local plugin notifications that have already been set.
*
* @since 1.0.0
*
* @param integer $limit Set the limit for how many posts to retrieve.
* @param array $args Any top-level arguments to add to the array.
*
* @return WP_Post[] WP_Post that match the query.
*/
public function get_plugin_notifications( $limit = -1, $args = array() ) {
return get_posts(
array(
'posts_per_page' => $limit,
'post_type' => 'amn_' . $this->plugin,
) + $args
);
}
/**
* Display any notifications that should be displayed.
*
* @since 1.0.0
*/
public function display_notifications() {
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
return;
}
$plugin_notifications = $this->get_plugin_notifications( -1, array(
'post_status' => 'all',
'meta_key' => 'viewed',
'meta_value' => '0',
) );
$plugin_notifications = $this->validate_notifications( $plugin_notifications );
if ( ! empty( $plugin_notifications ) && ! self::$registered ) {
foreach ( $plugin_notifications as $notification ) {
$dismissable = get_post_meta( $notification->ID, 'dismissable', true );
$type = get_post_meta( $notification->ID, 'type', true );
?>
<div class="am-notification am-notification-<?php echo $notification->ID; ?> notice notice-<?php echo $type; ?><?php echo $dismissable ? ' is-dismissible' : ''; ?>">
<?php echo $notification->post_content; ?>
</div>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$(document).on('click', '.am-notification-<?php echo $notification->ID; ?> button.notice-dismiss', function (event) {
$.post(ajaxurl, {
action: 'am_notification_dismiss',
notification_id: '<?php echo $notification->ID; ?>'
});
});
});
</script>
<?php
}
self::$registered = true;
}
}
/**
* Validate the notifications before displaying them.
*
* @since 1.0.0
*
* @param array $plugin_notifications An array of plugin notifications.
*
* @return array A filtered array of plugin notifications.
*/
public function validate_notifications( $plugin_notifications ) {
global $pagenow;
foreach ( $plugin_notifications as $key => $notification ) {
// Location validation.
$location = (array) json_decode( get_post_meta( $notification->ID, 'location', true ) );
$continue = false;
if ( ! in_array( 'everywhere', $location, true ) ) {
if ( in_array( 'index.php', $location, true ) && 'index.php' === $pagenow ) {
$continue = true;
}
if ( in_array( 'plugins.php', $location, true ) && 'plugins.php' === $pagenow ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Plugin validation (OR conditional).
$plugins = (array) json_decode( get_post_meta( $notification->ID, 'plugins', true ) );
$continue = false;
if ( ! empty( $plugins ) ) {
foreach ( $plugins as $plugin ) {
if ( is_plugin_active( $plugin ) ) {
$continue = true;
}
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Theme validation.
$theme = get_post_meta( $notification->ID, 'theme', true );
$continue = (string) wp_get_theme() === $theme;
if ( ! empty( $theme ) && ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
// Version validation.
$version = get_post_meta( $notification->ID, 'version', true );
$continue = false;
if ( ! empty( $version ) ) {
if ( version_compare( $this->plugin_version, $version, '<=' ) ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Expiration validation.
$expiration = get_post_meta( $notification->ID, 'expiration', true );
$continue = false;
if ( ! empty( $expiration ) ) {
if ( $expiration > time() ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Plan validation.
$plans = (array) json_decode( get_post_meta( $notification->ID, 'plans', true ) );
$continue = false;
if ( ! empty( $plans ) ) {
$level = $this->get_plan_level();
if ( in_array( $level, $plans, true ) ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
}
return $plugin_notifications;
}
/**
* Grab the current plan level.
*
* @since 1.0.0
*
* @return string The current plan level.
*/
public function get_plan_level() {
// Prepare variables.
$key = '';
$level = '';
$option = false;
switch ( $this->plugin ) {
case 'wpforms' :
$option = get_option( 'wpforms_license' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'WPFORMS_LICENSE_KEY' ) ) {
$key = WPFORMS_LICENSE_KEY;
}
break;
case 'mi' :
$option = get_option( 'monsterinsights_license' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
$key = MONSTERINSIGHTS_LICENSE_KEY;
}
break;
case 'sol' :
$option = get_option( 'soliloquy' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'SOLILOQUY_LICENSE_KEY' ) ) {
$key = SOLILOQUY_LICENSE_KEY;
}
break;
case 'envira' :
$option = get_option( 'envira_gallery' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'ENVIRA_LICENSE_KEY' ) ) {
$key = ENVIRA_LICENSE_KEY;
}
break;
case 'om' :
$option = get_option( 'optin_monster_api' );
$key = is_array( $option ) && isset( $option['api']['apikey'] ) ? $option['api']['apikey'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'OPTINMONSTER_REST_API_LICENSE_KEY' ) ) {
$key = OPTINMONSTER_REST_API_LICENSE_KEY;
}
// If the key is still empty, check for the old legacy key.
if ( empty( $key ) ) {
$key = is_array( $option ) && isset( $option['api']['key'] ) ? $option['api']['key'] : '';
}
break;
}
// Possibly set the level to 'none' if the key is empty and no level has been set.
if ( empty( $key ) && empty( $level ) ) {
$level = 'none';
}
// Normalize the level.
switch ( $level ) {
case 'bronze' :
case 'personal' :
$level = 'basic';
break;
case 'silver' :
case 'multi' :
$level = 'plus';
break;
case 'gold' :
case 'developer' :
$level = 'pro';
break;
case 'platinum' :
case 'master' :
$level = 'ultimate';
break;
}
// Return the plan level.
return $level;
}
/**
* Dismiss the notification via AJAX.
*
* @since 1.0.0
*/
public function dismiss_notification() {
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
die;
}
$notification_id = intval( $_POST['notification_id'] );
update_post_meta( $notification_id, 'viewed', 1 );
die;
}
/**
* Revokes notifications.
*
* @since 1.0.0
*
* @param array $ids An array of notification IDs to revoke.
*/
public function revoke_notifications( $ids ) {
// Loop through each of the IDs and find the post that has it as meta.
foreach ( (array) $ids as $id ) {
$notifications = $this->get_plugin_notifications( -1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) );
if ( $notifications ) {
foreach ( $notifications as $notification ) {
update_post_meta( $notification->ID, 'viewed', 1 );
}
}
}
}
}

View File

@@ -0,0 +1,483 @@
# Copyright (C) 2018 WP Mail SMTP
# This file is distributed under the same license as the WP Mail SMTP package.
msgid ""
msgstr ""
"Project-Id-Version: WP Mail SMTP\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language-Team: WPForms <support@wpforms.com>\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SourceCharset: UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: wp_mail_smtp.php:251
msgid "Test mail to %s"
msgstr ""
#: wp_mail_smtp.php:252
msgid "This is a test email generated by the WP Mail SMTP WordPress plugin."
msgstr ""
#: wp_mail_smtp.php:268
msgid "Test Message Sent"
msgstr ""
#: wp_mail_smtp.php:269
msgid "The result was:"
msgstr ""
#: wp_mail_smtp.php:272
msgid "The full debugging output is shown below:"
msgstr ""
#: wp_mail_smtp.php:275
msgid "The SMTP debugging output is shown below:"
msgstr ""
#: wp_mail_smtp.php:242, wp_mail_smtp.php:616
msgid "Send Test"
msgstr ""
#: wp_mail_smtp.php:287, wp_mail_smtp.php:652
msgid "WP Mail SMTP Settings"
msgstr ""
#: wp_mail_smtp.php:296, src/Admin/Pages/Settings.php:58
msgid "From Email"
msgstr ""
#: wp_mail_smtp.php:303
msgid "You can specify the email address that emails should be sent from. If you leave this blank, the default email will be used."
msgstr ""
#: wp_mail_smtp.php:306
msgid "<strong>Please Note:</strong> You appear to be using a version of WordPress prior to 2.3. Please ignore the From Name field and instead enter Name&lt;email@domain.com&gt; in this field."
msgstr ""
#: wp_mail_smtp.php:315, src/Admin/Pages/Settings.php:85
msgid "From Name"
msgstr ""
#: wp_mail_smtp.php:321
msgid "You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress."
msgstr ""
#: wp_mail_smtp.php:330, wp_mail_smtp.php:335, src/Admin/Pages/Settings.php:109
msgid "Mailer"
msgstr ""
#: wp_mail_smtp.php:340
msgid "Send all WordPress emails via SMTP."
msgstr ""
#: wp_mail_smtp.php:344
msgid "Use the PHP mail() function to send emails."
msgstr ""
#: wp_mail_smtp.php:350
msgid "Use Pepipost SMTP to send emails."
msgstr ""
#: wp_mail_smtp.php:356
msgid "Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more %1$shere%2$s."
msgstr ""
#: wp_mail_smtp.php:371, wp_mail_smtp.php:376, src/Admin/Pages/Settings.php:142
msgid "Return Path"
msgstr ""
#: wp_mail_smtp.php:381, src/Admin/Pages/Settings.php:151
msgid "Set the return-path to match the From Email"
msgstr ""
#: wp_mail_smtp.php:385, src/Admin/Pages/Settings.php:154
msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
msgstr ""
#: wp_mail_smtp.php:395, wp_mail_smtp.php:400, src/Admin/Pages/Misc.php:55
msgid "Hide Announcements"
msgstr ""
#: wp_mail_smtp.php:405, src/Admin/Pages/Misc.php:62
msgid "Check this if you would like to hide plugin announcements and update details."
msgstr ""
#: wp_mail_smtp.php:413, wp_mail_smtp.php:513, wp_mail_smtp.php:589
msgid "Save Changes"
msgstr ""
#: wp_mail_smtp.php:418
msgid "SMTP Options"
msgstr ""
#: wp_mail_smtp.php:420
msgid "These options only apply if you have chosen to send mail by SMTP above."
msgstr ""
#: wp_mail_smtp.php:425, src/Providers/OptionsAbstract.php:126
msgid "SMTP Host"
msgstr ""
#: wp_mail_smtp.php:433, wp_mail_smtp.php:551, src/Providers/OptionsAbstract.php:140
msgid "SMTP Port"
msgstr ""
#: wp_mail_smtp.php:440, wp_mail_smtp.php:444, wp_mail_smtp.php:559, wp_mail_smtp.php:565, src/Providers/OptionsAbstract.php:154
msgid "Encryption"
msgstr ""
#: wp_mail_smtp.php:449, wp_mail_smtp.php:571
msgid "No encryption."
msgstr ""
#: wp_mail_smtp.php:454, wp_mail_smtp.php:576
msgid "Use SSL encryption."
msgstr ""
#: wp_mail_smtp.php:459, wp_mail_smtp.php:581
msgid "Use TLS encryption."
msgstr ""
#: wp_mail_smtp.php:462
msgid "TLS is not the same as STARTTLS. For most servers SSL is the recommended option."
msgstr ""
#: wp_mail_smtp.php:467, wp_mail_smtp.php:471, src/Providers/OptionsAbstract.php:216
msgid "Authentication"
msgstr ""
#: wp_mail_smtp.php:476
msgid "No: Do not use SMTP authentication."
msgstr ""
#: wp_mail_smtp.php:481
msgid "Yes: Use SMTP authentication."
msgstr ""
#: wp_mail_smtp.php:485
msgid "If this is set to no, the values below are ignored."
msgstr ""
#: wp_mail_smtp.php:492, wp_mail_smtp.php:535
msgid "Username"
msgstr ""
#: wp_mail_smtp.php:500, wp_mail_smtp.php:543
msgid "Password"
msgstr ""
#: wp_mail_smtp.php:506
msgid "This is in plain text because it must not be stored encrypted."
msgstr ""
#: wp_mail_smtp.php:520
msgid "Pepipost SMTP Options"
msgstr ""
#: wp_mail_smtp.php:526
msgid "You need to signup on %s to get the SMTP username/password."
msgstr ""
#: wp_mail_smtp.php:598, src/Admin/Pages/Test.php:49
msgid "Send a Test Email"
msgstr ""
#: wp_mail_smtp.php:606
msgid "To"
msgstr ""
#: wp_mail_smtp.php:610
msgid "Type an email address here and then click Send Test to generate a test email."
msgstr ""
#: wp_mail_smtp.php:652, src/Admin/Area.php:127
msgid "WP Mail SMTP"
msgstr ""
#: wp_mail_smtp.php:758, src/Admin/Area.php:370, src/Admin/Pages/Settings.php:26
msgid "Settings"
msgstr ""
#: src/Admin/Area.php:88
msgid "There was an error while processing the authentication request: %s. Please try again."
msgstr ""
#: src/Admin/Area.php:95
msgid "There was an error while processing the authentication request. Please try again."
msgstr ""
#: src/Admin/Area.php:102
msgid "There was an error while processing the authentication request. Please make sure that you have Client ID and Client Secret both valid and saved."
msgstr ""
#: src/Admin/Area.php:111
msgid "You have successfully linked the current site with your Google API project. Now you can start sending emails through Google."
msgstr ""
#: src/Admin/Area.php:126
msgid "WP Mail SMTP Options"
msgstr ""
#: src/Admin/Area.php:199
msgid "Please rate <strong>WP Mail SMTP</strong> <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href=\"%2$s\" target=\"_blank\">WordPress.org</a> to help us spread the word. Thank you from the WP Mail SMTP team!"
msgstr ""
#: src/Providers/OptionsAbstract.php:164
msgid "None"
msgstr ""
#: src/Providers/OptionsAbstract.php:173
msgid "SSL"
msgstr ""
#: src/Providers/OptionsAbstract.php:182
msgid "TLS"
msgstr ""
#: src/Providers/OptionsAbstract.php:186
msgid "For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS."
msgstr ""
#: src/Providers/OptionsAbstract.php:194
msgid "Auto TLS"
msgstr ""
#: src/Providers/OptionsAbstract.php:204, src/Providers/OptionsAbstract.php:226
msgid "On"
msgstr ""
#: src/Providers/OptionsAbstract.php:205, src/Providers/OptionsAbstract.php:227
msgid "Off"
msgstr ""
#: src/Providers/OptionsAbstract.php:208
msgid "By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled."
msgstr ""
#: src/Providers/OptionsAbstract.php:235
msgid "SMTP Username"
msgstr ""
#: src/Providers/OptionsAbstract.php:249
msgid "SMTP Password"
msgstr ""
#: src/Providers/OptionsAbstract.php:263
msgid "The password is stored in plain text. We highly recommend you setup your password in your WordPress configuration file for improved security; to do this add the lines below to your %s file."
msgstr ""
#: src/Providers/OptionsAbstract.php:300
msgid "%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one."
msgstr ""
#: src/Providers/OptionsAbstract.php:307
msgid "Meanwhile you can switch to the \"Other SMTP\" Mailer option."
msgstr ""
#: src/Admin/Pages/Misc.php:24
msgid "Misc"
msgstr ""
#: src/Admin/Pages/Misc.php:48
msgid "General"
msgstr ""
#: src/Admin/Pages/Misc.php:67, src/Admin/Pages/Settings.php:185
msgid "Save Settings"
msgstr ""
#: src/Admin/Pages/Misc.php:95, src/Admin/Pages/Settings.php:251
msgid "Settings were successfully saved."
msgstr ""
#: src/Admin/Pages/Settings.php:51
msgid "Mail"
msgstr ""
#: src/Admin/Pages/Settings.php:67
msgid "You can specify the email address that emails should be sent from."
msgstr ""
#: src/Admin/Pages/Settings.php:71
msgid "If you leave this blank, the default one will be used: %s."
msgstr ""
#: src/Admin/Pages/Settings.php:77
msgid "Please note if you are sending using an email provider (Gmail, Yahoo, Hotmail, Outlook.com, etc) this setting should be your email address for that account."
msgstr ""
#: src/Admin/Pages/Settings.php:94
msgid "You can specify the name that emails should be sent from."
msgstr ""
#: src/Admin/Pages/Settings.php:98
msgid "If you leave this blank, the emails will be sent from %s."
msgstr ""
#: src/Admin/Pages/Settings.php:155
msgid "If unchecked bounce messages may be lost."
msgstr ""
#: src/Admin/Pages/Test.php:27
msgid "Email Test"
msgstr ""
#: src/Admin/Pages/Test.php:56
msgid "Send To"
msgstr ""
#: src/Admin/Pages/Test.php:61
msgid "Type an email address here and then click a button below to generate a test email."
msgstr ""
#: src/Admin/Pages/Test.php:67
msgid "Send Email"
msgstr ""
#: src/Admin/Pages/Test.php:87
msgid "Test failed. Please use a valid email address and try to resend the test email."
msgstr ""
#: src/Admin/Pages/Test.php:111
msgid "Test email to %s"
msgstr ""
#: src/Admin/Pages/Test.php:114
msgid "This email was sent by %s mailer, and generated by the WP Mail SMTP WordPress plugin."
msgstr ""
#: src/Admin/Pages/Test.php:127
msgid "Your email was sent successfully!"
msgstr ""
#: src/Admin/Pages/Test.php:134
msgid "There was a problem while sending a test email. Related debugging output is shown below:"
msgstr ""
#: src/Admin/Pages/Test.php:136
msgid "Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues."
msgstr ""
#: src/Providers/Gmail/Options.php:25
msgid "Gmail"
msgstr ""
#: src/Providers/Gmail/Options.php:29
msgid "Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our %1$sGmail documentation%2$s to learn how to configure Gmail or G Suite."
msgstr ""
#: src/Providers/Gmail/Options.php:63
msgid "Client ID"
msgstr ""
#: src/Providers/Gmail/Options.php:77
msgid "Client Secret"
msgstr ""
#: src/Providers/Gmail/Options.php:91
msgid "Authorized redirect URI"
msgstr ""
#: src/Providers/Gmail/Options.php:99
msgid "Copy URL to clipboard"
msgstr ""
#: src/Providers/Gmail/Options.php:104
msgid "This is the path on your site that you will be redirected to after you have authenticated with Google."
msgstr ""
#: src/Providers/Gmail/Options.php:106
msgid "You need to copy this URL into \"Authorized redirect URIs\" field for you web application on Google APIs site for your project there."
msgstr ""
#: src/Providers/Gmail/Options.php:116
msgid "Authorize"
msgstr ""
#: src/Providers/Gmail/Options.php:120
msgid "Allow plugin to send emails using your Google account"
msgstr ""
#: src/Providers/Gmail/Options.php:123
msgid "Click the button above to confirm authorization."
msgstr ""
#: src/Providers/Mail/Options.php:25
msgid "Default (none)"
msgstr ""
#: src/Providers/Mail/Options.php:37
msgid "You currently have the native WordPress option selected. Please select any other Mailer option above to continue the setup."
msgstr ""
#: src/Providers/Mailgun/Options.php:25
msgid "Mailgun"
msgstr ""
#: src/Providers/Mailgun/Options.php:29
msgid "%1$sMailgun%2$s is one of the leading transactional email services trusted by over 10,000 website and application developers. They provide users 10,000 free emails per month.<br><br>Read our %3$sMailgun documentation%4$s to learn how to configure Mailgun and improve your email deliverability."
msgstr ""
#: src/Providers/Mailgun/Options.php:57
msgid "Private API Key"
msgstr ""
#: src/Providers/Mailgun/Options.php:69
msgid "Follow this link to get an API Key from Mailgun: %s."
msgstr ""
#: src/Providers/Mailgun/Options.php:71
msgid "Get a Private API Key"
msgstr ""
#: src/Providers/Mailgun/Options.php:82
msgid "Domain Name"
msgstr ""
#: src/Providers/Mailgun/Options.php:94
msgid "Follow this link to get a Domain Name from Mailgun: %s."
msgstr ""
#: src/Providers/Mailgun/Options.php:96
msgid "Get a Domain Name"
msgstr ""
#: src/Providers/Pepipost/Options.php:25
msgid "Pepipost"
msgstr ""
#: src/Providers/Sendgrid/Options.php:25
msgid "SendGrid"
msgstr ""
#: src/Providers/Sendgrid/Options.php:29
msgid "%1$sSendGrid%2$s is one of the leading transactional email services, sending over 35 billion emails every month. They provide users 100 free emails per month.<br><br>Read our %3$sSendGrid documentation%4$s to learn how to set up SendGrid and improve your email deliverability."
msgstr ""
#: src/Providers/Sendgrid/Options.php:57
msgid "API Key"
msgstr ""
#: src/Providers/Sendgrid/Options.php:69
msgid "Follow this link to get an API Key from SendGrid: %s."
msgstr ""
#: src/Providers/Sendgrid/Options.php:71
msgid "Create API Key"
msgstr ""
#: src/Providers/Sendgrid/Options.php:79
msgid "To send emails you will need only a %s access level for this API key."
msgstr ""
#: src/Providers/SMTP/Options.php:25
msgid "Other SMTP"
msgstr ""
#: src/Providers/SMTP/Options.php:29
msgid "Use the SMTP details provided by your hosting provider or email service.<br><br>To see recommended settings for the popular services as well as troubleshooting tips, check out our %1$sSMTP documentation%2$s."
msgstr ""

View File

@@ -0,0 +1,366 @@
=== WP Mail SMTP by WPForms ===
Contributors: wpforms, jaredatch, smub, slaFFik
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, wp smtp
Requires at least: 3.6
Tested up to: 4.9
Stable tag: trunk
Requires PHP: 5.3
The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 700k sites.
== Description ==
= WordPress Mail SMTP Plugin =
Having problems with your WordPress site not sending emails? You're not alone. Over 700,000 websites use WP Mail SMTP to fix their email deliverability issues.
WP Mail SMTP fixes your email deliverability by reconfiguring the wp_mail() PHP function to use a proper SMTP provider.
= What is SMTP? =
SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. SMTP helps increase email deliverability by using proper authentication.
Popular email clients like Gmail, Yahoo, Outlook, etc are constantly improving their services to reduce email spam. One of the things their spam tools look for is whether an email is originating from the location it claims to be originating from.
If the proper authentication isn't there, then the emails either go in your SPAM folder or worst not get delivered at all.
This is a problem for a lot of WordPress sites because by default, WordPress uses the PHP mail function to send emails generated by WordPress or any contact form plugin like <a href="https://wpforms.com/" rel="friend">WPForms</a>.
The issue is that most <a href"http://www.wpbeginner.com/wordpress-hosting/" rel="friend">WordPress hosting companies</a> don't have their servers properly configured for sending PHP emails.
The combination of two causes your WordPress emails to not get delivered.
= How does WP Mail SMTP work? =
WP Mail SMTP plugin allows you to easily reconfigure the wp_mail() function to use a trusted SMTP provider.
This helps you fix all WordPress not sending email issues.
WP Mail SMTP plugin includes four different SMTP setup options:
1. Mailgun SMTP
2. SendGrid SMTP
3. Gmail SMTP
4. All Other SMTP
For all options, you can specify the "from name" and "email address" for outgoing emails.
Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
= Mailgun SMTP =
Mailgun SMTP is a popular SMTP service provider that allows you to send large quantities of emails. They allow you to send your first 10,000 emails for free every month.
WP Mail SMTP plugin offers a native integration with MailGun. All you have to do is connect your Mailgun account, and you will improve your email deliverability.
Read our <a href="https://wpforms.com/how-to-send-wordpress-emails-with-mailgun/" rel="friend">Mailgun documentation</a> for more details.
= Gmail SMTP =
Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or G Suite account for SMTP emails.
This allows you to use your <a href="http://www.wpbeginner.com/beginners-guide/how-to-setup-a-professional-email-address-with-gmail-and-google-apps/" rel="friend">professional email address</a> and improve email deliverability.
Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticate your Google account, keeping your login information 100% secure.
Read our <a href="https://wpforms.com/how-to-securely-send-wordpress-emails-using-gmail-smtp/" rel="friend">Gmail documentation</a> for more details.
= SendGrid SMTP =
SendGrid has a free SMTP plan that you can use to send up to 100 emails per day. With our native SendGrid SMTP integration, you can easily and securely set up SendGrid SMTP on your WordPress site.
Read our <a href="https://wpforms.com/fix-wordpress-email-notifications-with-sendgrid/" rel="friend">SendGrid documentation</a> for more details.
= Other SMTP =
WP Mail SMTP plugin also works with all major email services such as Gmail, Yahoo, Outlook, Microsoft Live, and any other email sending service that offers SMTP.
You can set the following options:
* Specify an SMTP host.
* Specify an SMTP port.
* Choose SSL / TLS encryption.
* Choose to use SMTP authentication or not.
* Specify an SMTP username and password.
WP Mail SMTP also gives you the option to insert your password in your wp-config.php file, so it's not visible in your WordPress settings.
To see recommended settings for the popular services as well as troubleshooting tips, check out our <a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" rel="friend">SMTP documentation</a>.
We hope that you find WP Mail SMTP plugin helpful.
= Credits =
WP Mail SMTP plugin was originally created by Callum Macdonald. It is now owned and maintained by the team behind <a href="https://wpforms.com/" rel="friend">WPForms</a> - the best drag & drop form builder for WordPress.
You can try the <a href="https://wordpress.org/plugins/wpforms-lite/" rel="friend">free version of WPForms plugin</a> to see why it's the best in the market.
= What's Next =
If you like this plugin, then please consider checking out our other popular plugins:
* <a href="http://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a> - Get More Email Subscribers
* <a href="https://www.monsterinsights.com/" rel="friend" title="MonsterInsights">MonsterInsights</a> - Best Google Analytics Plugin for WordPress
Visit <a href="http://www.wpbeginner.com/" rel="friend" title="WPBeginner">WPBeginner</a> to learn from our <a href="http://www.wpbeginner.com/category/wp-tutorials/" rel="friend" title="WordPress Tutorials">WordPress Tutorials</a> and find out about other <a href="http://www.wpbeginner.com/category/plugins/" rel="friend" title="Best WordPress Plugins">best WordPress plugins</a>.
== Installation ==
1. Install WP Mail SMTP by WPForms either via the WordPress.org plugin repository or by uploading the files to your server. (See instructions on <a href="http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" rel="friend">how to install a WordPress plugin</a>)
2. Activate WP Mail SMTP by WPForms.
3. Navigate to the Settings area of WP Mail SMTP in the WordPress admin.
4. Choose your SMTP option (Mailgun SMTP, SendGrid SMTP, Gmail SMTP, or Other SMTP) and follow the instructions to set it up.
5. Want to support us? Consider trying <a href="https://wpforms.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion" rel="friend" title="WPForms">WPForms Pro</a> - the best WordPress contact form plugin!
== Frequently Asked Questions ==
= Can I use this plugin to send email via Gmail, G Suite, Outlook.com, Office 365, Hotmail, Yahoo, or AOL SMTP? =
Yes! We have extensive documentation that covers setting up SMTP most popular email services.
<a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" rel="friend">Read our docs</a> to see the correct SMTP settings for each service.
= Help! I need support or have an issue. =
Please read <a href="https://wordpress.org/support/topic/wp-mail-smtp-support-policy/">our support policy</a> for more information.
= I found a bug, now what? =
If you've stumbled upon a bug, the best place to report it is in the <a href="https://github.com/awesomemotive/wp-mail-smtp">WP Mail SMTP GitHub repository</a>. GitHub is where the plugin is actively developed, and posting there will get your issue quickly seen by our developers (myself and Slava). Once posted, we'll review your bug report and triage the bug. When creating an issue, the more details you can add to your report, the faster the bug can be solved.
= Can you add feature x, y or z to the plugin? =
Short answer: maybe.
By all means please contact us to discuss features or options you'd like to see added to the plugin. We can't guarantee to add all of them, but we will consider all sensible requests. We can be contacted here:
<a href="https://wpforms.com/contact/" rel="friend">https://wpforms.com/contact/</a>
== Screenshots ==
1. WP Mail SMTP Settings page
2. Gmail / G Suite settings
3. Mailgun settings
4. SendGrid settings
5. SMTP settings
6. Send a Test Email
== Changelog ==
= 1.2.5 - 2018-02-05 =
* Fixed: `Return path` can't be turned off.
* Fixed: `Authentication` sometimes can't be turned off.
* Fixed: `Auto TLS` sometimes can't be turned off.
* Fixed: BCC support for Gmail was broken.
* Fixed: Debug output improved to handle SELinux and grsecurity.
* Fixed: Strip slashes from plugin settings (useful for `From Name` option).
* Fixed: Change the way sanitization is done to prevent accidental removal of useful data.
* Fixed: Plugin activation will not overwrite settings back to defaults.
* Fixed: Properly set `Auto TLS` option on plugin activation.
* Fixed: Providers autoloading improved for certain Windows-based installs.
* Fixed: Use the proper path to load translations from plugin's `/languages` directory.
* Changed: Do not autoload on each page request plugin settings from WordPress options table.
* Changed: Do not autoload Pepipost classes unless it's saved as active mailer in settings.
= 1.2.4 - 2018-01-28 =
* Fixed: Improved escaping in debug reporting.
= 1.2.3 - 2018-01-22 =
* Fixed: Gmail tokens were reset after clicking Save Settings.
* Fixed: Slight typo in Gmail success message.
= 1.2.2 - 2017-12-27 =
* Fixed: Correctly handle Mailgun debug message for an incorrect api key.
* Fixed: Fatal error for Gmail and SMTP mailers with Nginx web-server (without Apache at all).
* Changed: Update X-Mailer emails header to show the real sender with a mailer and plugin version.
= 1.2.1 - 2017-12-21 =
* Fixed: Failed SMTP connections generate fatal errors.
= 1.2.0 - 2017-12-21 =
* Fixed: Decrease the factual minimum WordPress version from 3.9 to 3.6.
* Changed: Improve debug output for all mail providers.
= 1.1.0 - 2017-12-18 =
* Added: New option "Auto TLS" for SMTP mailer. Default is enabled. Migration routine for all sites.
* Changed: Improve debug output - clear styles and context-aware content.
* Changed: Better exceptions handling for Google authentication process.
* Changed: Do not sanitize passwords, api keys etc - as they may contain special characters in certain order and sanitization will break those values.
* Changed: Improve wording of some helpful texts inside plugin admin area.
* Fixed: Do not include certain files in dependency libraries that are not used by Google mailer. This should stop flagging plugin by Wordfence and VaultPress.
* Fixed: Constants usage is working now, to define the SMTP password, for example.
* Fixed: Notice for default mailer.
= 1.0.2 - 2017-12-12 =
* Fixed: PHPMailer using incorrect SMTPSecure value.
= 1.0.1 - 2017-12-12 =
* Fixed: Global POST processing conflict.
= 1.0.0 - 2017-12-12 =
* Added: Automatic migration tool to move options from older storage format to a new one.
* Added: Added Gmail & G Suite email provider integration - without your email and password.
* Added: Added SendGrid email provider integration - using the API key only.
* Added: Added Mailgun email provider integration - using the API key and configured domain only.
* Added: New compatibility mode - for PHP 5.2 old plugin will be loaded, for PHP 5.3 and higher - new version of admin area and new functionality.
* Changed: The new look of the admin area.
* Changed: SMTP password field now has "password" type.
* Changed: SMTP password field does not display real password at all when using constants in `wp-config.php` to define it.
* Changed: Escape properly all translations.
* Changed: More helpful test email content (with a mailer name).
= 0.11.2 - 2017-11-28 =
* Added: Setting to hide announcement feed.
* Changed: Announcement feed data.
= 0.11.1 - 2017-10-30 =
* Fixed: Older PHP compatibility fix.
= 0.11 - 2017-10-30 =
* Added: Helper description to Return Path option.
* Added: Filter `wp_mail_smtp_admin_test_email_smtp_debug` to increase the debug message verbosity.
* Added: PHP 5.2 notice.
* Added: Announcement feed.
* Changed: Localization fixes, proper locale name.
* Changed: Code style improvements and optimizations for both HTML and PHP.
* Changed: Inputs for emails now have a proper type `email`, instead of a generic `text`.
* Changed: Turn off `$phpmailer->SMTPAutoTLS` when `No encryption` option is set to prevent error while sending emails.
* Changed: Hide Pepipost for those who are not using it.
* Changed: WP CLI support improved.
= 0.10.1 =
* Addition of Pepipost and cleanup of admin page.
= 0.10.0 =
* Addition of Pepipost and cleanup of admin page.
= 0.9.6 =
* Minor security fix, sanitize test email address.
= 0.9.5 =
* Minor security fix, hat tip JD Grimes.
= 0.9.4 =
* Improvement to the test email function, very low priority update.
= 0.9.3 =
* Fixing reported issue with passing by reference. props Adam Conway
= 0.9.2 =
* Removing the deprecation notice.
= 0.9.1 =
* $phpmailer->language became protected in WP 3.2, no longer unset on debug output.
= 0.9.0 =
* Typo in the From email description.
* Removed changelog from plugin file, no need to duplicate it.
* Optionally set $phpmailer->Sender from from email, helps with sendmail / mail().
= 0.8.7 =
* Fix for a long standing bug that caused an error during plugin activation.
= 0.8.6 =
* The Settings link really does work this time, promise. Apologies for the unnecessary updates.
= 0.8.5 =
* Bugfix, the settings link on the Plugin page was broken by 0.8.4.
= 0.8.4 =
* Minor bugfix, remove use of esc_html() to improve backwards compatibility.
* Removed second options page menu props ovidiu.
= 0.8.3 =
* Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
* Add Settings link, props Mike Challis http://profiles.wordpress.org/MikeChallis/
= 0.8.2 =
* Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
= 0.8.1 =
* Internationalisation improvements.
= 0.8 =
* Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
= 0.7 =
* Added checks to only override the default from name / email
= 0.6 =
* Added additional SMTP debugging output
= 0.5.2 =
* Fixed a pre 2.3 bug to do with mail from
= 0.5.1 =
* Added a check to display a warning on versions prior to 2.3
= 0.5.0 =
* Upgraded to match 2.3 filters which add a second filter for from name
= 0.4.2 =
* Fixed a bug in 0.4.1 and added more debugging output
= 0.4.1 =
* Added $phpmailer->ErroInfo to the test mail output
= 0.4 =
* Added the test email feature and cleaned up some other bits and pieces
= 0.3.2 =
* Changed to use register_activation_hook for greater compatability
= 0.3.1 =
* Added readme for WP-Plugins.org compatability
= 0.3 =
* Various bugfixes and added From options
= 0.2 =
* Reworked approach as suggested by westi, added options page
= 0.1 =
* Initial approach, copying the wp_mail function and replacing it
== Upgrade Notice ==
= 0.10.1 =
Addition of Pepipost and cleanup of admin page.
= 0.10.0 =
Addition of Pepipost and cleanup of admin page.
= 0.9.6 =
Minor security fix, sanitize test email address.
= 0.9.5 =
Minor security fix, hat tip JD Grimes.
= 0.9.4 =
Improvement to the test email function, very low priority update.
= 0.9.3 =
Fixing reported issue with passing by reference.
= 0.9.2 =
Removing the deprecation notice.
= 0.9.1 =
Test mail functionality was broken on upgrade to 3.2, now restored.
= 0.9.0 =
Low priority upgrade. Improves the appearance of the options page.
= 0.8.7 =
Very low priority update. Fixes a bug that causes a spurious error during activation.
= 0.8.6 =
Low priority update. The Settings link was still broken in 0.8.5.
= 0.8.5 =
Minor bugfix correcting the Settings link bug introduced in 0.8.4. Very low priority update.
= 0.8.4 =
Minor bugfix for users using constants. Another very low priority upgrade. Apologies for the version creep.
= 0.8.3 =
Minor bugfix for users using constants. Very low priority upgrade.

View File

@@ -0,0 +1,452 @@
<?php
namespace WPMailSMTP;
/**
* Awesome Motive Notifications
*
* This creates a custom post type (if it doesn't exist) and calls the API to
* retrieve notifications for this product.
*
* @package AwesomeMotive
* @author Benjamin Rojas
* @license GPL-2.0+
* @copyright Copyright (c) 2017, Retyp LLC
* @version 1.0.2
*/
class AM_Notification {
/**
* The api url we are calling.
*
* @since 1.0.0
*
* @var string
*/
public $api_url = 'https://api.awesomemotive.com/v1/notification/';
/**
* A unique slug for this plugin.
* (Not the WordPress plugin slug)
*
* @since 1.0.0
*
* @var string
*/
public $plugin;
/**
* The current plugin version.
*
* @since 1.0.0
*
* @var string
*/
public $plugin_version;
/**
* Flag if a notice has been registered.
*
* @since 1.0.0
*
* @var bool
*/
public static $registered = false;
/**
* Construct.
*
* @since 1.0.0
*
* @param string $plugin The plugin slug.
* @param mixed $version The version of the plugin.
*/
public function __construct( $plugin = '', $version = 0 ) {
$this->plugin = $plugin;
$this->plugin_version = $version;
add_action( 'init', array( $this, 'custom_post_type' ) );
add_action( 'admin_init', array( $this, 'get_remote_notifications' ), 100 );
add_action( 'admin_notices', array( $this, 'display_notifications' ) );
add_action( 'wp_ajax_am_notification_dismiss', array( $this, 'dismiss_notification' ) );
}
/**
* Registers a custom post type.
*
* @since 1.0.0
*/
public function custom_post_type() {
register_post_type( 'amn_' . $this->plugin, array(
'label' => $this->plugin . ' Announcements',
'can_export' => false,
'supports' => false,
) );
}
/**
* Retrieve the remote notifications if the time has expired.
*
* @since 1.0.0
*/
public function get_remote_notifications() {
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
return;
}
$last_checked = get_option( '_amn_' . $this->plugin . '_last_checked', strtotime( '-1 week' ) );
if ( $last_checked < strtotime( 'today midnight' ) ) {
$plugin_notifications = $this->get_plugin_notifications( 1 );
$notification_id = null;
if ( ! empty( $plugin_notifications ) ) {
// Unset it from the array.
$notification = $plugin_notifications[0];
$notification_id = get_post_meta( $notification->ID, 'notification_id', true );
}
$response = wp_remote_retrieve_body( wp_remote_post( $this->api_url, array(
'body' => array(
'slug' => $this->plugin,
'version' => $this->plugin_version,
'last_notification' => $notification_id,
),
) ) );
$data = json_decode( $response );
if ( ! empty( $data->id ) ) {
$notifications = array();
foreach ( (array) $data->slugs as $slug ) {
$notifications = array_merge(
$notifications,
(array) get_posts(
array(
'post_type' => 'amn_' . $slug,
'post_status' => 'all',
'meta_key' => 'notification_id',
'meta_value' => $data->id,
)
)
);
}
if ( empty( $notifications ) ) {
$new_notification_id = wp_insert_post( array(
'post_content' => wp_kses_post( $data->content ),
'post_type' => 'amn_' . $this->plugin,
) );
update_post_meta( $new_notification_id, 'notification_id', absint( $data->id ) );
update_post_meta( $new_notification_id, 'type', sanitize_text_field( trim( $data->type ) ) );
update_post_meta( $new_notification_id, 'dismissable', (bool) $data->dismissible ? 1 : 0 );
update_post_meta( $new_notification_id, 'location', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->location ) : json_encode( $data->location ) );
update_post_meta( $new_notification_id, 'version', sanitize_text_field( trim( $data->version ) ) );
update_post_meta( $new_notification_id, 'viewed', 0 );
update_post_meta( $new_notification_id, 'expiration', $data->expiration ? absint( $data->expiration ) : false );
update_post_meta( $new_notification_id, 'plans', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->plans ) : json_encode( $data->plans ) );
}
}
// Possibly revoke notifications.
if ( ! empty( $data->revoked ) ) {
$this->revoke_notifications( $data->revoked );
}
// Set the option now so we can't run this again until after 24 hours.
update_option( '_amn_' . $this->plugin . '_last_checked', strtotime( 'today midnight' ) );
}
}
/**
* Get local plugin notifications that have already been set.
*
* @since 1.0.0
*
* @param integer $limit Set the limit for how many posts to retrieve.
* @param array $args Any top-level arguments to add to the array.
*
* @return WP_Post[] WP_Post that match the query.
*/
public function get_plugin_notifications( $limit = -1, $args = array() ) {
return get_posts(
array(
'posts_per_page' => $limit,
'post_type' => 'amn_' . $this->plugin,
) + $args
);
}
/**
* Display any notifications that should be displayed.
*
* @since 1.0.0
*/
public function display_notifications() {
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
return;
}
$plugin_notifications = $this->get_plugin_notifications( -1, array(
'post_status' => 'all',
'meta_key' => 'viewed',
'meta_value' => '0',
) );
$plugin_notifications = $this->validate_notifications( $plugin_notifications );
if ( ! empty( $plugin_notifications ) && ! self::$registered ) {
foreach ( $plugin_notifications as $notification ) {
$dismissable = get_post_meta( $notification->ID, 'dismissable', true );
$type = get_post_meta( $notification->ID, 'type', true );
?>
<div class="am-notification am-notification-<?php echo $notification->ID; ?> notice notice-<?php echo $type; ?><?php echo $dismissable ? ' is-dismissible' : ''; ?>">
<?php echo $notification->post_content; ?>
</div>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$(document).on('click', '.am-notification-<?php echo $notification->ID; ?> button.notice-dismiss', function (event) {
$.post(ajaxurl, {
action: 'am_notification_dismiss',
notification_id: '<?php echo $notification->ID; ?>'
});
});
});
</script>
<?php
}
self::$registered = true;
}
}
/**
* Validate the notifications before displaying them.
*
* @since 1.0.0
*
* @param array $plugin_notifications An array of plugin notifications.
*
* @return array A filtered array of plugin notifications.
*/
public function validate_notifications( $plugin_notifications ) {
global $pagenow;
foreach ( $plugin_notifications as $key => $notification ) {
// Location validation.
$location = (array) json_decode( get_post_meta( $notification->ID, 'location', true ) );
$continue = false;
if ( ! in_array( 'everywhere', $location, true ) ) {
if ( in_array( 'index.php', $location, true ) && 'index.php' === $pagenow ) {
$continue = true;
}
if ( in_array( 'plugins.php', $location, true ) && 'plugins.php' === $pagenow ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Plugin validation (OR conditional).
$plugins = (array) json_decode( get_post_meta( $notification->ID, 'plugins', true ) );
$continue = false;
if ( ! empty( $plugins ) ) {
foreach ( $plugins as $plugin ) {
if ( is_plugin_active( $plugin ) ) {
$continue = true;
}
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Theme validation.
$theme = get_post_meta( $notification->ID, 'theme', true );
$continue = (string) wp_get_theme() === $theme;
if ( ! empty( $theme ) && ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
// Version validation.
$version = get_post_meta( $notification->ID, 'version', true );
$continue = false;
if ( ! empty( $version ) ) {
if ( version_compare( $this->plugin_version, $version, '<=' ) ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Expiration validation.
$expiration = get_post_meta( $notification->ID, 'expiration', true );
$continue = false;
if ( ! empty( $expiration ) ) {
if ( $expiration > time() ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
// Plan validation.
$plans = (array) json_decode( get_post_meta( $notification->ID, 'plans', true ) );
$continue = false;
if ( ! empty( $plans ) ) {
$level = $this->get_plan_level();
if ( in_array( $level, $plans, true ) ) {
$continue = true;
}
if ( ! $continue ) {
unset( $plugin_notifications[ $key ] );
}
}
}
return $plugin_notifications;
}
/**
* Grab the current plan level.
*
* @since 1.0.0
*
* @return string The current plan level.
*/
public function get_plan_level() {
// Prepare variables.
$key = '';
$level = '';
$option = false;
switch ( $this->plugin ) {
case 'wpforms' :
$option = get_option( 'wpforms_license' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'WPFORMS_LICENSE_KEY' ) ) {
$key = WPFORMS_LICENSE_KEY;
}
break;
case 'mi' :
$option = get_option( 'monsterinsights_license' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
$key = MONSTERINSIGHTS_LICENSE_KEY;
}
break;
case 'sol' :
$option = get_option( 'soliloquy' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'SOLILOQUY_LICENSE_KEY' ) ) {
$key = SOLILOQUY_LICENSE_KEY;
}
break;
case 'envira' :
$option = get_option( 'envira_gallery' );
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'ENVIRA_LICENSE_KEY' ) ) {
$key = ENVIRA_LICENSE_KEY;
}
break;
case 'om' :
$option = get_option( 'optin_monster_api' );
$key = is_array( $option ) && isset( $option['api']['apikey'] ) ? $option['api']['apikey'] : '';
// Possibly check for a constant.
if ( empty( $key ) && defined( 'OPTINMONSTER_REST_API_LICENSE_KEY' ) ) {
$key = OPTINMONSTER_REST_API_LICENSE_KEY;
}
// If the key is still empty, check for the old legacy key.
if ( empty( $key ) ) {
$key = is_array( $option ) && isset( $option['api']['key'] ) ? $option['api']['key'] : '';
}
break;
}
// Possibly set the level to 'none' if the key is empty and no level has been set.
if ( empty( $key ) && empty( $level ) ) {
$level = 'none';
}
// Normalize the level.
switch ( $level ) {
case 'bronze' :
case 'personal' :
$level = 'basic';
break;
case 'silver' :
case 'multi' :
$level = 'plus';
break;
case 'gold' :
case 'developer' :
$level = 'pro';
break;
case 'platinum' :
case 'master' :
$level = 'ultimate';
break;
}
// Return the plan level.
return $level;
}
/**
* Dismiss the notification via AJAX.
*
* @since 1.0.0
*/
public function dismiss_notification() {
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
die;
}
$notification_id = intval( $_POST['notification_id'] );
update_post_meta( $notification_id, 'viewed', 1 );
die;
}
/**
* Revokes notifications.
*
* @since 1.0.0
*
* @param array $ids An array of notification IDs to revoke.
*/
public function revoke_notifications( $ids ) {
// Loop through each of the IDs and find the post that has it as meta.
foreach ( (array) $ids as $id ) {
$notifications = $this->get_plugin_notifications( -1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) );
if ( $notifications ) {
foreach ( $notifications as $notification ) {
update_post_meta( $notification->ID, 'viewed', 1 );
}
}
}
}
}

View File

@@ -0,0 +1,457 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\WP;
/**
* Class Area registers and process all wp-admin display functionality.
*
* @since 1.0.0
*/
class Area {
/**
* @var string Slug of the admin area page.
*/
const SLUG = 'wp-mail-smtp';
/**
* @var string Admin page unique hook.
*/
public $hook;
/**
* @var PageAbstract[]
*/
private $pages;
/**
* Area constructor.
*
* @since 1.0.0
*/
public function __construct() {
$this->hooks();
}
/**
* Assign all hooks to proper places.
*
* @since 1.0.0
*/
protected function hooks() {
// Add the Settings link to a plugin on Plugins page.
add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_link' ), 10, 2 );
// Add the options page.
add_action( 'admin_menu', array( $this, 'add_admin_options_page' ) );
// Admin footer text.
add_filter( 'admin_footer_text', array( $this, 'get_admin_footer' ), 1, 2 );
// Enqueue admin area scripts and styles.
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
// Process the admin page forms actions.
add_action( 'admin_init', array( $this, 'process_actions' ) );
// Display custom notices based on the error/success codes.
add_action( 'admin_init', array( $this, 'display_custom_auth_notices' ) );
// Outputs the plugin admin header.
add_action( 'in_admin_header', array( $this, 'display_admin_header' ), 100 );
// Hide all unrelated to the plugin notices on the plugin admin pages.
add_action( 'admin_print_scripts', array( $this, 'hide_unrelated_notices' ) );
}
/**
* Display custom notices based on the error/success codes.
*
* @since 1.0.0
*/
public function display_custom_auth_notices() {
$error = isset( $_GET['error'] ) ? $_GET['error'] : '';
$success = isset( $_GET['success'] ) ? $_GET['success'] : '';
if ( empty( $error ) && empty( $success ) ) {
return;
}
switch ( $error ) {
case 'google_access_denied':
WP::add_admin_notice(
/* translators: %s - error code, returned by Google API. */
sprintf( esc_html__( 'There was an error while processing the authentication request: %s. Please try again.', 'wp-mail-smtp' ), '<code>' . $error . '</code>' ),
WP::ADMIN_NOTICE_ERROR
);
break;
case 'google_no_code_scope':
WP::add_admin_notice(
esc_html__( 'There was an error while processing the authentication request. Please try again.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_ERROR
);
break;
case 'google_no_clients':
WP::add_admin_notice(
esc_html__( 'There was an error while processing the authentication request. Please make sure that you have Client ID and Client Secret both valid and saved.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_ERROR
);
break;
}
switch ( $success ) {
case 'google_site_linked':
WP::add_admin_notice(
esc_html__( 'You have successfully linked the current site with your Google API project. Now you can start sending emails through Google.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
break;
}
}
/**
* Add admin area menu item.
*
* @since 1.0.0
*/
public function add_admin_options_page() {
$this->hook = add_options_page(
esc_html__( 'WP Mail SMTP Options', 'wp-mail-smtp' ),
esc_html__( 'WP Mail SMTP', 'wp-mail-smtp' ),
'manage_options',
self::SLUG,
array( $this, 'display' )
);
}
/**
* Enqueue admin area scripts and styles.
*
* @since 1.0.0
*
* @param string $hook
*/
public function enqueue_assets( $hook ) {
if ( $hook !== $this->hook ) {
return;
}
wp_enqueue_style(
'wp-mail-smtp-admin',
wp_mail_smtp()->plugin_url . '/assets/css/smtp-admin.min.css',
false,
WPMS_PLUGIN_VER
);
wp_enqueue_script(
'wp-mail-smtp-admin',
wp_mail_smtp()->plugin_url . '/assets/js/smtp-admin' . WP::asset_min() . '.js',
array( 'jquery' ),
WPMS_PLUGIN_VER
);
}
/**
* Outputs the plugin admin header.
*
* @since 1.0.0
*/
public function display_admin_header() {
// Bail if we're not on a plugin page.
if ( ! $this->is_admin_page() ) {
return;
}
?>
<div id="wp-mail-smtp-header">
<!--suppress HtmlUnknownTarget -->
<img class="wp-mail-smtp-header-logo" src="<?php echo wp_mail_smtp()->plugin_url; ?>/assets/images/logo.png" alt="WP Mail SMTP"/>
</div>
<?php
}
/**
* Display a text to ask users to review the plugin on WP.org.
*
* @since 1.0.0
*
* @param string $text
*
* @return string
*/
public function get_admin_footer( $text ) {
if ( $this->is_admin_page() ) {
$url = 'https://wordpress.org/support/plugin/wp-mail-smtp/reviews/?filter=5#new-post';
$text = sprintf(
/* translators: %1$s - WP.org link; %2$s - same WP.org link. */
__( 'Please rate <strong>WP Mail SMTP</strong> <a href="%1$s" target="_blank" rel="noopener noreferrer">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href="%2$s" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the WP Mail SMTP team!', 'wp-mail-smtp' ),
$url,
$url
);
}
return $text;
}
/**
* Display content of the admin area page.
*
* @since 1.0.0
*/
public function display() {
?>
<div class="wrap" id="wp-mail-smtp">
<div class="wp-mail-smtp-page-title">
<?php
foreach ( $this->get_pages() as $page_slug => $page ) :
$label = $page->get_label();
if ( empty( $label ) ) {
continue;
}
$class = $page_slug === $this->get_current_tab() ? 'class="active"' : '';
?>
<a href="<?php echo $page->get_link(); ?>" <?php echo $class; ?>><?php echo $label; ?></a>
<?php endforeach; ?>
</div>
<div class="wp-mail-smtp-page wp-mail-smtp-tab-<?php echo $this->get_current_tab(); ?>">
<h1 class="screen-reader-text"><?php echo $this->get_current_tab_title(); ?></h1>
<?php $this->display_current_tab_content(); ?>
</div>
</div>
<?php
}
/**
* Get the current tab title.
*
* @since 1.0.0
*/
public function display_current_tab_content() {
if ( ! array_key_exists( $this->get_current_tab(), $this->get_pages() ) ) {
return;
}
$this->pages[ $this->get_current_tab() ]->display();
}
/**
* Get the current admin area tab.
*
* @since 1.0.0
*
* @return string
*/
protected function get_current_tab() {
$current = '';
if ( $this->is_admin_page() ) {
$current = ! empty( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'settings';
}
return $current;
}
/**
* Get the array of default registered tabs for plugin admin area.
*
* @since 1.0.0
*
* @return \WPMailSMTP\Admin\PageAbstract[]
*/
public function get_pages() {
if ( empty( $this->pages ) ) {
$this->pages = array(
'settings' => new Pages\Settings(),
'test' => new Pages\Test(),
'misc' => new Pages\Misc(),
'auth' => new Pages\Auth(),
);
}
return apply_filters( 'wp_mail_smtp_admin_get_pages', $this->pages );
}
/**
* Get the current tab title.
*
* @since 1.0.0
*
* @return string
*/
public function get_current_tab_title() {
if ( ! array_key_exists( $this->get_current_tab(), $this->get_pages() ) ) {
return '';
}
return $this->pages[ $this->get_current_tab() ]->get_title();
}
/**
* Check whether we are on an admin page.
*
* @since 1.0.0
*
* @return bool
*/
public function is_admin_page() {
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
return self::SLUG === $page;
}
/**
* All possible plugin forms manipulation will be done here.
*
* @since 1.0.0
*/
public function process_actions() {
// Allow to process only own tabs.
if ( ! array_key_exists( $this->get_current_tab(), $this->get_pages() ) ) {
return;
}
// Process POST only if it exists.
if ( ! empty( $_POST ) ) {
if ( ! empty( $_POST['wp-mail-smtp'] ) ) {
$post = $_POST['wp-mail-smtp'];
} else {
$post = array();
}
$this->pages[ $this->get_current_tab() ]->process_post( $post );
}
// This won't do anything for most pages.
$this->pages[ $this->get_current_tab() ]->process_auth();
}
/**
* Add a link to Settings page of a plugin on Plugins page.
*
* @since 1.0.0
*
* @param array $links
* @param string $file
*
* @return mixed
*/
public function add_plugin_action_link( $links, $file ) {
if ( strpos( $file, 'wp-mail-smtp' ) === false ) {
return $links;
}
$settings_link = '<a href="' . $this->get_admin_page_url() . '">' . esc_html__( 'Settings', 'wp-mail-smtp' ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
/**
* Get plugin admin area page URL.
*
* @since 1.0.0
*
* @return string
*/
public function get_admin_page_url() {
return add_query_arg(
'page',
self::SLUG,
admin_url( 'options-general.php' )
);
}
/**
* Remove all non-WP Mail SMTP plugin notices from plugin pages.
*
* @since 1.0.0
*/
public function hide_unrelated_notices() {
// Bail if we're not on a our screen or page.
if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], self::SLUG ) === false ) {
return;
}
global $wp_filter;
if ( ! empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
foreach ( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
foreach ( $hooks as $name => $arr ) {
if ( is_object( $arr['function'] ) && $arr['function'] instanceof \Closure ) {
unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
continue;
}
if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'wpmailsmtp' ) !== false ) {
continue;
}
if ( ! empty( $name ) && strpos( strtolower( $name ), 'wpmailsmtp' ) === false ) {
unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
}
}
}
}
if ( ! empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
foreach ( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
foreach ( $hooks as $name => $arr ) {
if ( is_object( $arr['function'] ) && $arr['function'] instanceof \Closure ) {
unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
continue;
}
if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'wpmailsmtp' ) !== false ) {
continue;
}
if ( ! empty( $name ) && strpos( strtolower( $name ), 'wpmailsmtp' ) === false ) {
unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
}
}
}
}
if ( ! empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
foreach ( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
foreach ( $hooks as $name => $arr ) {
if ( is_object( $arr['function'] ) && $arr['function'] instanceof \Closure ) {
unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
continue;
}
if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'wpmailsmtp' ) !== false ) {
continue;
}
if ( ! empty( $name ) && strpos( strtolower( $name ), 'wpmailsmtp' ) === false ) {
unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
}
}
}
}
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace WPMailSMTP\Admin;
/**
* Class PageAbstract.
*
* @since 1.0.0
*/
abstract class PageAbstract implements PageInterface {
/**
* @var string Slug of a tab.
*/
protected $slug;
/**
* @inheritdoc
*/
public function get_link() {
return esc_url(
add_query_arg(
'tab',
$this->slug,
admin_url( 'options-general.php?page=' . Area::SLUG )
)
);
}
/**
* Process tab form submission ($_POST ).
*
* @since 1.0.0
*
* @param array $data $_POST data specific for the plugin.
*/
public function process_post( $data ) {
}
/**
* Process tab & mailer specific Auth actions.
*
* @since 1.0.0
*/
public function process_auth() {
}
/**
* Print the nonce field for a specific tab.
*
* @since 1.0.0
*/
public function wp_nonce_field() {
wp_nonce_field( Area::SLUG . '-' . $this->slug );
}
/**
* Make sure that a user was referred from plugin admin page.
* To avoid security problems.
*
* @since 1.0.0
*/
public function check_admin_referer() {
check_admin_referer( Area::SLUG . '-' . $this->slug );
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace WPMailSMTP\Admin;
/**
* Class PageInterface defines what should be in each page class.
*
* @since 1.0.0
*/
interface PageInterface {
/**
* URL to a tab.
*
* @since 1.0.0
*
* @return string
*/
public function get_link();
/**
* Title of a tab.
*
* @since 1.0.0
*
* @return string
*/
public function get_title();
/**
* Link label of a tab.
*
* @since 1.0.0
*
* @return string
*/
public function get_label();
/**
* Tab content.
*
* @since 1.0.0
*/
public function display();
}

View File

@@ -0,0 +1,59 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Options;
use WPMailSMTP\Providers\AuthAbstract;
/**
* Class Auth.
*
* @since 1.0.0
*/
class Auth {
/**
* @var string Slug of a tab.
*/
protected $slug = 'auth';
/**
* Launch mailer specific Auth logic.
*
* @since 1.0.0
*/
public function process_auth() {
$auth = wp_mail_smtp()->get_providers()->get_auth( Options::init()->get( 'mail', 'mailer' ) );
if ( $auth && $auth instanceof AuthAbstract ) {
$auth->process();
}
}
/**
* Return nothing, as we don't need this functionality.
*
* @since 1.0.0
*/
public function get_label() {
return '';
}
/**
* Return nothing, as we don't need this functionality.
*
* @since 1.0.0
*/
public function get_title() {
return '';
}
/**
* Do nothing, as we don't need this functionality.
*
* @since 1.0.0
*/
public function display() {
}
}

View File

@@ -0,0 +1,99 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\Options;
use WPMailSMTP\WP;
/**
* Class Misc is part of Area, displays different plugin-related settings of the plugin (not related to emails).
*
* @since 1.0.0
*/
class Misc extends PageAbstract {
/**
* @var string Slug of a tab.
*/
protected $slug = 'misc';
/**
* @inheritdoc
*/
public function get_label() {
return esc_html__( 'Misc', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label();
}
/**
* @inheritdoc
*/
public function display() {
$options = new Options();
?>
<form method="POST" action="">
<?php $this->wp_nonce_field(); ?>
<!-- General Section Title -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php esc_html_e( 'General', 'wp-mail-smtp' ); ?></h2>
</div>
</div>
<!-- Hide Announcements -->
<div id="wp-mail-smtp-setting-row-am_notifications_hidden" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-am_notifications_hidden"><?php esc_html_e( 'Hide Announcements', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[general][am_notifications_hidden]" type="checkbox"
value="true" <?php checked( true, $options->get( 'general', 'am_notifications_hidden' ) ); ?>
id="wp-mail-smtp-setting-am_notifications_hidden"
/>
<label for="wp-mail-smtp-setting-am_notifications_hidden"><?php esc_html_e( 'Check this if you would like to hide plugin announcements and update details.', 'wp-mail-smtp' ); ?></label>
</div>
</div>
<p class="wp-mail-smtp-submit">
<button type="submit" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange"><?php esc_html_e( 'Save Settings', 'wp-mail-smtp' ); ?></button>
</p>
</form>
<?php
}
/**
* @inheritdoc
*/
public function process_post( $data ) {
$this->check_admin_referer();
$options = new Options();
// Unchecked checkbox doesn't exist in $_POST, so we need to ensure we actually have it.
if ( empty( $data['general']['am_notifications_hidden'] ) ) {
$data['general']['am_notifications_hidden'] = false;
}
$to_save = array_merge( $options->get_all(), $data );
// All the sanitization is done there.
$options->set( $to_save );
WP::add_admin_notice(
esc_html__( 'Settings were successfully saved.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
}
}

View File

@@ -0,0 +1,255 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\Debug;
use WPMailSMTP\Options;
use WPMailSMTP\WP;
/**
* Class Settings is part of Area, displays general settings of the plugin.
*
* @since 1.0.0
*/
class Settings extends PageAbstract {
/**
* @var string Slug of a tab.
*/
protected $slug = 'settings';
/**
* @inheritdoc
*/
public function get_label() {
return esc_html__( 'Settings', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label();
}
/**
* @inheritdoc
*/
public function display() {
$options = new Options();
$mailer = $options->get( 'mail', 'mailer' );
?>
<form method="POST" action="">
<?php $this->wp_nonce_field(); ?>
<!-- Mail Section Title -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php esc_html_e( 'Mail', 'wp-mail-smtp' ); ?></h2>
</div>
</div>
<!-- From Email -->
<div id="wp-mail-smtp-setting-row-from_email" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-email wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-from_email"><?php esc_html_e( 'From Email', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[mail][from_email]" type="email"
value="<?php echo esc_attr( $options->get( 'mail', 'from_email' ) ); ?>"
<?php echo $options->is_const_defined( 'mail', 'from_email' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_email" spellcheck="false"
/>
<p class="desc">
<?php esc_html_e( 'You can specify the email address that emails should be sent from.', 'wp-mail-smtp' ); ?><br/>
<?php
printf(
/* translators: %s - default email address. */
esc_html__( 'If you leave this blank, the default one will be used: %s.', 'wp-mail-smtp' ),
'<code>' . wp_mail_smtp()->get_processor()->get_default_email() . '</code>'
);
?>
</p>
<p class="desc">
<?php esc_html_e( 'Please note if you are sending using an email provider (Gmail, Yahoo, Hotmail, Outlook.com, etc) this setting should be your email address for that account.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- From Name -->
<div id="wp-mail-smtp-setting-row-from_name" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-from_name"><?php esc_html_e( 'From Name', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[mail][from_name]" type="text"
value="<?php echo esc_attr( $options->get( 'mail', 'from_name' ) ); ?>"
<?php echo $options->is_const_defined( 'mail', 'from_name' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_name" spellcheck="false"
/>
<p class="desc">
<?php esc_html_e( 'You can specify the name that emails should be sent from.', 'wp-mail-smtp' ); ?><br/>
<?php
printf(
/* translators: %s - WordPress. */
esc_html__( 'If you leave this blank, the emails will be sent from %s.', 'wp-mail-smtp' ),
'<code>WordPress</code>'
);
?>
</p>
</div>
</div>
<!-- Mailer -->
<div id="wp-mail-smtp-setting-row-mailer" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-mailer wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-mailer"><?php esc_html_e( 'Mailer', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<div class="wp-mail-smtp-mailers">
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
<div class="wp-mail-smtp-mailer <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
<div class="wp-mail-smtp-mailer-image">
<img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
alt="<?php echo esc_attr( $provider->get_title() ); ?>">
</div>
<div class="wp-mail-smtp-mailer-text">
<input id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"
type="radio" name="wp-mail-smtp[mail][mailer]"
value="<?php echo esc_attr( $provider->get_slug() ); ?>"
<?php checked( $provider->get_slug(), $mailer ); ?>
<?php echo $options->is_const_defined( 'mail', 'mailer' ) ? 'disabled' : ''; ?>
/>
<label for="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"><?php echo $provider->get_title(); ?></label>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- Return Path -->
<div id="wp-mail-smtp-setting-row-return_path" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-return_path"><?php esc_html_e( 'Return Path', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[mail][return_path]" type="checkbox"
value="true" <?php checked( true, (bool) $options->get( 'mail', 'return_path' ) ); ?>
<?php echo $options->is_const_defined( 'mail', 'return_path' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-return_path"
/>
<label for="wp-mail-smtp-setting-return_path">
<?php esc_html_e( 'Set the return-path to match the From Email', 'wp-mail-smtp' ); ?>
</label>
<p class="desc">
<?php esc_html_e( 'Return Path indicates where non-delivery receipts - or bounce messages - are to be sent.', 'wp-mail-smtp' ); ?><br/>
<?php esc_html_e( 'If unchecked bounce messages may be lost.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- Mailer Options -->
<div class="wp-mail-smtp-mailer-options">
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
<div class="wp-mail-smtp-mailer-option wp-mail-smtp-mailer-option-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : 'hidden'; ?>">
<!-- Mailer Option Title -->
<?php $provider_desc = $provider->get_description(); ?>
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading <?php echo empty( $provider_desc ) ? 'no-desc' : ''; ?>" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php echo $provider->get_title(); ?></h2>
<?php if ( ! empty( $provider_desc ) ) : ?>
<p class="desc"><?php echo $provider_desc; ?></p>
<?php endif; ?>
</div>
</div>
<?php $provider->display_options(); ?>
</div>
<?php endforeach; ?>
</div>
<p class="wp-mail-smtp-submit">
<button type="submit" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange"><?php esc_html_e( 'Save Settings', 'wp-mail-smtp' ); ?></button>
</p>
</form>
<?php
}
/**
* @inheritdoc
*/
public function process_post( $data ) {
$this->check_admin_referer();
$options = new Options();
$old_opt = $options->get_all();
// When checkbox is unchecked - it's not submitted at all, so we need to define its default false value.
if ( ! isset( $data['mail']['return_path'] ) ) {
$data['mail']['return_path'] = false;
}
if ( ! isset( $data['smtp']['autotls'] ) ) {
$data['smtp']['autotls'] = false;
}
if ( ! isset( $data['smtp']['auth'] ) ) {
$data['smtp']['auth'] = false;
}
// Remove all debug messages when switching mailers.
if ( $old_opt['mail']['mailer'] !== $data['mail']['mailer'] ) {
Debug::clear();
}
$to_redirect = false;
// Old and new Gmail client id/secret values are different - we need to invalidate tokens and scroll to Auth button.
if (
$options->get( 'mail', 'mailer' ) === 'gmail' &&
(
$options->get( 'gmail', 'client_id' ) !== $data['gmail']['client_id'] ||
$options->get( 'gmail', 'client_secret' ) !== $data['gmail']['client_secret']
)
) {
unset( $old_opt['gmail'] );
if (
! empty( $data['gmail']['client_id'] ) &&
! empty( $data['gmail']['client_secret'] )
) {
$to_redirect = true;
}
}
// New gmail clients data will be added from new $data.
$to_save = Options::array_merge_recursive( $old_opt, $data );
// All the sanitization is done in Options class.
$options->set( $to_save );
if ( $to_redirect ) {
wp_redirect( $_POST['_wp_http_referer'] . '#wp-mail-smtp-setting-row-gmail-authorize' );
exit;
}
WP::add_admin_notice(
esc_html__( 'Settings were successfully saved.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
}
}

View File

@@ -0,0 +1,216 @@
<?php
namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcher;
use WPMailSMTP\Options;
use WPMailSMTP\WP;
use WPMailSMTP\Admin\PageAbstract;
/**
* Class Test is part of Area, displays email testing page of the plugin.
*
* @since 1.0.0
*/
class Test extends PageAbstract {
/**
* @var string Slug of a tab.
*/
protected $slug = 'test';
/**
* @inheritdoc
*/
public function get_label() {
return esc_html__( 'Email Test', 'wp-mail-smtp' );
}
/**
* @inheritdoc
*/
public function get_title() {
return $this->get_label();
}
/**
* @inheritdoc
*/
public function display() {
?>
<form method="POST" action="">
<?php $this->wp_nonce_field(); ?>
<!-- Test Email Section Title -->
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
<div class="wp-mail-smtp-setting-field">
<h2><?php esc_html_e( 'Send a Test Email', 'wp-mail-smtp' ); ?></h2>
</div>
</div>
<!-- Test Email -->
<div id="wp-mail-smtp-setting-row-test_email" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-email wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-test_email"><?php esc_html_e( 'Send To', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[test_email]" type="email" id="wp-mail-smtp-setting-test_email" spellcheck="false" required />
<p class="desc">
<?php esc_html_e( 'Type an email address here and then click a button below to generate a test email.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<p class="wp-mail-smtp-submit">
<button type="submit" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange"><?php esc_html_e( 'Send Email', 'wp-mail-smtp' ); ?></button>
</p>
</form>
<?php
}
/**
* @inheritdoc
*/
public function process_post( $data ) {
$this->check_admin_referer();
if ( isset( $data['test_email'] ) ) {
$data['test_email'] = filter_var( $data['test_email'], FILTER_VALIDATE_EMAIL );
}
if ( empty( $data['test_email'] ) ) {
WP::add_admin_notice(
esc_html__( 'Test failed. Please use a valid email address and try to resend the test email.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_WARNING
);
return;
}
global $phpmailer;
// Make sure the PHPMailer class has been instantiated.
if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
$phpmailer = new MailCatcher( true );
}
// Set SMTPDebug level, default is 3 (commands + data + connection status).
$phpmailer->SMTPDebug = apply_filters( 'wp_mail_smtp_admin_test_email_smtp_debug', 3 );
// Start output buffering to grab smtp debugging output.
ob_start();
// Send the test mail.
$result = wp_mail(
$data['test_email'],
/* translators: %s - email address a test email will be sent to. */
'WP Mail SMTP: ' . sprintf( esc_html__( 'Test email to %s', 'wp-mail-smtp' ), $data['test_email'] ),
sprintf(
/* translators: %s - mailer name. */
esc_html__( 'This email was sent by %s mailer, and generated by the WP Mail SMTP WordPress plugin.', 'wp-mail-smtp' ),
wp_mail_smtp()->get_providers()->get_options( Options::init()->get( 'mail', 'mailer' ) )->get_title()
)
);
// Grab the smtp debugging output.
$smtp_debug = ob_get_clean();
/*
* Notify a user about the results.
*/
if ( $result ) {
WP::add_admin_notice(
esc_html__( 'Your email was sent successfully!', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
} else {
$error = $this->get_debug_messages( $phpmailer, $smtp_debug );
WP::add_admin_notice(
'<p><strong>' . esc_html__( 'There was a problem while sending a test email. Related debugging output is shown below:', 'wp-mail-smtp' ) . '</strong></p>' .
'<blockquote style="border-left:1px solid orange;padding-left:10px">' . $error . '</blockquote>' .
'<p class="description">' . esc_html__( 'Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues.', 'wp-mail-smtp' ) . '</p>',
WP::ADMIN_NOTICE_ERROR
);
}
}
/**
* Prepare debug information, that will help users to identify the error.
*
* @since 1.0.0
*
* @param MailCatcher $phpmailer
* @param string $smtp_debug
*
* @return string
*/
protected function get_debug_messages( $phpmailer, $smtp_debug ) {
$options = new Options();
/*
* Versions Debug.
*/
$versions_text = '<strong>Versions:</strong><br>';
$versions_text .= '<strong>WordPress:</strong> ' . get_bloginfo( 'version' ) . '<br>';
$versions_text .= '<strong>WordPress MS:</strong> ' . ( is_multisite() ? 'Yes' : 'No' ) . '<br>';
$versions_text .= '<strong>PHP:</strong> ' . PHP_VERSION . '<br>';
$versions_text .= '<strong>WP Mail SMTP:</strong> ' . WPMS_PLUGIN_VER . '<br>';
/*
* Mailer Debug.
*/
$mailer_text = '<strong>Params:</strong><br>';
$mailer_text .= '<strong>Mailer:</strong> ' . $options->get( 'mail', 'mailer' ) . '<br>';
$mailer_text .= '<strong>Constants:</strong> ' . ( $options->is_const_enabled() ? 'Yes' : 'No' ) . '<br>';
// Display different debug info based on the mailer.
$mailer = wp_mail_smtp()->get_providers()->get_mailer( $options->get( 'mail', 'mailer' ), $phpmailer );
if ( $mailer ) {
$mailer_text .= $mailer->get_debug_info();
}
/*
* General Debug.
*/
$debug_text = implode( '<br>', Debug::get() );
Debug::clear();
if ( ! empty( $debug_text ) ) {
$debug_text = '<br><strong>Debug:</strong><br>' . $debug_text . '<br>';
}
/*
* SMTP Debug.
*/
$smtp_text = '';
if ( $options->is_mailer_smtp() ) {
$smtp_text = '<strong>SMTP Debug:</strong><br>';
if ( ! empty( $smtp_debug ) ) {
$smtp_text .= esc_textarea( $smtp_debug );
} else {
$smtp_text .= '[empty]';
}
}
$errors = apply_filters( 'wp_mail_smtp_admin_test_get_debug_messages', array(
$versions_text,
$mailer_text,
$debug_text,
$smtp_text,
) );
return '<pre>' . implode( '<br>', array_filter( $errors ) ) . '</pre>';
}
}

View File

@@ -0,0 +1,241 @@
<?php
namespace WPMailSMTP;
/**
* Class Core to handle all plugin initialization.
*
* @since 1.0.0
*/
class Core {
/**
* Without trailing slash.
*
* @var string
*/
public $plugin_url;
/**
* Without trailing slash.
*
* @var string
*/
public $plugin_path;
/**
* Core constructor.
*
* @since 1.0.0
*/
public function __construct() {
$this->plugin_url = rtrim( plugin_dir_url( __DIR__ ), '/\\' );
$this->plugin_path = rtrim( plugin_dir_path( __DIR__ ), '/\\' );
$this->hooks();
}
/**
* Assign all hooks to proper places.
*
* @since 1.0.0
*/
public function hooks() {
// Activation hook.
add_action( 'activate_wp-mail-smtp/wp_mail_smtp.php', array( $this, 'activate' ) );
add_action( 'plugins_loaded', array( $this, 'get_processor' ) );
add_action( 'plugins_loaded', array( $this, 'replace_phpmailer' ) );
add_action( 'plugins_loaded', array( $this, 'init_notifications' ) );
add_action( 'admin_notices', array( '\WPMailSMTP\WP', 'display_admin_notices' ) );
add_action( 'init', array( $this, 'init' ) );
}
/**
* Initial plugin actions.
*
* @since 1.0.0
*/
public function init() {
// Load translations just in case.
load_plugin_textdomain( 'wp-mail-smtp', false, plugin_basename( wp_mail_smtp()->plugin_path ) . '/languages' );
/*
* Constantly check in admin area, that we don't need to upgrade DB.
* Do not wait for the `admin_init` hook, because some actions are already done
* on `plugins_loaded`, so migration has to be done before.
*/
if ( WP::in_wp_admin() ) {
$this->get_migration();
$this->get_upgrade();
$this->get_admin();
}
}
/**
* Load the plugin core processor.
*
* @since 1.0.0
*
* @return Processor
*/
public function get_processor() {
static $processor;
if ( ! isset( $processor ) ) {
$processor = apply_filters( 'wp_mail_smtp_core_get_processor', new Processor() );
}
return $processor;
}
/**
* Load the plugin admin area.
*
* @since 1.0.0
*
* @return Admin\Area
*/
public function get_admin() {
static $admin;
if ( ! isset( $admin ) ) {
$admin = apply_filters( 'wp_mail_smtp_core_get_admin', new Admin\Area() );
}
return $admin;
}
/**
* Load the plugin providers loader.
*
* @since 1.0.0
*
* @return Providers\Loader
*/
public function get_providers() {
static $providers;
if ( ! isset( $providers ) ) {
$providers = apply_filters( 'wp_mail_smtp_core_get_providers', new Providers\Loader() );
}
return $providers;
}
/**
* Load the plugin option migrator.
*
* @since 1.0.0
*
* @return Migration
*/
public function get_migration() {
static $migration;
if ( ! isset( $migration ) ) {
$migration = apply_filters( 'wp_mail_smtp_core_get_migration', new Migration() );
}
return $migration;
}
/**
* Load the plugin upgrader.
*
* @since 1.1.0
*
* @return Upgrade
*/
public function get_upgrade() {
static $upgrade;
if ( ! isset( $upgrade ) ) {
$upgrade = apply_filters( 'wp_mail_smtp_core_get_upgrade', new Upgrade() );
}
return $upgrade;
}
/**
* Awesome Motive Notifications.
*
* @since 1.0.0
*/
public function init_notifications() {
if ( Options::init()->get( 'general', 'am_notifications_hidden' ) ) {
return;
}
static $notification;
if ( ! isset( $notification ) ) {
$notification = new AM_Notification( 'smtp', WPMS_PLUGIN_VER );
}
}
/**
* Init the \PHPMailer replacement.
*
* @since 1.0.0
*
* @return \WPMailSMTP\MailCatcher
*/
public function replace_phpmailer() {
global $phpmailer;
return $this->replace_w_fake_phpmailer( $phpmailer );
}
/**
* Overwrite default PhpMailer with out MailCatcher.
*
* @since 1.0.0
*
* @param null $obj
*
* @return \WPMailSMTP\MailCatcher
*/
protected function replace_w_fake_phpmailer( &$obj = null ) {
$obj = new MailCatcher();
return $obj;
}
/**
* What to do on plugin activation.
*
* @since 1.0.0
*/
public function activate() {
// Store the plugin version activated to reference with upgrades.
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER );
// Create and store initial plugin settings.
$options = array(
'mail' => array(
'from_email' => get_option( 'admin_email' ),
'from_name' => get_bloginfo( 'name' ),
'mailer' => 'mail',
'return_path' => false,
),
'smtp' => array(
'autotls' => true,
),
);
Options::init()->set( $options, true );
}
}

View File

@@ -0,0 +1,118 @@
<?php
namespace WPMailSMTP;
/**
* Class Debug that will save all errors or warnings generated by APIs or SMTP
* and display in area for administrators.
*
* Usage example:
* Debug::set( 'Some warning: %s', array( '%s' => $e->getMessage() );
* $debug = Debug::get(); // array
* $debug = Debug::get_last(); // string
*
* @since 1.2.0
*/
class Debug {
/**
* Key for options table where all messages will be saved to.
*/
const OPTION_KEY = 'wp_mail_smtp_debug';
/**
* Save the debug message to a debug log.
* Adds one more to a list, at the end.
*
* @since 1.2.0
*
* @param string $message
*/
public static function set( $message ) {
if ( ! is_string( $message ) ) {
$message = \json_encode( $message );
}
$message = wp_strip_all_tags( $message, false );
$all = self::get();
array_push( $all, $message );
update_option( self::OPTION_KEY, $all, false );
}
/**
* Remove all messages for a debug log.
*
* @since 1.2.0
*/
public static function clear() {
update_option( self::OPTION_KEY, array(), false );
}
/**
* Retrieve all messages from a debug log.
*
* @since 1.2.0
*
* @return array
*/
public static function get() {
$all = get_option( self::OPTION_KEY, array() );
if ( ! is_array( $all ) ) {
$all = (array) $all;
}
return $all;
}
/**
* Get the last message that was saved to a debug log.
*
* @since 1.2.0
*
* @return string
*/
public static function get_last() {
$all = self::get();
if ( ! empty( $all ) && is_array( $all ) ) {
return (string) $all[ count( $all ) - 1 ];
}
return '';
}
/**
* Get the proper variable content output to debug.
*
* @since 1.2.0
*
* @param mixed $var
*
* @return string
*/
public static function pvar( $var = '' ) {
ob_start();
echo '<code>';
if ( is_bool( $var ) || empty( $var ) ) {
var_dump( $var );
} else {
print_r( $var );
}
echo '</code>';
$output = ob_get_clean();
return str_replace( array( "\r\n", "\r", "\n" ), '', $output );
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace WPMailSMTP;
// Load PHPMailer class, so we can subclass it.
if ( ! class_exists( 'PHPMailer', false ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
}
/**
* Class MailCatcher replaces the \PHPMailer and modifies the email sending logic.
* Thus, we can use other mailers API to do what we need, or stop emails completely.
*
* @since 1.0.0
*/
class MailCatcher extends \PHPMailer {
/**
* Modify the default send() behaviour.
* For those mailers, that relies on PHPMailer class - call it directly.
* For others - init the correct provider and process it.
*
* @since 1.0.0
*
* @throws \phpmailerException Throws when sending via PhpMailer fails for some reason.
*
* @return bool
*/
public function send() {
$options = new Options();
$mail_mailer = $options->get( 'mail', 'mailer' );
// Define a custom header, that will be used in Gmail/SMTP mailers.
$this->XMailer = 'WPMailSMTP/Mailer/' . $mail_mailer . ' ' . WPMS_PLUGIN_VER;
// Use the default PHPMailer, as we inject our settings there for certain providers.
if (
$mail_mailer === 'mail' ||
$mail_mailer === 'smtp' ||
$mail_mailer === 'pepipost'
) {
return parent::send();
}
// We need this so that the \PHPMailer class will correctly prepare all the headers.
$this->Mailer = 'mail';
// Prepare everything (including the message) for sending.
if ( ! $this->preSend() ) {
return false;
}
$mailer = wp_mail_smtp()->get_providers()->get_mailer( $mail_mailer, $this );
if ( ! $mailer ) {
return false;
}
if ( ! $mailer->is_php_compatible() ) {
return false;
}
/*
* Send the actual email.
* We reuse everything, that was preprocessed for usage in \PHPMailer.
*/
$mailer->send();
return $mailer->is_email_sent();
}
}

View File

@@ -0,0 +1,245 @@
<?php
namespace WPMailSMTP;
/**
* Class Migration helps migrate all plugin options saved into DB to a new storage location.
*
* @since 1.0.0
*/
class Migration {
/**
* All old values for pre 1.0 version of a plugin.
*
* @var array
*/
protected $old_keys = array(
'pepipost_ssl',
'pepipost_port',
'pepipost_pass',
'pepipost_user',
'smtp_pass',
'smtp_user',
'smtp_auth',
'smtp_ssl',
'smtp_port',
'smtp_host',
'mail_set_return_path',
'mailer',
'mail_from_name',
'mail_from',
'wp_mail_smtp_am_notifications_hidden',
);
/**
* Old values, taken from $old_keys options.
*
* @var array
*/
protected $old_values = array();
/**
* Converted array of data from previous option values.
*
* @var array
*/
protected $new_values = array();
/**
* Migration constructor.
*
* @since 1.0.0
*/
public function __construct() {
if ( $this->is_migrated() ) {
return;
}
$this->old_values = $this->get_old_values();
$this->new_values = $this->get_converted_options();
Options::init()->set( $this->new_values );
// Removing all options will be enabled some time in the future.
// $this->clean_deprecated_data();
}
/**
* Whether we already migrated or not.
*
* @since 1.0.0
*
* @return bool
*/
protected function is_migrated() {
$is_migrated = false;
$new_values = get_option( Options::META_KEY, array() );
if ( ! empty( $new_values ) ) {
$is_migrated = true;
}
return $is_migrated;
}
/**
* Get all old values from DB.
*
* @since 1.0.0
*
* @return array
*/
protected function get_old_values() {
$old_values = array();
foreach ( $this->old_keys as $old_key ) {
$old_values[ $old_key ] = get_option( $old_key, '' );
}
return $old_values;
}
/**
* Convert old values from key=>value to a multidimensional array of data.
*
* @since 1.0.0
*/
protected function get_converted_options() {
$converted = array();
foreach ( $this->old_keys as $old_key ) {
switch ( $old_key ) {
case 'pepipost_user':
case 'pepipost_pass':
case 'pepipost_port':
case 'pepipost_ssl':
// Do not migrate pepipost options if it's not activated at the moment.
if ( 'pepipost' === $this->old_values['mailer'] ) {
$shortcut = explode( '_', $old_key );
if ( $old_key === 'pepipost_ssl' ) {
$converted[ $shortcut[0] ]['encryption'] = $this->old_values[ $old_key ];
} else {
$converted[ $shortcut[0] ][ $shortcut[1] ] = $this->old_values[ $old_key ];
}
}
break;
case 'smtp_host':
case 'smtp_port':
case 'smtp_ssl':
case 'smtp_auth':
case 'smtp_user':
case 'smtp_pass':
$shortcut = explode( '_', $old_key );
if ( $old_key === 'smtp_ssl' ) {
$converted[ $shortcut[0] ]['encryption'] = $this->old_values[ $old_key ];
} elseif ( $old_key === 'smtp_auth' ) {
$converted[ $shortcut[0] ][ $shortcut[1] ] = ( $this->old_values[ $old_key ] === 'true' ? 'yes' : 'no' );
} else {
$converted[ $shortcut[0] ][ $shortcut[1] ] = $this->old_values[ $old_key ];
}
break;
case 'mail_from':
$converted['mail']['from_email'] = $this->old_values[ $old_key ];
break;
case 'mail_from_name':
$converted['mail']['from_name'] = $this->old_values[ $old_key ];
break;
case 'mail_set_return_path':
$converted['mail']['return_path'] = ( $this->old_values[ $old_key ] === 'true' );
break;
case 'mailer':
$converted['mail']['mailer'] = $this->old_values[ $old_key ];
break;
case 'wp_mail_smtp_am_notifications_hidden':
$converted['general']['am_notifications_hidden'] = ( $this->old_values[ $old_key ] === 'true' );
break;
}
}
$converted = $this->get_converted_constants_options( $converted );
return $converted;
}
/**
* Some users use constants in wp-config.php to define values.
* We need to prioritize them and reapply data to options.
* Use only those that are actually defined.
*
* @since 1.0.0
*
* @param array $converted
*
* @return array
*/
protected function get_converted_constants_options( $converted ) {
// Are we configured via constants?
if ( ! defined( 'WPMS_ON' ) || ! WPMS_ON ) {
return $converted;
}
/*
* Mail settings.
*/
if ( defined( 'WPMS_MAIL_FROM' ) ) {
$converted['mail']['from_email'] = WPMS_MAIL_FROM;
}
if ( defined( 'WPMS_MAIL_FROM_NAME' ) ) {
$converted['mail']['from_name'] = WPMS_MAIL_FROM_NAME;
}
if ( defined( 'WPMS_MAILER' ) ) {
$converted['mail']['return_path'] = WPMS_MAILER;
}
if ( defined( 'WPMS_SET_RETURN_PATH' ) ) {
$converted['mail']['mailer'] = WPMS_SET_RETURN_PATH;
}
/*
* SMTP settings.
*/
if ( defined( 'WPMS_SMTP_HOST' ) ) {
$converted['smtp']['host'] = WPMS_SMTP_HOST;
}
if ( defined( 'WPMS_SMTP_PORT' ) ) {
$converted['smtp']['port'] = WPMS_SMTP_PORT;
}
if ( defined( 'WPMS_SSL' ) ) {
$converted['smtp']['ssl'] = WPMS_SSL;
}
if ( defined( 'WPMS_SMTP_AUTH' ) ) {
$converted['smtp']['auth'] = WPMS_SMTP_AUTH;
}
if ( defined( 'WPMS_SMTP_USER' ) ) {
$converted['smtp']['user'] = WPMS_SMTP_USER;
}
if ( defined( 'WPMS_SMTP_PASS' ) ) {
$converted['smtp']['pass'] = WPMS_SMTP_PASS;
}
return $converted;
}
/**
* Delete all old values that are stored separately each.
*
* @since 1.0.0
*/
protected function clean_deprecated_data() {
foreach ( $this->old_keys as $old_key ) {
delete_option( $old_key );
}
}
}

View File

@@ -0,0 +1,607 @@
<?php
namespace WPMailSMTP;
/**
* Class Options to handle all options management.
* WordPress does all the heavy work for caching get_option() data,
* so we don't have to do that. But we want to minimize cyclomatic complexity
* of calling a bunch of WP functions, thus we will cache them in a class as well.
*
* @since 1.0.0
*/
class Options {
/**
* @var array Map of all the default options of the plugin.
*/
private static $map = array(
'mail' => array(
'from_name',
'from_email',
'mailer',
'return_path',
),
'smtp' => array(
'host',
'port',
'encryption',
'autotls',
'auth',
'user',
'pass',
),
'gmail' => array(
'client_id',
'client_secret',
),
'mailgun' => array(
'api_key',
'domain',
),
'sendgrid' => array(
'api_key',
),
'pepipost' => array(
'host',
'port',
'encryption',
'auth',
'user',
'pass',
),
);
/**
* That's where plugin options are saved in wp_options table.
*
* @var string
*/
const META_KEY = 'wp_mail_smtp';
/**
* All the plugin options.
*
* @var array
*/
private $_options = array();
/**
* Init the Options class.
*
* @since 1.0.0
*/
public function __construct() {
$this->populate_options();
}
/**
* Initialize all the options, used for chaining.
*
* One-liner:
* Options::init()->get('smtp', 'host');
* Options::init()->is_pepipost_active();
*
* Or multiple-usage:
* $options = new Options();
* $options->get('smtp', 'host');
*
* @since 1.0.0
*
* @return Options
*/
public static function init() {
static $instance;
if ( ! $instance ) {
$instance = new self();
}
return $instance;
}
/**
* Retrieve all options of the plugin.
*
* @since 1.0.0
*/
protected function populate_options() {
$this->_options = get_option( self::META_KEY, array() );
}
/**
* Get all the options.
*
* Options::init()->get_all();
*
* @since 1.0.0
*
* @return array
*/
public function get_all() {
$options = $this->_options;
foreach ( $options as $group => $g_value ) {
foreach ( $g_value as $key => $value ) {
$options[ $group ][ $key ] = $this->get( $group, $key );
}
}
return apply_filters( 'wp_mail_smtp_options_get_all', $options );
}
/**
* Get all the options for a group.
*
* Options::init()->get_group('smtp') - will return only array of options (or empty array if a key doesn't exist).
*
* @since 1.0.0
*
* @param string $group
*
* @return mixed
*/
public function get_group( $group ) {
// Just to feel safe.
$group = sanitize_key( $group );
if ( isset( $this->_options[ $group ] ) ) {
foreach ( $this->_options[ $group ] as $g_key => $g_value ) {
$options[ $group ][ $g_key ] = $this->get( $group, $g_key );
}
return apply_filters( 'wp_mail_smtp_options_get_group', $this->_options[ $group ], $group );
}
return array();
}
/**
* Get options by a group and a key.
*
* Options::init()->get( 'smtp', 'host' ) - will return only SMTP 'host' option.
*
* @since 1.0.0
*
* @param string $group
* @param string $key
*
* @return mixed
*/
public function get( $group, $key ) {
// Just to feel safe.
$group = sanitize_key( $group );
$key = sanitize_key( $key );
// Get the options group.
if ( isset( $this->_options[ $group ] ) ) {
// Get the options key of a group.
if ( isset( $this->_options[ $group ][ $key ] ) ) {
$value = $this->get_const_value( $group, $key, $this->_options[ $group ][ $key ] );
} else {
$value = $this->postprocess_key_defaults( $group, $key );
}
} else {
$value = $this->postprocess_key_defaults( $group, $key );
}
if ( is_string( $value ) ) {
$value = stripslashes( $value );
}
return apply_filters( 'wp_mail_smtp_options_get', $value, $group, $key );
}
/**
* Some options may be non-empty by default,
* so we need to postprocess them to convert.
*
* @since 1.0.0
*
* @param string $group
* @param string $key
*
* @return mixed
*/
protected function postprocess_key_defaults( $group, $key ) {
$value = '';
switch ( $key ) {
case 'return_path':
$value = $group === 'mail' ? false : true;
break;
case 'encryption':
$value = in_array( $group, array( 'smtp', 'pepipost' ), true ) ? 'none' : $value;
break;
case 'auth':
case 'autotls':
$value = in_array( $group, array( 'smtp', 'pepipost' ), true ) ? false : true;
break;
case 'pass':
$value = $this->get_const_value( $group, $key, $value );
break;
}
return apply_filters( 'wp_mail_smtp_options_postprocess_key_defaults', $value, $group, $key );
}
/**
* Process the options values through the constants check.
* If we have defined associated constant - use it instead of a DB value.
* Backward compatibility is hard.
* General section of options won't have constants, so we are omitting those checks and just return default value.
*
* @since 1.0.0
*
* @param string $group
* @param string $key
* @param mixed $value
*
* @return mixed
*/
protected function get_const_value( $group, $key, $value ) {
if ( ! $this->is_const_enabled() ) {
return $value;
}
switch ( $group ) {
case 'mail':
switch ( $key ) {
case 'from_name':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_MAIL_FROM_NAME : $value;
case 'from_email':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_MAIL_FROM : $value;
case 'mailer':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_MAILER : $value;
case 'return_path':
return $this->is_const_defined( $group, $key ) ? true : $value;
}
break;
case 'smtp':
switch ( $key ) {
case 'host':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SMTP_HOST : $value;
case 'port':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SMTP_PORT : $value;
case 'encryption':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key )
? ( WPMS_SSL === '' ? 'none' : WPMS_SSL )
: $value;
case 'auth':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SMTP_AUTH : $value;
case 'autotls':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SMTP_AUTOTLS : $value;
case 'user':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SMTP_USER : $value;
case 'pass':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SMTP_PASS : $value;
}
break;
case 'gmail':
switch ( $key ) {
case 'client_id':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_GMAIL_CLIENT_ID : $value;
case 'client_secret':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_GMAIL_CLIENT_SECRET : $value;
}
break;
case 'mailgun':
switch ( $key ) {
case 'api_key':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_MAILGUN_API_KEY : $value;
case 'domain':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_MAILGUN_DOMAIN : $value;
}
break;
case 'sendgrid':
switch ( $key ) {
case 'api_key':
/** @noinspection PhpUndefinedConstantInspection */
return $this->is_const_defined( $group, $key ) ? WPMS_SENDGRID_API_KEY : $value;
}
break;
}
// Always return the default value if nothing from above matches the request.
return $value;
}
/**
* Whether constants redefinition is enabled or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_const_enabled() {
return defined( 'WPMS_ON' ) && WPMS_ON === true;
}
/**
* We need this check to reuse later in admin area,
* to distinguish settings fields that were redefined,
* and display them differently.
*
* @since 1.0.0
*
* @param string $group
* @param string $key
*
* @return bool
*/
public function is_const_defined( $group, $key ) {
if ( ! $this->is_const_enabled() ) {
return false;
}
// Just to feel safe.
$group = sanitize_key( $group );
$key = sanitize_key( $key );
switch ( $group ) {
case 'mail':
switch ( $key ) {
case 'from_name':
return defined( 'WPMS_MAIL_FROM_NAME' ) && WPMS_MAIL_FROM_NAME;
case 'from_email':
return defined( 'WPMS_MAIL_FROM' ) && WPMS_MAIL_FROM;
case 'mailer':
return defined( 'WPMS_MAILER' ) && WPMS_MAILER;
case 'return_path':
return defined( 'WPMS_SET_RETURN_PATH' ) && ( WPMS_SET_RETURN_PATH === 'true' || WPMS_SET_RETURN_PATH === true );
}
break;
case 'smtp':
switch ( $key ) {
case 'host':
return defined( 'WPMS_SMTP_HOST' ) && WPMS_SMTP_HOST;
case 'port':
return defined( 'WPMS_SMTP_PORT' ) && WPMS_SMTP_PORT;
case 'encryption':
return defined( 'WPMS_SSL' );
case 'auth':
return defined( 'WPMS_SMTP_AUTH' ) && WPMS_SMTP_AUTH;
case 'autotls':
return defined( 'WPMS_SMTP_AUTOTLS' ) && WPMS_SMTP_AUTOTLS;
case 'user':
return defined( 'WPMS_SMTP_USER' ) && WPMS_SMTP_USER;
case 'pass':
return defined( 'WPMS_SMTP_PASS' ) && WPMS_SMTP_PASS;
}
break;
case 'gmail':
switch ( $key ) {
case 'client_id':
return defined( 'WPMS_GMAIL_CLIENT_ID' ) && WPMS_GMAIL_CLIENT_ID;
case 'client_secret':
return defined( 'WPMS_GMAIL_CLIENT_SECRET' ) && WPMS_GMAIL_CLIENT_SECRET;
}
break;
case 'mailgun':
switch ( $key ) {
case 'api_key':
return defined( 'WPMS_MAILGUN_API_KEY' ) && WPMS_MAILGUN_API_KEY;
case 'domain':
return defined( 'WPMS_MAILGUN_DOMAIN' ) && WPMS_MAILGUN_DOMAIN;
}
break;
case 'sendgrid':
switch ( $key ) {
case 'api_key':
return defined( 'WPMS_SENDGRID_API_KEY' ) && WPMS_SENDGRID_API_KEY;
}
break;
}
return false;
}
/**
* Set plugin options, all at once.
*
* @since 1.0.0
* @since 1.3.0 Added $once argument to save option only if they don't exist already.
*
* @param array $options Plugin options to save.
* @param bool $once Whether to update existing options or to add these options only once.
*/
public function set( $options, $once = false ) {
foreach ( (array) $options as $group => $keys ) {
foreach ( $keys as $key_name => $key_value ) {
switch ( $group ) {
case 'mail':
switch ( $key_name ) {
case 'from_name':
case 'mailer':
$options[ $group ][ $key_name ] = $this->get_const_value( $group, $key_name, wp_strip_all_tags( $options[ $group ][ $key_name ], true ) );
break;
case 'from_email':
if ( filter_var( $options[ $group ][ $key_name ], FILTER_VALIDATE_EMAIL ) ) {
$options[ $group ][ $key_name ] = $this->get_const_value( $group, $key_name, sanitize_email( $options[ $group ][ $key_name ] ) );
}
break;
case 'return_path':
$options[ $group ][ $key_name ] = $this->get_const_value( $group, $key_name, (bool) $options[ $group ][ $key_name ] );
break;
}
break;
case 'general':
switch ( $key_name ) {
case 'am_notifications_hidden':
$options[ $group ][ $key_name ] = (bool) $options[ $group ][ $key_name ];
break;
}
}
}
}
if (
isset( $options[ $options['mail']['mailer'] ] ) &&
in_array( $options['mail']['mailer'], array( 'pepipost', 'smtp', 'sendgrid', 'mailgun', 'gmail' ), true )
) {
$mailer = $options['mail']['mailer'];
foreach ( $options[ $mailer ] as $key_name => $key_value ) {
switch ( $key_name ) {
case 'host':
case 'user':
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, wp_strip_all_tags( $options[ $mailer ][ $key_name ], true ) );
break;
case 'port':
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, intval( $options[ $mailer ][ $key_name ] ) );
break;
case 'encryption':
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, wp_strip_all_tags( $options[ $mailer ][ $key_name ], true ) );
break;
case 'auth':
case 'autotls':
$value = $options[ $mailer ][ $key_name ] === 'yes' || $options[ $mailer ][ $key_name ] === true ? true : false;
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, $value );
break;
case 'pass':
case 'api_key':
case 'domain':
case 'client_id':
case 'client_secret':
case 'auth_code':
case 'access_token':
// Do not process as they may contain certain special characters, but allow to be overwritten using constants.
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, $options[ $mailer ][ $key_name ] );
break;
}
}
}
$options = apply_filters( 'wp_mail_smtp_options_set', $options );
// Whether to update existing options or to add these options only once if they don't exist yet.
if ( $once ) {
add_option( self::META_KEY, $options, '', 'no' ); // Do not autoload these options.
} else {
update_option( self::META_KEY, $options, 'no' );
}
// Now we need to re-cache values.
$this->populate_options();
}
/**
* Merge recursively, including a proper substitution of values in sub-arrays when keys are the same.
* It's more like array_merge() and array_merge_recursive() combined.
*
* @since 1.0.0
*
* @return array
*/
public static function array_merge_recursive() {
$arrays = func_get_args();
if ( count( $arrays ) < 2 ) {
return isset( $arrays[0] ) ? $arrays[0] : array();
}
$merged = array();
while ( $arrays ) {
$array = array_shift( $arrays );
if ( ! is_array( $array ) ) {
return array();
}
if ( empty( $array ) ) {
continue;
}
foreach ( $array as $key => $value ) {
if ( is_string( $key ) ) {
if (
is_array( $value ) &&
array_key_exists( $key, $merged ) &&
is_array( $merged[ $key ] )
) {
$merged[ $key ] = call_user_func( __METHOD__, $merged[ $key ], $value );
} else {
$merged[ $key ] = $value;
}
} else {
$merged[] = $value;
}
}
}
return $merged;
}
/**
* Check whether the site is using Pepipost or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_pepipost_active() {
return apply_filters( 'wp_mail_smtp_options_is_pepipost_active', $this->get( 'mail', 'mailer' ) === 'pepipost' );
}
/**
* Check whether the site is using Pepipost/SMTP as a mailer or not.
*
* @since 1.1.0
*
* @return bool
*/
public function is_mailer_smtp() {
return apply_filters( 'wp_mail_smtp_options_is_mailer_smtp', in_array( $this->get( 'mail', 'mailer' ), array( 'pepipost', 'smtp' ), true ) );
}
}

View File

@@ -0,0 +1,175 @@
<?php
namespace WPMailSMTP;
/**
* Class Processor modifies the behaviour of wp_mail() function.
*
* @since 1.0.0
*/
class Processor {
/**
* Processor constructor.
*
* @since 1.0.0
*/
public function __construct() {
$this->hooks();
}
/**
* Assign all hooks to proper places.
*
* @since 1.0.0
*/
public function hooks() {
add_action( 'phpmailer_init', array( $this, 'phpmailer_init' ) );
add_filter( 'wp_mail_from', array( $this, 'filter_mail_from_email' ) );
add_filter( 'wp_mail_from_name', array( $this, 'filter_mail_from_name' ), 11 );
}
/**
* Redefine certain PHPMailer options with our custom ones.
*
* @since 1.0.0
*
* @param \PHPMailer $phpmailer It's passed by reference, so no need to return anything.
*/
public function phpmailer_init( $phpmailer ) {
$options = new Options();
$mailer = $options->get( 'mail', 'mailer' );
// Check that mailer is not blank, and if mailer=smtp, host is not blank.
if (
! $mailer ||
( 'smtp' === $mailer && ! $options->get( 'smtp', 'host' ) )
) {
return;
}
// If the mailer is pepipost, make sure we have a username and password.
if (
'pepipost' === $mailer &&
( ! $options->get( 'pepipost', 'user' ) && ! $options->get( 'pepipost', 'pass' ) )
) {
return;
}
// Set the mailer type as per config above, this overrides the already called isMail method.
// It's basically always 'smtp'.
$phpmailer->Mailer = $mailer;
// Set the Sender (return-path) if required.
if ( $options->get( 'mail', 'return_path' ) ) {
$phpmailer->Sender = $phpmailer->From;
}
// Set the SMTPSecure value, if set to none, leave this blank. Possible values: 'ssl', 'tls', ''.
if ( 'none' === $options->get( $mailer, 'encryption' ) ) {
$phpmailer->SMTPSecure = '';
} else {
$phpmailer->SMTPSecure = $options->get( $mailer, 'encryption' );
}
// Check if user has disabled SMTPAutoTLS.
if ( $options->get( $mailer, 'encryption' ) !== 'tls' && ! $options->get( $mailer, 'autotls' ) ) {
$phpmailer->SMTPAutoTLS = false;
}
// If we're sending via SMTP, set the host.
if ( 'smtp' === $mailer ) {
// Set the other options.
$phpmailer->Host = $options->get( $mailer, 'host' );
$phpmailer->Port = $options->get( $mailer, 'port' );
// If we're using smtp auth, set the username & password.
if ( $options->get( $mailer, 'auth' ) ) {
$phpmailer->SMTPAuth = true;
$phpmailer->Username = $options->get( $mailer, 'user' );
$phpmailer->Password = $options->get( $mailer, 'pass' );
}
} elseif ( 'pepipost' === $mailer ) {
// Set the Pepipost settings for BC.
$phpmailer->Mailer = 'smtp';
$phpmailer->Host = 'smtp.pepipost.com';
$phpmailer->Port = $options->get( $mailer, 'port' );
$phpmailer->SMTPSecure = $options->get( $mailer, 'encryption' ) === 'none' ? '' : $options->get( $mailer, 'encryption' );
$phpmailer->SMTPAuth = true;
$phpmailer->Username = $options->get( $mailer, 'user' );
$phpmailer->Password = $options->get( $mailer, 'pass' );
}
// You can add your own options here.
// See the phpmailer documentation for more info: https://github.com/PHPMailer/PHPMailer/tree/5.2-stable.
/** @noinspection PhpUnusedLocalVariableInspection It's passed by reference. */
$phpmailer = apply_filters( 'wp_mail_smtp_custom_options', $phpmailer );
}
/**
* Modify the email address that is used for sending emails.
*
* @since 1.0.0
*
* @param string $email
*
* @return string
*/
public function filter_mail_from_email( $email ) {
// If the from email is not the default, return it unchanged.
if ( $email !== $this->get_default_email() ) {
return $email;
}
$from_email = Options::init()->get( 'mail', 'from_email' );
if ( ! empty( $from_email ) ) {
return $from_email;
}
return $email;
}
/**
* Modify the sender name that is used for sending emails.
*
* @since 1.0.0
*
* @param string $name
*
* @return string
*/
public function filter_mail_from_name( $name ) {
if ( 'WordPress' === $name ) {
$name = Options::init()->get( 'mail', 'from_name' );
}
return $name;
}
/**
* Get the default email address based on domain name.
*
* @since 1.0.0
*
* @return string
*/
public function get_default_email() {
// In case of CLI we don't have SERVER_NAME, so use host name instead, may be not a domain name.
$server_name = ! empty( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : wp_parse_url( get_home_url( get_current_blog_id() ), PHP_URL_HOST );
// Get the site domain and get rid of www.
$sitename = strtolower( $server_name );
if ( substr( $sitename, 0, 4 ) === 'www.' ) {
$sitename = substr( $sitename, 4 );
}
return 'wordpress@' . $sitename;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace WPMailSMTP\Providers;
/**
* Class AuthAbstract.
*
* @since 1.0.0
*/
abstract class AuthAbstract implements AuthInterface {
/**
* Get the url, that users will be redirected back to finish the OAuth process.
*
* @since 1.0.0
*
* @return string
*/
public static function get_plugin_auth_url() {
return add_query_arg( 'tab', 'auth', wp_mail_smtp()->get_admin()->get_admin_page_url() );
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace WPMailSMTP\Providers;
/**
* Interface AuthInterface.
*
* @since 1.0.0
*/
interface AuthInterface {
/**
* Do something for this Auth implementation.
*
* @since 1.0.0
*/
public function process();
}

View File

@@ -0,0 +1,321 @@
<?php
namespace WPMailSMTP\Providers\Gmail;
use WPMailSMTP\Debug;
use WPMailSMTP\Options as PluginOptions;
use WPMailSMTP\Providers\AuthAbstract;
/**
* Class Auth to request access and refresh tokens.
*
* @since 1.0.0
*/
class Auth extends AuthAbstract {
/**
* Gmail options.
*
* @var array
*/
private $gmail;
/**
* @var \Google_Client
*/
private $client;
/**
* @var string
*/
private $mailer;
/**
* Auth constructor.
*
* @since 1.0.0
*/
public function __construct() {
$options = new PluginOptions();
$this->mailer = $options->get( 'mail', 'mailer' );
if ( $this->mailer !== 'gmail' ) {
return;
}
$this->gmail = $options->get_group( $this->mailer );
if ( $this->is_clients_saved() ) {
$this->include_google_lib();
$this->client = $this->get_client();
}
}
/**
* Use the composer autoloader to include the Google Library and all its dependencies.
*
* @since 1.0.0
*/
protected function include_google_lib() {
require wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
}
/**
* Init and get the Google Client object.
*
* @since 1.0.0
*/
public function get_client() {
// Doesn't load client twice + gives ability to overwrite.
if ( ! empty( $this->client ) ) {
return $this->client;
}
$client = new \Google_Client(
array(
'client_id' => $this->gmail['client_id'],
'client_secret' => $this->gmail['client_secret'],
'redirect_uris' => array(
Auth::get_plugin_auth_url(),
),
)
);
$client->setAccessType( 'offline' );
$client->setApprovalPrompt( 'force' );
$client->setIncludeGrantedScopes( true );
// We request only the sending capability, as it's what we only need to do.
$client->setScopes( array( \Google_Service_Gmail::GMAIL_SEND ) );
$client->setRedirectUri( self::get_plugin_auth_url() );
if (
empty( $this->gmail['access_token'] ) &&
! empty( $this->gmail['auth_code'] )
) {
try {
$creds = $client->fetchAccessTokenWithAuthCode( $this->gmail['auth_code'] );
} catch ( \Exception $e ) {
$creds['error'] = $e->getMessage();
Debug::set( $e->getMessage() );
}
// Bail if we have an error.
if ( ! empty( $creds['error'] ) ) {
// TODO: save this error to display to a user later.
return $client;
}
$this->update_access_token( $client->getAccessToken() );
$this->update_refresh_token( $client->getRefreshToken() );
}
if ( ! empty( $this->gmail['access_token'] ) ) {
$client->setAccessToken( $this->gmail['access_token'] );
}
// Refresh the token if it's expired.
if ( $client->isAccessTokenExpired() ) {
$refresh = $client->getRefreshToken();
if ( empty( $refresh ) && isset( $this->gmail['refresh_token'] ) ) {
$refresh = $this->gmail['refresh_token'];
}
if ( ! empty( $refresh ) ) {
try {
$creds = $client->fetchAccessTokenWithRefreshToken( $refresh );
} catch ( \Exception $e ) {
$creds['error'] = $e->getMessage();
Debug::set( $e->getMessage() );
}
// Bail if we have an error.
if ( ! empty( $creds['error'] ) ) {
return $client;
}
$this->update_access_token( $client->getAccessToken() );
$this->update_refresh_token( $client->getRefreshToken() );
}
}
return $client;
}
/**
* Get the auth code from the $_GET and save it.
* Redirect user back to settings with an error message, if failed.
*
* @since 1.0.0
*/
public function process() {
// We can't process without saved client_id/secret.
if ( ! $this->is_clients_saved() ) {
Debug::set( 'There was an error while processing the Google authentication request. Please make sure that you have Client ID and Client Secret both valid and saved.' );
wp_redirect(
add_query_arg(
'error',
'google_no_clients',
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
$code = '';
$scope = '';
$error = '';
if ( isset( $_GET['error'] ) ) {
$error = sanitize_key( $_GET['error'] );
}
// In case of any error: display a message to a user.
if ( ! empty( $error ) ) {
wp_redirect(
add_query_arg(
'error',
'google_' . $error,
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
if ( isset( $_GET['code'] ) ) {
$code = $_GET['code'];
}
if ( isset( $_GET['scope'] ) ) {
$scope = urldecode( $_GET['scope'] );
}
// Let's try to get the access token.
if (
! empty( $code ) &&
(
$scope === ( \Google_Service_Gmail::GMAIL_SEND . ' ' . \Google_Service_Gmail::MAIL_GOOGLE_COM ) ||
$scope === \Google_Service_Gmail::GMAIL_SEND
)
) {
// Save the auth code. So \Google_Client can reuse it to retrieve the access token.
$this->update_auth_code( $code );
} else {
wp_redirect(
add_query_arg(
'error',
'google_no_code_scope',
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
wp_redirect(
add_query_arg(
'success',
'google_site_linked',
wp_mail_smtp()->get_admin()->get_admin_page_url()
)
);
exit;
}
/**
* Update access token in our DB.
*
* @since 1.0.0
*
* @param array $token
*/
protected function update_access_token( $token ) {
$options = new PluginOptions();
$all = $options->get_all();
$all[ $this->mailer ]['access_token'] = $token;
$this->gmail['access_token'] = $token;
$options->set( $all );
}
/**
* Update refresh token in our DB.
*
* @since 1.0.0
*
* @param array $token
*/
protected function update_refresh_token( $token ) {
$options = new PluginOptions();
$all = $options->get_all();
$all[ $this->mailer ]['refresh_token'] = $token;
$this->gmail['refresh_token'] = $token;
$options->set( $all );
}
/**
* Update auth code in our DB.
*
* @since 1.0.0
*
* @param string $code
*/
protected function update_auth_code( $code ) {
$options = new PluginOptions();
$all = $options->get_all();
$all[ $this->mailer ]['auth_code'] = $code;
$this->gmail['auth_code'] = $code;
$options->set( $all );
}
/**
* Get the auth URL used to proceed to Google to request access to send emails.
*
* @since 1.0.0
*
* @return string
*/
public function get_google_auth_url() {
if (
! empty( $this->client ) &&
class_exists( 'Google_Client', false ) &&
$this->client instanceof \Google_Client
) {
return filter_var( $this->client->createAuthUrl(), FILTER_SANITIZE_URL );
}
return '';
}
/**
* Whether user saved Client ID and Client Secret or not.
* Both options are required.
*
* @since 1.0.0
*
* @return bool
*/
public function is_clients_saved() {
return ! empty( $this->gmail['client_id'] ) && ! empty( $this->gmail['client_secret'] );
}
/**
* Whether we have an access and refresh tokens or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_auth_required() {
return empty( $this->gmail['access_token'] ) || empty( $this->gmail['refresh_token'] );
}
}

View File

@@ -0,0 +1,168 @@
<?php
namespace WPMailSMTP\Providers\Gmail;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcher;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer.
*
* @since 1.0.0
*/
class Mailer extends MailerAbstract {
/**
* URL to make an API request to.
* Not used for Gmail, as we are using its API.
*
* @var string
*/
protected $url = 'https://www.googleapis.com/upload/gmail/v1/users/userId/messages/send';
/**
* Gmail custom Auth library.
*
* @var Auth
*/
protected $auth;
/**
* Gmail message.
*
* @var \Google_Service_Gmail_Message
*/
protected $message;
/**
* Mailer constructor.
*
* @since 1.0.0
*
* @param \WPMailSMTP\MailCatcher $phpmailer
*/
public function __construct( $phpmailer ) {
parent::__construct( $phpmailer );
if ( ! $this->is_php_compatible() ) {
return;
}
// Include the Google library.
require wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
$this->auth = new Auth();
$this->message = new \Google_Service_Gmail_Message();
}
/**
* Re-use the MailCatcher class methods and properties.
*
* @since 1.2.0
*
* @param \WPMailSMTP\MailCatcher $phpmailer
*/
public function process_phpmailer( $phpmailer ) {
// Make sure that we have access to MailCatcher class methods.
if (
! $phpmailer instanceof MailCatcher &&
! $phpmailer instanceof \PHPMailer
) {
return;
}
$this->phpmailer = $phpmailer;
}
/**
* Use Google API Services to send emails.
*
* @since 1.0.0
*/
public function send() {
// Get the raw MIME email using \MailCatcher data.
$base64 = base64_encode( $this->phpmailer->getSentMIMEMessage() );
$base64 = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $base64 ); // url safe.
$this->message->setRaw( $base64 );
$service = new \Google_Service_Gmail( $this->auth->get_client() );
try {
$response = $service->users_messages->send( 'me', $this->message );
$this->process_response( $response );
} catch ( \Exception $e ) {
Debug::set( 'Error while sending via Gmail mailer: ' . $e->getMessage() );
return;
}
}
/**
* Save response from the API to use it later.
*
* @since 1.0.0
*
* @param \Google_Service_Gmail_Message $response
*/
protected function process_response( $response ) {
$this->response = $response;
}
/**
* Check whether the email was sent.
*
* @since 1.0.0
*
* @return bool
*/
public function is_email_sent() {
$is_sent = false;
if ( method_exists( $this->response, 'getId' ) ) {
$message_id = $this->response->getId();
if ( ! empty( $message_id ) ) {
return true;
}
}
return $is_sent;
}
/**
* @inheritdoc
*/
public function get_debug_info() {
$gmail_text = array();
$options = new \WPMailSMTP\Options();
$gmail = $options->get_group( 'gmail' );
$gmail_text[] = '<strong>Client ID/Secret:</strong> ' . ( ! empty( $gmail['client_id'] ) && ! empty( $gmail['client_secret'] ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>Auth Code:</strong> ' . ( ! empty( $gmail['auth_code'] ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>Access Token:</strong> ' . ( ! empty( $gmail['access_token'] ) ? 'Yes' : 'No' );
$gmail_text[] = '<br><strong>Server:</strong>';
$gmail_text[] = '<strong>OpenSSL:</strong> ' . ( extension_loaded( 'openssl' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.allow_url_fopen:</strong> ' . ( ini_get( 'allow_url_fopen' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.stream_socket_client():</strong> ' . ( function_exists( 'stream_socket_client' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.fsockopen():</strong> ' . ( function_exists( 'fsockopen' ) ? 'Yes' : 'No' );
$gmail_text[] = '<strong>PHP.curl_version():</strong> ' . ( function_exists( 'curl_version' ) ? 'Yes' : 'No' );
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$gmail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$gmail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $gmail_text );
}
}

View File

@@ -0,0 +1,131 @@
<?php
namespace WPMailSMTP\Providers\Gmail;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Mailgun constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->plugin_url . '/assets/images/gmail.png',
'slug' => 'gmail',
'title' => esc_html__( 'Gmail', 'wp-mail-smtp' ),
'description' => sprintf(
wp_kses(
/* translators: %1$s - opening link tag; %2$s - closing link tag. */
__( 'Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our %1$sGmail documentation%2$s to learn how to configure Gmail or G Suite.', 'wp-mail-smtp' ),
array(
'br' => array(),
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'<a href="https://wpforms.com/how-to-securely-send-wordpress-emails-using-gmail-smtp/" target="_blank" rel="noopener noreferrer">',
'</a>'
),
'php' => '5.5',
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
// Do not display options if PHP version is not correct.
if ( ! $this->is_php_correct() ) {
$this->display_php_warning();
return;
}
?>
<!-- Client ID -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_id" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_id"><?php esc_html_e( 'Client ID', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][client_id]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'client_id' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'client_id' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_id" spellcheck="false"
/>
</div>
</div>
<!-- Client Secret -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"><?php esc_html_e( 'Client Secret', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][client_secret]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'client_secret' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'client_secret' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret" spellcheck="false"
/>
</div>
</div>
<!-- Authorized redirect URI -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"><?php esc_html_e( 'Authorized redirect URI', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input type="text" readonly="readonly"
value="<?php echo esc_attr( Auth::get_plugin_auth_url() ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"
/>
<button type="button" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-light-grey wp-mail-smtp-setting-copy"
title="<?php esc_attr_e( 'Copy URL to clipboard', 'wp-mail-smtp' ); ?>"
data-source_id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect">
<span class="dashicons dashicons-admin-page"></span>
</button>
<p class="desc">
<?php esc_html_e( 'This is the path on your site that you will be redirected to after you have authenticated with Google.', 'wp-mail-smtp' ); ?>
<br>
<?php esc_html_e( 'You need to copy this URL into "Authorized redirect URIs" field for you web application on Google APIs site for your project there.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- Auth users button -->
<?php $auth = new Auth(); ?>
<?php if ( $auth->is_clients_saved() && $auth->is_auth_required() ) : ?>
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-authorize" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label><?php esc_html_e( 'Authorize', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<a href="<?php echo esc_url( $auth->get_google_auth_url() ); ?>" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange">
<?php esc_html_e( 'Allow plugin to send emails using your Google account', 'wp-mail-smtp' ); ?>
</a>
<p class="desc">
<?php esc_html_e( 'Click the button above to confirm authorization.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<?php endif; ?>
<?php
}
}

View File

@@ -0,0 +1,188 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcher;
use WPMailSMTP\Options;
/**
* Class Loader.
*
* @since 1.0.0
*/
class Loader {
/**
* Key is the mailer option, value is the path to its classes.
*
* @var array
*/
protected $providers = array(
'mail' => 'WPMailSMTP\Providers\Mail\\',
'gmail' => 'WPMailSMTP\Providers\Gmail\\',
'mailgun' => 'WPMailSMTP\Providers\Mailgun\\',
'sendgrid' => 'WPMailSMTP\Providers\Sendgrid\\',
'pepipost' => 'WPMailSMTP\Providers\Pepipost\\',
'smtp' => 'WPMailSMTP\Providers\SMTP\\',
);
/**
* @var \WPMailSMTP\MailCatcher
*/
private $phpmailer;
/**
* Get all the supported providers.
*
* @since 1.0.0
*
* @return array
*/
public function get_providers() {
if ( ! Options::init()->is_pepipost_active() ) {
unset( $this->providers['pepipost'] );
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers', $this->providers );
}
/**
* Get a single provider FQN-path based on its name.
*
* @since 1.0.0
*
* @param string $provider
*
* @return array
*/
public function get_provider_path( $provider ) {
$provider = sanitize_key( $provider );
return apply_filters(
'wp_mail_smtp_providers_loader_get_provider_path',
isset( $this->providers[ $provider ] ) ? $this->providers[ $provider ] : null,
$provider
);
}
/**
* Get the provider options, if exists.
*
* @since 1.0.0
*
* @param string $provider
*
* @return \WPMailSMTP\Providers\OptionsAbstract|null
*/
public function get_options( $provider ) {
return $this->get_entity( $provider, 'Options' );
}
/**
* Get all options of all providers.
*
* @since 1.0.0
*
* @return \WPMailSMTP\Providers\OptionsAbstract[]
*/
public function get_options_all() {
$options = array();
foreach ( $this->get_providers() as $provider => $path ) {
$option = $this->get_options( $provider );
if ( ! $option instanceof OptionsAbstract ) {
continue;
}
$slug = $option->get_slug();
$title = $option->get_title();
if ( empty( $title ) || empty( $slug ) ) {
continue;
}
$options[] = $option;
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers_all', $options );
}
/**
* Get the provider mailer, if exists.
*
* @since 1.0.0
*
* @param string $provider
* @param MailCatcher $phpmailer
*
* @return \WPMailSMTP\Providers\MailerAbstract|null
*/
public function get_mailer( $provider, $phpmailer ) {
if (
$phpmailer instanceof MailCatcher ||
$phpmailer instanceof \PHPMailer
) {
$this->phpmailer = $phpmailer;
}
return $this->get_entity( $provider, 'Mailer' );
}
/**
* Get the provider auth, if exists.
*
* @param string $provider
*
* @return \WPMailSMTP\Providers\AuthAbstract|null
*/
public function get_auth( $provider ) {
return $this->get_entity( $provider, 'Auth' );
}
/**
* Get a generic entity based on the request.
*
* @uses ReflectionClass
*
* @since 1.0.0
*
* @param string $provider
* @param string $request
*
* @return null
*/
protected function get_entity( $provider, $request ) {
$provider = sanitize_key( $provider );
$request = sanitize_text_field( $request );
$path = $this->get_provider_path( $provider );
$entity = null;
if ( empty( $path ) ) {
return $entity;
}
try {
$reflection = new \ReflectionClass( $path . $request );
if ( file_exists( $reflection->getFileName() ) ) {
$class = $path . $request;
if ( $this->phpmailer ) {
$entity = new $class( $this->phpmailer );
} else {
$entity = new $class();
}
}
} catch ( \Exception $e ) {
Debug::set( "There was a problem while retrieving {$request} for {$provider}: {$e->getMessage()}" );
$entity = null;
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_entity', $entity, $provider, $request );
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace WPMailSMTP\Providers\Mail;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer inherits everything from parent abstract class.
* This file is required for a proper work of Loader and \ReflectionClass.
*
* @package WPMailSMTP\Providers\Mail
*/
class Mailer extends MailerAbstract {
/**
* @inheritdoc
*/
public function get_debug_info() {
$mail_text = array();
$mail_text[] = '<br><strong>Server:</strong>';
$disabled_functions = ini_get( 'disable_functions' );
$disabled = (array) explode( ',', trim( $disabled_functions ) );
$mail_text[] = '<strong>PHP.mail():</strong> ' . ( in_array( 'mail', $disabled, true ) || ! function_exists( 'mail' ) ? 'No' : 'Yes' );
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$mail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$mail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $mail_text );
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace WPMailSMTP\Providers\Mail;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Mail constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->plugin_url . '/assets/images/php.png',
'slug' => 'mail',
'title' => esc_html__( 'Default (none)', 'wp-mail-smtp' ),
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<blockquote>
<?php esc_html_e( 'You currently have the native WordPress option selected. Please select any other Mailer option above to continue the setup.', 'wp-mail-smtp' ); ?>
</blockquote>
<?php
}
}

View File

@@ -0,0 +1,372 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Debug;
use WPMailSMTP\MailCatcher;
use WPMailSMTP\Options;
/**
* Class MailerAbstract.
*
* @since 1.0.0
*/
abstract class MailerAbstract implements MailerInterface {
/**
* Which response code from HTTP provider is considered to be successful?
*
* @var int
*/
protected $email_sent_code = 200;
/**
* @var Options
*/
protected $options;
/**
* @var MailCatcher
*/
protected $phpmailer;
/**
* @var string
*/
protected $mailer = '';
/**
* URL to make an API request to.
*
* @var string
*/
protected $url = '';
/**
* @var array
*/
protected $headers = array();
/**
* @var array
*/
protected $body = array();
/**
* @var mixed
*/
protected $response = array();
/**
* Mailer constructor.
*
* @since 1.0.0
*
* @param MailCatcher $phpmailer
*/
public function __construct( MailCatcher $phpmailer ) {
$this->options = new Options();
$this->mailer = $this->options->get( 'mail', 'mailer' );
// Only non-SMTP mailers need URL.
if ( ! $this->options->is_mailer_smtp() && empty( $this->url ) ) {
return;
}
$this->process_phpmailer( $phpmailer );
}
/**
* Re-use the MailCatcher class methods and properties.
*
* @since 1.0.0
*
* @param MailCatcher $phpmailer
*/
public function process_phpmailer( $phpmailer ) {
// Make sure that we have access to MailCatcher class methods.
if (
! $phpmailer instanceof MailCatcher &&
! $phpmailer instanceof \PHPMailer
) {
return;
}
$this->phpmailer = $phpmailer;
// Prevent working with those methods, as they are not needed for SMTP-like mailers.
if ( $this->options->is_mailer_smtp() ) {
return;
}
$this->set_headers( $this->phpmailer->getCustomHeaders() );
$this->set_from( $this->phpmailer->From, $this->phpmailer->FromName );
$this->set_recipients(
array(
'to' => $this->phpmailer->getToAddresses(),
'cc' => $this->phpmailer->getCcAddresses(),
'bcc' => $this->phpmailer->getBccAddresses(),
)
);
$this->set_subject( $this->phpmailer->Subject );
$this->set_content(
array(
'html' => $this->phpmailer->Body,
'text' => $this->phpmailer->AltBody,
)
);
$this->set_return_path( $this->phpmailer->From );
$this->set_reply_to( $this->phpmailer->getReplyToAddresses() );
/*
* In some cases we will need to modify the internal structure
* of the body content, if attachments are present.
* So lets make this call the last one.
*/
$this->set_attachments( $this->phpmailer->getAttachments() );
}
/**
* @inheritdoc
*/
public function set_subject( $subject ) {
$this->set_body_param(
array(
'subject' => $subject,
)
);
}
/**
* Set the request params, that goes to the body of the HTTP request.
*
* @since 1.0.0
*
* @param array $param Key=>value of what should be sent to a 3rd party API.
*
* @internal param array $params
*/
protected function set_body_param( $param ) {
$this->body = Options::array_merge_recursive( $this->body, $param );
}
/**
* @inheritdoc
*/
public function set_headers( $headers ) {
foreach ( $headers as $header ) {
$name = isset( $header[0] ) ? $header[0] : false;
$value = isset( $header[1] ) ? $header[1] : false;
if ( empty( $name ) || empty( $value ) ) {
continue;
}
$this->set_header( $name, $value );
}
}
/**
* @inheritdoc
*/
public function set_header( $name, $value ) {
$process_value = function ( $value ) {
// Remove HTML tags.
$filtered = wp_strip_all_tags( $value, false );
// Remove multi-lines/tabs.
$filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
// Remove whitespaces.
$filtered = trim( $filtered );
// Remove octets.
$found = false;
while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) {
$filtered = str_replace( $match[0], '', $filtered );
$found = true;
}
if ( $found ) {
// Strip out the whitespace that may now exist after removing the octets.
$filtered = trim( preg_replace( '/ +/', ' ', $filtered ) );
}
return $filtered;
};
$name = sanitize_text_field( $name );
if ( empty( $name ) ) {
return;
}
$value = $process_value( $value );
$this->headers[ $name ] = $value;
}
/**
* @inheritdoc
*/
public function get_body() {
return apply_filters( 'wp_mail_smtp_providers_mailer_get_body', $this->body );
}
/**
* @inheritdoc
*/
public function get_headers() {
return apply_filters( 'wp_mail_smtp_providers_mailer_get_headers', $this->headers );
}
/**
* @inheritdoc
*/
public function send() {
$params = Options::array_merge_recursive( $this->get_default_params(), array(
'headers' => $this->get_headers(),
'body' => $this->get_body(),
) );
$response = wp_safe_remote_post( $this->url, $params );
$this->process_response( $response );
}
/**
* We might need to do something after the email was sent to the API.
* In this method we preprocess the response from the API.
*
* @since 1.0.0
*
* @param array|\WP_Error $response
*/
protected function process_response( $response ) {
if ( is_wp_error( $response ) ) {
// Save the error text.
$errors = $response->get_error_messages();
foreach ( $errors as $error ) {
Debug::set( $error );
}
return;
}
if ( isset( $response['body'] ) && $this->is_json( $response['body'] ) ) {
$response['body'] = \json_decode( $response['body'] );
}
$this->response = $response;
}
/**
* Get the default params, required for wp_safe_remote_post().
*
* @since 1.0.0
*
* @return array
*/
protected function get_default_params() {
return apply_filters( 'wp_mail_smtp_providers_mailer_get_default_params', array(
'timeout' => 15,
'httpversion' => '1.1',
'blocking' => true,
) );
}
/**
* @inheritdoc
*/
public function is_email_sent() {
$is_sent = false;
if ( wp_remote_retrieve_response_code( $this->response ) === $this->email_sent_code ) {
$is_sent = true;
} else {
$error = $this->get_response_error();
if ( ! empty( $error ) ) {
Debug::set( $error );
}
}
return apply_filters( 'wp_mail_smtp_providers_mailer_is_email_sent', $is_sent );
}
/**
* Should be overwritten when appropriate.
*
* @since 1.2.0
*
* @return string
*/
protected function get_response_error() {
return '';
}
/**
* @inheritdoc
*/
public function is_php_compatible() {
$options = wp_mail_smtp()->get_providers()->get_options( $this->mailer );
return version_compare( phpversion(), $options->get_php_version(), '>=' );
}
/**
* Check whether the string is a JSON or not.
*
* @since 1.0.0
*
* @param string $string
*
* @return bool
*/
protected function is_json( $string ) {
return is_string( $string ) && is_array( json_decode( $string, true ) ) && ( json_last_error() === JSON_ERROR_NONE ) ? true : false;
}
/**
* This method is relevant to SMTP and Pepipost.
* All other custom mailers should override it with own information.
*
* @since 1.2.0
*
* @return string
*/
public function get_debug_info() {
global $phpmailer;
$smtp_text = array();
// Mail mailer has nothing to return.
if ( $this->options->is_mailer_smtp() ) {
$smtp_text[] = '<strong>ErrorInfo:</strong> ' . make_clickable( wp_strip_all_tags( $phpmailer->ErrorInfo ) );
$smtp_text[] = '<strong>Host:</strong> ' . $phpmailer->Host;
$smtp_text[] = '<strong>Port:</strong> ' . $phpmailer->Port;
$smtp_text[] = '<strong>SMTPSecure:</strong> ' . Debug::pvar( $phpmailer->SMTPSecure );
$smtp_text[] = '<strong>SMTPAutoTLS:</strong> ' . Debug::pvar( $phpmailer->SMTPAutoTLS );
$smtp_text[] = '<strong>SMTPAuth:</strong> ' . Debug::pvar( $phpmailer->SMTPAuth );
if ( ! empty( $phpmailer->SMTPOptions ) ) {
$smtp_text[] = '<strong>SMTPOptions:</strong> <code>' . json_encode( $phpmailer->SMTPOptions ) . '</code>';
}
}
$smtp_text[] = '<br><strong>Server:</strong>';
$smtp_text[] = '<strong>OpenSSL:</strong> ' . ( extension_loaded( 'openssl' ) ? 'Yes' : 'No' );
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$smtp_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$smtp_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$smtp_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $smtp_text );
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace WPMailSMTP\Providers;
/**
* Interface MailerInterface.
*
* @since 1.0.0
*/
interface MailerInterface {
/**
* Send the email.
*
* @since 1.0.0
*/
public function send();
/**
* Whether the email is sent or not.
* We basically check the response code from a request to provider.
* Might not be 100% correct, not guarantees that email is delivered.
*
* @since 1.0.0
*
* @return bool
*/
public function is_email_sent();
/**
* Whether the mailer supports the current PHP version or not.
*
* @since 1.0.0
*
* @return bool
*/
public function is_php_compatible();
/**
* Get the email body.
*
* @since 1.0.0
*
* @return string|array
*/
public function get_body();
/**
* Get the email headers.
*
* @since 1.0.0
*
* @return array
*/
public function get_headers();
/**
* Get an array of all debug information relevant to the mailer.
*
* @since 1.2.0
*
* @return array
*/
public function get_debug_info();
/**
* Re-use the MailCatcher class methods and properties.
*
* @since 1.2.0
*
* @param \WPMailSMTP\MailCatcher $phpmailer
*/
public function process_phpmailer( $phpmailer );
}

View File

@@ -0,0 +1,344 @@
<?php
namespace WPMailSMTP\Providers\Mailgun;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer.
*
* @since 1.0.0
*/
class Mailer extends MailerAbstract {
/**
* Which response code from HTTP provider is considered to be successful?
*
* @var int
*/
protected $email_sent_code = 200;
/**
* URL to make an API request to.
*
* @var string
*/
protected $url = 'https://api.mailgun.net/v3/';
/**
* @inheritdoc
*/
public function __construct( $phpmailer ) {
// We want to prefill everything from \WPMailSMTP\MailCatcher class, which extends \PHPMailer.
parent::__construct( $phpmailer );
/*
* Append the url with a domain,
* to avoid passing the domain name as a query parameter with all requests.
*/
$this->url .= sanitize_text_field( $this->options->get( $this->mailer, 'domain' ) . '/messages' );
$this->set_header( 'Authorization', 'Basic ' . base64_encode( 'api:' . $this->options->get( $this->mailer, 'api_key' ) ) );
}
/**
* @inheritdoc
*/
public function set_from( $email, $name = '' ) {
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
return;
}
if ( ! empty( $name ) ) {
$this->set_body_param(
array(
'from' => $name . ' <' . $email . '>',
)
);
} else {
$this->set_body_param(
array(
'from' => $email,
)
);
}
}
/**
* @inheritdoc
*/
public function set_recipients( $recipients ) {
if ( empty( $recipients ) ) {
return;
}
$default = array( 'to', 'cc', 'bcc' );
foreach ( $recipients as $kind => $emails ) {
if (
! in_array( $kind, $default, true ) ||
empty( $emails ) ||
! is_array( $emails )
) {
continue;
}
$data = array();
foreach ( $emails as $email ) {
$addr = isset( $email[0] ) ? $email[0] : false;
$name = isset( $email[1] ) ? $email[1] : false;
if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
continue;
}
if ( ! empty( $name ) ) {
$data[] = $name . ' <' . $addr . '>';
} else {
$data[] = $addr;
}
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
$kind => implode( ', ', $data ),
)
);
}
}
}
/**
* @inheritdoc
*/
public function set_content( $content ) {
if ( is_array( $content ) ) {
$default = array( 'text', 'html' );
foreach ( $content as $type => $mail ) {
if (
! in_array( $type, $default, true ) ||
empty( $mail )
) {
continue;
}
$this->set_body_param(
array(
$type => $mail,
)
);
}
} else {
$type = 'text';
if ( $this->phpmailer->ContentType === 'text/html' ) {
$type = 'html';
}
if ( ! empty( $content ) ) {
$this->set_body_param(
array(
$type => $content,
)
);
}
}
}
/**
* It's the last one, so we can modify the whole body.
*
* @since 1.0.0
*
* @param array $attachments
*/
public function set_attachments( $attachments ) {
if ( empty( $attachments ) ) {
return;
}
$payload = '';
$data = array();
foreach ( $attachments as $attachment ) {
$file = false;
/*
* We are not using WP_Filesystem API as we can't reliably work with it.
* It is not always available, same as credentials for FTP.
*/
try {
if ( is_file( $attachment[0] ) && is_readable( $attachment[0] ) ) {
$file = file_get_contents( $attachment[0] );
}
} catch ( \Exception $e ) {
$file = false;
}
if ( $file === false ) {
continue;
}
$data[] = array(
'content' => $file,
'name' => $attachment[1],
);
}
if ( ! empty( $data ) ) {
// First, generate a boundary for the multipart message.
$boundary = base_convert( uniqid( 'boundary', true ), 10, 36 );
// Iterate through pre-built params and build a payload.
foreach ( $this->body as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $child_key => $child_value ) {
$payload .= '--' . $boundary;
$payload .= "\r\n";
$payload .= 'Content-Disposition: form-data; name="' . $key . "\"\r\n\r\n";
$payload .= $child_value;
$payload .= "\r\n";
}
} else {
$payload .= '--' . $boundary;
$payload .= "\r\n";
$payload .= 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n";
$payload .= $value;
$payload .= "\r\n";
}
}
// Now iterate through our attachments, and add them too.
foreach ( $data as $key => $attachment ) {
$payload .= '--' . $boundary;
$payload .= "\r\n";
$payload .= 'Content-Disposition: form-data; name="attachment[' . $key . ']"; filename="' . $attachment['name'] . '"' . "\r\n\r\n";
$payload .= $attachment['content'];
$payload .= "\r\n";
}
$payload .= '--' . $boundary . '--';
// Redefine the body the "dirty way".
$this->body = $payload;
$this->set_header( 'Content-Type', 'multipart/form-data; boundary=' . $boundary );
}
}
/**
* @inheritdoc
*/
public function set_reply_to( $reply_to ) {
if ( empty( $reply_to ) ) {
return;
}
$data = array();
foreach ( $reply_to as $key => $emails ) {
if (
empty( $emails ) ||
! is_array( $emails )
) {
continue;
}
$addr = isset( $emails[0] ) ? $emails[0] : false;
$name = isset( $emails[1] ) ? $emails[1] : false;
if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
continue;
}
if ( ! empty( $name ) ) {
$data[] = $name . ' <' . $addr . '>';
} else {
$data[] = $addr;
}
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
'h:Reply-To' => implode( ',', $data ),
)
);
}
}
/**
* @inheritdoc
*/
public function set_return_path( $email ) {
if (
$this->options->get( 'mail', 'return_path' ) !== true ||
! filter_var( $email, FILTER_VALIDATE_EMAIL )
) {
return;
}
$this->set_body_param(
array(
'sender' => $email,
)
);
}
/**
* Get a Mailgun-specific response with a helpful error.
*
* @since 1.2.0
*
* @return string
*/
protected function get_response_error() {
$body = (array) wp_remote_retrieve_body( $this->response );
$error_text = array();
if ( ! empty( $body['message'] ) ) {
if ( is_string( $body['message'] ) ) {
$error_text[] = $body['message'];
} else {
$error_text[] = \json_encode( $body['message'] );
}
} elseif ( ! empty( $body[0] ) ) {
if ( is_string( $body[0] ) ) {
$error_text[] = $body[0];
} else {
$error_text[] = \json_encode( $body[0] );
}
}
return implode( '<br>', array_map( 'esc_textarea', $error_text ) );
}
/**
* @inheritdoc
*/
public function get_debug_info() {
$mg_text = array();
$options = new \WPMailSMTP\Options();
$mailgun = $options->get_group( 'mailgun' );
$mg_text[] = '<strong>Api Key / Domain:</strong> ' . ( ! empty( $mailgun['api_key'] ) && ! empty( $mailgun['domain'] ) ? 'Yes' : 'No' );
return implode( '<br>', $mg_text );
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace WPMailSMTP\Providers\Mailgun;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Mailgun constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->plugin_url . '/assets/images/mailgun.png',
'slug' => 'mailgun',
'title' => esc_html__( 'Mailgun', 'wp-mail-smtp' ),
'description' => sprintf(
wp_kses(
/* translators: %1$s - opening link tag; %2$s - closing link tag; %3$s - opening link tag; %4$s - closing link tag. */
__( '%1$sMailgun%2$s is one of the leading transactional email services trusted by over 10,000 website and application developers. They provide users 10,000 free emails per month.<br><br>Read our %3$sMailgun documentation%4$s to learn how to configure Mailgun and improve your email deliverability.', 'wp-mail-smtp' ),
array(
'br' => array(),
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'<a href="https://www.mailgun.com" target="_blank" rel="noopener noreferrer">',
'</a>',
'<a href="https://wpforms.com/how-to-send-wordpress-emails-with-mailgun/" target="_blank" rel="noopener noreferrer">',
'</a>'
),
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<!-- API Key -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'Private API Key', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'api_key' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" spellcheck="false"
/>
<p class="desc">
<?php
printf(
/* translators: %s - API key link. */
esc_html__( 'Follow this link to get an API Key from Mailgun: %s.', 'wp-mail-smtp' ),
'<a href="https://app.mailgun.com/app/account/security" target="_blank" rel="noopener noreferrer">' .
esc_html__( 'Get a Private API Key', 'wp-mail-smtp' ) .
'</a>'
);
?>
</p>
</div>
</div>
<!-- Domain -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-domain" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-domain"><?php esc_html_e( 'Domain Name', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][domain]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'domain' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'domain' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-domain" spellcheck="false"
/>
<p class="desc">
<?php
printf(
/* translators: %s - Domain Name link. */
esc_html__( 'Follow this link to get a Domain Name from Mailgun: %s.', 'wp-mail-smtp' ),
'<a href="https://app.mailgun.com/app/domains" target="_blank" rel="noopener noreferrer">' .
esc_html__( 'Get a Domain Name', 'wp-mail-smtp' ) .
'</a>'
);
?>
</p>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,312 @@
<?php
namespace WPMailSMTP\Providers;
use WPMailSMTP\Options;
/**
* Abstract Class ProviderAbstract to contain common providers functionality.
*
* @since 1.0.0
*/
abstract class OptionsAbstract implements OptionsInterface {
/**
* @var string
*/
private $logo_url = '';
/**
* @var string
*/
private $slug = '';
/**
* @var string
*/
private $title = '';
/**
* @var string
*/
private $description = '';
/**
* @var string
*/
private $php = WPMS_PHP_VER;
/**
* @var Options
*/
protected $options;
/**
* ProviderAbstract constructor.
*
* @since 1.0.0
*
* @param array $params
*/
public function __construct( $params ) {
if (
empty( $params['slug'] ) ||
empty( $params['title'] )
) {
return;
}
$this->slug = sanitize_key( $params['slug'] );
$this->title = sanitize_text_field( $params['title'] );
if ( ! empty( $params['description'] ) ) {
$this->description = wp_kses( $params['description'],
array(
'br' => array(),
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
);
}
if ( ! empty( $params['php'] ) ) {
$this->php = sanitize_text_field( $params['php'] );
}
if ( ! empty( $params['logo_url'] ) ) {
$this->logo_url = esc_url_raw( $params['logo_url'] );
}
$this->options = new Options();
}
/**
* @inheritdoc
*/
public function get_logo_url() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_logo_url', $this->logo_url, $this );
}
/**
* @inheritdoc
*/
public function get_slug() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_slug', $this->slug, $this );
}
/**
* @inheritdoc
*/
public function get_title() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_title', $this->title, $this );
}
/**
* @inheritdoc
*/
public function get_description() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_description', $this->description, $this );
}
/**
* @inheritdoc
*/
public function get_php_version() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_php_version', $this->php, $this );
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<!-- SMTP Host -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-host" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-host"><?php esc_html_e( 'SMTP Host', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][host]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'host' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'host' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-host" spellcheck="false"
/>
</div>
</div>
<!-- SMTP Port -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-port" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-number wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-port"><?php esc_html_e( 'SMTP Port', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][port]" type="number"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'port' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'port' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-port" class="small-text" spellcheck="false"
/>
</div>
</div>
<!-- SMTP Encryption -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-encryption" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-radio wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label><?php esc_html_e( 'Encryption', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-none">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-none"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][encryption]" value="none"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) ? 'disabled' : ''; ?>
<?php checked( 'none', $this->options->get( $this->get_slug(), 'encryption' ) ); ?>
/>
<?php esc_html_e( 'None', 'wp-mail-smtp' ); ?>
</label>
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-ssl">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-ssl"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][encryption]" value="ssl"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) ? 'disabled' : ''; ?>
<?php checked( 'ssl', $this->options->get( $this->get_slug(), 'encryption' ) ); ?>
/>
<?php esc_html_e( 'SSL', 'wp-mail-smtp' ); ?>
</label>
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-tls">
<input type="radio" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-enc-tls"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][encryption]" value="tls"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) ? 'disabled' : ''; ?>
<?php checked( 'tls', $this->options->get( $this->get_slug(), 'encryption' ) ); ?>
/>
<?php esc_html_e( 'TLS', 'wp-mail-smtp' ); ?>
</label>
<p class="desc">
<?php esc_html_e( 'For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- PHPMailer SMTPAutoTLS -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-autotls" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox-toggle wp-mail-smtp-clear <?php echo $this->options->is_const_defined( $this->get_slug(), 'encryption' ) || 'tls' === $this->options->get( $this->get_slug(), 'encryption' ) ? 'inactive' : ''; ?>">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls"><?php esc_html_e( 'Auto TLS', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls">
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][autotls]" value="yes"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'autotls' ) ? 'disabled' : ''; ?>
<?php checked( true, (bool) $this->options->get( $this->get_slug(), 'autotls' ) ); ?>
/>
<span class="wp-mail-smtp-setting-toggle-switch"></span>
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
<span class="wp-mail-smtp-setting-toggle-unchecked-label"><?php esc_html_e( 'Off', 'wp-mail-smtp' ); ?></span>
</label>
<p class="desc">
<?php esc_html_e( 'By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled.', 'wp-mail-smtp' ); ?>
</p>
</div>
</div>
<!-- SMTP Authentication -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-auth" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox-toggle wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth"><?php esc_html_e( 'Authentication', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth">
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth"
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][auth]" value="yes"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'auth' ) ? 'disabled' : ''; ?>
<?php checked( true, (bool) $this->options->get( $this->get_slug(), 'auth' ) ); ?>
/>
<span class="wp-mail-smtp-setting-toggle-switch"></span>
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
<span class="wp-mail-smtp-setting-toggle-unchecked-label"><?php esc_html_e( 'Off', 'wp-mail-smtp' ); ?></span>
</label>
</div>
</div>
<!-- SMTP Username -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-user" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear <?php echo ! $this->options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-user"><?php esc_html_e( 'SMTP Username', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][user]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'user' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'user' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-user" spellcheck="false" autocomplete="off"
/>
</div>
</div>
<!-- SMTP Password -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-pass" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-password wp-mail-smtp-clear <?php echo ! $this->options->is_const_defined( $this->get_slug(), 'auth' ) && ! $this->options->get( $this->get_slug(), 'auth' ) ? 'inactive' : ''; ?>">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass"><?php esc_html_e( 'SMTP Password', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<?php if ( $this->options->is_const_defined( $this->get_slug(), 'pass' ) ) : ?>
<input type="text" value="*************" disabled id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass"/>
<?php else : ?>
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][pass]" type="password"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'pass' ) ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass" spellcheck="false" autocomplete="off"
/>
<p class="desc">
<?php
printf(
/* translators: %s - wp-config.php. */
esc_html__( 'The password is stored in plain text. We highly recommend you setup your password in your WordPress configuration file for improved security; to do this add the lines below to your %s file.', 'wp-mail-smtp' ),
'<code>wp-config.php</code>'
);
?>
</p>
<pre>
define( 'WPMS_ON', true );
define( 'WPMS_SMTP_PASS', 'your_password' );
</pre>
<?php endif; ?>
</div>
</div>
<?php
}
/**
* Check whether we can use this provider based on the PHP version.
* Valid for those, that use SDK.
*
* @return bool
*/
protected function is_php_correct() {
return version_compare( phpversion(), $this->php, '>=' );
}
/**
* Display a helpful message to those users, that are using an outdated version of PHP,
* which is not supported by the currently selected Provider.
*/
protected function display_php_warning() {
?>
<blockquote>
<?php
printf(
/* translators: %1$s - Provider name; %2$s - PHP version required by Provider; %3$s - current PHP version. */
esc_html__( '%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one.', 'wp-mail-smtp' ),
$this->title,
$this->php,
phpversion()
)
?>
<br>
<?php esc_html_e( 'Meanwhile you can switch to the "Other SMTP" Mailer option.', 'wp-mail-smtp' ); ?>
</blockquote>
<?php
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace WPMailSMTP\Providers;
/**
* Interface ProviderInterface, shared between all current and future providers.
* Defines required methods across all providers.
*
* @since 1.0.0
*/
interface OptionsInterface {
/**
* Get the mailer provider slug.
*
* @since 1.0.0
*
* @return string
*/
public function get_slug();
/**
* Get the mailer provider title (or name).
*
* @since 1.0.0
*
* @return string
*/
public function get_title();
/**
* Get the mailer provider description.
*
* @since 1.0.0
*
* @return string
*/
public function get_description();
/**
* Get the mailer provider minimum PHP version.
*
* @since 1.0.0
*
* @return string
*/
public function get_php_version();
/**
* Get the mailer provider logo URL.
*
* @since 1.0.0
*
* @return string
*/
public function get_logo_url();
/**
* Output the mailer provider options.
*
* @since 1.0.0
*/
public function display_options();
}

View File

@@ -0,0 +1,15 @@
<?php
namespace WPMailSMTP\Providers\Pepipost;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer inherits everything from parent abstract class.
* This file is required for a proper work of Loader and \ReflectionClass.
*
* @package WPMailSMTP\Providers\Pepipost
*/
class Mailer extends MailerAbstract {
}

View File

@@ -0,0 +1,29 @@
<?php
namespace WPMailSMTP\Providers\Pepipost;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Options.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Pepipost constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->plugin_url . '/assets/images/pepipost.png',
'slug' => 'pepipost',
'title' => esc_html__( 'Pepipost', 'wp-mail-smtp' ),
)
);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace WPMailSMTP\Providers\SMTP;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer inherits everything from parent abstract class.
* This file is required for a proper work of Loader and \ReflectionClass.
*
* @package WPMailSMTP\Providers\SMTP
*/
class Mailer extends MailerAbstract {
}

View File

@@ -0,0 +1,45 @@
<?php
namespace WPMailSMTP\Providers\SMTP;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class SMTP.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* SMTP constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->plugin_url . '/assets/images/smtp.png',
'slug' => 'smtp',
'title' => esc_html__( 'Other SMTP', 'wp-mail-smtp' ),
/* translators: %1$s - opening link tag; %2$s - closing link tag. */
'description' => sprintf(
wp_kses(
__( 'Use the SMTP details provided by your hosting provider or email service.<br><br>To see recommended settings for the popular services as well as troubleshooting tips, check out our %1$sSMTP documentation%2$s.', 'wp-mail-smtp' ),
array(
'br' => array(),
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'<a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" target="_blank" rel="noopener noreferrer">',
'</a>'
),
)
);
}
}

View File

@@ -0,0 +1,344 @@
<?php
namespace WPMailSMTP\Providers\Sendgrid;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer.
*
* @since 1.0.0
*/
class Mailer extends MailerAbstract {
/**
* Which response code from HTTP provider is considered to be successful?
*
* @var int
*/
protected $email_sent_code = 202;
/**
* URL to make an API request to.
*
* @var string
*/
protected $url = 'https://api.sendgrid.com/v3/mail/send';
/**
* Mailer constructor.
*
* @since 1.0.0
*
* @param \WPMailSMTP\MailCatcher $phpmailer
*/
public function __construct( $phpmailer ) {
// We want to prefill everything from \WPMailSMTP\MailCatcher class, which extends \PHPMailer.
parent::__construct( $phpmailer );
$this->set_header( 'Authorization', 'Bearer ' . $this->options->get( $this->mailer, 'api_key' ) );
$this->set_header( 'content-type', 'application/json' );
}
/**
* Redefine the way email body is returned.
* By default we are sending an array of data.
* SendGrid requires a JSON, so we encode the body.
*
* @since 1.0.0
*/
public function get_body() {
$body = parent::get_body();
return wp_json_encode( $body );
}
/**
* @inheritdoc
*/
public function set_from( $email, $name = '' ) {
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
return;
}
$from['email'] = $email;
if ( ! empty( $name ) ) {
$from['name'] = $name;
}
$this->set_body_param(
array(
'from' => $from,
)
);
}
/**
* @inheritdoc
*/
public function set_recipients( $recipients ) {
if ( empty( $recipients ) ) {
return;
}
// Allow for now only these recipient types.
$default = array( 'to', 'cc', 'bcc' );
$data = array();
foreach ( $recipients as $type => $emails ) {
if (
! in_array( $type, $default, true ) ||
empty( $emails ) ||
! is_array( $emails )
) {
continue;
}
$data[ $type ] = array();
// Iterate over all emails for each type.
// There might be multiple cc/to/bcc emails.
foreach ( $emails as $email ) {
$holder = array();
$addr = isset( $email[0] ) ? $email[0] : false;
$name = isset( $email[1] ) ? $email[1] : false;
if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
continue;
}
$holder['email'] = $addr;
if ( ! empty( $name ) ) {
$holder['name'] = $name;
}
array_push( $data[ $type ], $holder );
}
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
'personalizations' => array( $data ),
)
);
}
}
/**
* @inheritdoc
*/
public function set_content( $content ) {
if ( empty( $content ) ) {
return;
}
if ( is_array( $content ) ) {
$default = array( 'text', 'html' );
$data = array();
foreach ( $content as $type => $body ) {
if (
! in_array( $type, $default, true ) ||
empty( $body )
) {
continue;
}
$content_type = 'text/plain';
$content_value = $body;
if ( $type === 'html' ) {
$content_type = 'text/html';
}
$data[] = array(
'type' => $content_type,
'value' => $content_value,
);
}
$this->set_body_param(
array(
'content' => $data,
)
);
} else {
$data['type'] = 'text/plain';
$data['value'] = $content;
if ( $this->phpmailer->ContentType === 'text/html' ) {
$data['type'] = 'text/html';
}
$this->set_body_param(
array(
'content' => array( $data ),
)
);
}
}
/**
* SendGrid accepts an array of files content in body, so we will include all files and send.
* Doesn't handle exceeding the limits etc, as this is done and reported be SendGrid API.
*
* @since 1.0.0
*
* @param array $attachments
*/
public function set_attachments( $attachments ) {
if ( empty( $attachments ) ) {
return;
}
$data = array();
foreach ( $attachments as $attachment ) {
$file = false;
/*
* We are not using WP_Filesystem API as we can't reliably work with it.
* It is not always available, same as credentials for FTP.
*/
try {
if ( is_file( $attachment[0] ) && is_readable( $attachment[0] ) ) {
$file = file_get_contents( $attachment[0] );
}
}
catch ( \Exception $e ) {
$file = false;
}
if ( $file === false ) {
continue;
}
$data[] = array(
'content' => base64_encode( $file ),
'type' => $attachment[4],
'filename' => $attachment[1],
'disposition' => $attachment[6],
);
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
'attachments' => $data,
)
);
}
}
/**
* @inheritdoc
*/
public function set_reply_to( $reply_to ) {
if ( empty( $reply_to ) ) {
return;
}
$data = array();
foreach ( $reply_to as $key => $emails ) {
if (
empty( $emails ) ||
! is_array( $emails )
) {
continue;
}
$addr = isset( $emails[0] ) ? $emails[0] : false;
$name = isset( $emails[1] ) ? $emails[1] : false;
if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
continue;
}
$data['email'] = $addr;
if ( ! empty( $name ) ) {
$data['name'] = $name;
}
break;
}
if ( ! empty( $data ) ) {
$this->set_body_param(
array(
'reply_to' => $data,
)
);
}
}
/**
* SendGrid doesn't support sender or return_path params.
* So we do nothing.
*
* @since 1.0.0
*
* @param string $email
*/
public function set_return_path( $email ) {
}
/**
* Get a SendGrid-specific response with a helpful error.
*
* @since 1.2.0
*
* @return string
*/
protected function get_response_error() {
$body = (array) wp_remote_retrieve_body( $this->response );
$error_text = array();
if ( ! empty( $body['errors'] ) ) {
foreach ( $body['errors'] as $error ) {
if ( property_exists( $error, 'message' ) ) {
// Prepare additional information from SendGrid API.
$extra = '';
if ( property_exists( $error, 'field' ) && ! empty( $error->field ) ) {
$extra .= $error->field . '; ';
}
if ( property_exists( $error, 'help' ) && ! empty( $error->help ) ) {
$extra .= $error->help;
}
// Assign both the main message and perhaps extra information, if exists.
$error_text[] = $error->message . ( ! empty( $extra ) ? ' - ' . $extra : '' );
}
}
}
return implode( '<br>', array_map( 'esc_textarea', $error_text ) );
}
/**
* @inheritdoc
*/
public function get_debug_info() {
$mg_text = array();
$options = new \WPMailSMTP\Options();
$mailgun = $options->get_group( 'sendgrid' );
$mg_text[] = '<strong>Api Key:</strong> ' . ( ! empty( $mailgun['api_key'] ) ? 'Yes' : 'No' );
return implode( '<br>', $mg_text );
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace WPMailSMTP\Providers\Sendgrid;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Option.
*
* @since 1.0.0
*/
class Options extends OptionsAbstract {
/**
* Options constructor.
*
* @since 1.0.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->plugin_url . '/assets/images/sendgrid.png',
'slug' => 'sendgrid',
'title' => esc_html__( 'SendGrid', 'wp-mail-smtp' ),
'description' => sprintf(
wp_kses(
/* translators: %1$s - opening link tag; %2$s - closing link tag; %3$s - opening link tag; %4$s - closing link tag. */
__( '%1$sSendGrid%2$s is one of the leading transactional email services, sending over 35 billion emails every month. They provide users 100 free emails per month.<br><br>Read our %3$sSendGrid documentation%4$s to learn how to set up SendGrid and improve your email deliverability.', 'wp-mail-smtp' ),
array(
'br' => array(),
'a' => array(
'href' => array(),
'rel' => array(),
'target' => array(),
),
)
),
'<a href="https://sendgrid.com" target="_blank" rel="noopener noreferrer">',
'</a>',
'<a href="https://wpforms.com/fix-wordpress-email-notifications-with-sendgrid/" target="_blank" rel="noopener noreferrer">',
'</a>'
),
)
);
}
/**
* @inheritdoc
*/
public function display_options() {
?>
<!-- API Key -->
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'API Key', 'wp-mail-smtp' ); ?></label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]" type="text"
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
<?php echo $this->options->is_const_defined( $this->get_slug(), 'api_key' ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" spellcheck="false"
/>
<p class="desc">
<?php
printf(
/* translators: %s - API key link. */
esc_html__( 'Follow this link to get an API Key from SendGrid: %s.', 'wp-mail-smtp' ),
'<a href="https://app.sendgrid.com/settings/api_keys" target="_blank" rel="noopener noreferrer">' .
esc_html__( 'Create API Key', 'wp-mail-smtp' ) .
'</a>'
);
?>
<br/>
<?php
printf(
/* translators: %s - SendGrid access level. */
esc_html__( 'To send emails you will need only a %s access level for this API key.', 'wp-mail-smtp' ),
'<code>Mail Send</code>'
);
?>
</p>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace WPMailSMTP;
/**
* Class Upgrade helps upgrade plugin options and similar tasks when the
* occasion arises.
*
* @since 1.1.0
*/
class Upgrade {
/**
* Upgrade constructor.
*
* @since 1.1.0
*/
public function __construct() {
$upgrades = $this->upgrades();
if ( empty( $upgrades ) ) {
return;
}
// Run any available upgrades.
foreach ( $upgrades as $upgrade ) {
$this->{$upgrade}();
}
// Update version post upgrade(s).
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER );
}
/**
* Whether we need to perform an upgrade.
*
* @since 1.1.0
*
* @return array
*/
protected function upgrades() {
$version = get_option( 'wp_mail_smtp_version' );
$upgrades = array();
// Version 1.1.0 upgrade; prior to this the option was not available.
if ( empty( $version ) ) {
$upgrades[] = 'v110_upgrade';
}
return $upgrades;
}
/**
* Upgrade routine for v1.1.0.
*
* Set SMTPAutoTLS to true.
*
* @since 1.1.0
*/
public function v110_upgrade() {
$values = Options::init()->get_all();
// Enable SMTPAutoTLS option.
$values['smtp']['autotls'] = true;
Options::init()->set( $values );
}
}

View File

@@ -0,0 +1,140 @@
<?php
namespace WPMailSMTP;
/**
* Class WP provides WordPress shortcuts.
*
* @since 1.0.0
*/
class WP {
/**
* The "queue" of notices.
*
* @var array
*/
protected static $admin_notices = array();
/**
* @var string
*/
const ADMIN_NOTICE_SUCCESS = 'notice-success';
/**
* @var string
*/
const ADMIN_NOTICE_ERROR = 'notice-error';
/**
* @var string
*/
const ADMIN_NOTICE_INFO = 'notice-info';
/**
* @var string
*/
const ADMIN_NOTICE_WARNING = 'notice-warning';
/**
* True is WP is processing an AJAX call.
*
* @since 1.0.0
*
* @return bool
*/
public static function is_doing_ajax() {
if ( function_exists( 'wp_doing_ajax' ) ) {
return wp_doing_ajax();
}
return ( defined( 'DOING_AJAX' ) && DOING_AJAX );
}
/**
* True if I am in the Admin Panel, not doing AJAX.
*
* @since 1.0.0
*
* @return bool
*/
public static function in_wp_admin() {
return ( is_admin() && ! self::is_doing_ajax() );
}
/**
* Add a notice to the "queue of notices".
*
* @since 1.0.0
*
* @param string $message Message text (HTML is OK).
* @param string $class Display class (severity).
*/
public static function add_admin_notice( $message, $class = self::ADMIN_NOTICE_INFO ) {
self::$admin_notices[] = array(
'message' => $message,
'class' => $class,
);
}
/**
* Display all notices.
*
* @since 1.0.0
*/
public static function display_admin_notices() {
foreach ( (array) self::$admin_notices as $notice ) : ?>
<div id="message" class="<?php echo esc_attr( $notice['class'] ); ?> notice is-dismissible">
<p>
<?php echo $notice['message']; ?>
</p>
</div>
<?php
endforeach;
}
/**
* Check whether WP_DEBUG is active.
*
* @since 1.0.0
*
* @return bool
*/
public static function is_debug() {
return defined( 'WP_DEBUG' ) && WP_DEBUG;
}
/**
* Shortcut to global $wpdb.
*
* @since 1.0.0
*
* @return \wpdb
*/
public static function wpdb() {
global $wpdb;
return $wpdb;
}
/**
* Get the postfix for assets files - ".min" or empty.
* ".min" if in production mode.
*
* @since 1.0.0
*
* @return string
*/
public static function asset_min() {
$min = '.min';
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$min = '';
}
return $min;
}
}

View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitbd625bfb904527ebcdc364a59295e538::getLoader();

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,239 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Google\\Auth\\ApplicationDefaultCredentials' => $vendorDir . '/google/auth/src/ApplicationDefaultCredentials.php',
'Google\\Auth\\CacheTrait' => $vendorDir . '/google/auth/src/CacheTrait.php',
'Google\\Auth\\Cache\\InvalidArgumentException' => $vendorDir . '/google/auth/src/Cache/InvalidArgumentException.php',
'Google\\Auth\\Cache\\Item' => $vendorDir . '/google/auth/src/Cache/Item.php',
'Google\\Auth\\Cache\\MemoryCacheItemPool' => $vendorDir . '/google/auth/src/Cache/MemoryCacheItemPool.php',
'Google\\Auth\\CredentialsLoader' => $vendorDir . '/google/auth/src/CredentialsLoader.php',
'Google\\Auth\\Credentials\\AppIdentityCredentials' => $vendorDir . '/google/auth/src/Credentials/AppIdentityCredentials.php',
'Google\\Auth\\Credentials\\GCECredentials' => $vendorDir . '/google/auth/src/Credentials/GCECredentials.php',
'Google\\Auth\\Credentials\\IAMCredentials' => $vendorDir . '/google/auth/src/Credentials/IAMCredentials.php',
'Google\\Auth\\Credentials\\ServiceAccountCredentials' => $vendorDir . '/google/auth/src/Credentials/ServiceAccountCredentials.php',
'Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => $vendorDir . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php',
'Google\\Auth\\Credentials\\UserRefreshCredentials' => $vendorDir . '/google/auth/src/Credentials/UserRefreshCredentials.php',
'Google\\Auth\\FetchAuthTokenCache' => $vendorDir . '/google/auth/src/FetchAuthTokenCache.php',
'Google\\Auth\\FetchAuthTokenInterface' => $vendorDir . '/google/auth/src/FetchAuthTokenInterface.php',
'Google\\Auth\\HttpHandler\\Guzzle5HttpHandler' => $vendorDir . '/google/auth/src/HttpHandler/Guzzle5HttpHandler.php',
'Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => $vendorDir . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php',
'Google\\Auth\\HttpHandler\\HttpHandlerFactory' => $vendorDir . '/google/auth/src/HttpHandler/HttpHandlerFactory.php',
'Google\\Auth\\Middleware\\AuthTokenMiddleware' => $vendorDir . '/google/auth/src/Middleware/AuthTokenMiddleware.php',
'Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => $vendorDir . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php',
'Google\\Auth\\Middleware\\SimpleMiddleware' => $vendorDir . '/google/auth/src/Middleware/SimpleMiddleware.php',
'Google\\Auth\\OAuth2' => $vendorDir . '/google/auth/src/OAuth2.php',
'Google\\Auth\\Subscriber\\AuthTokenSubscriber' => $vendorDir . '/google/auth/src/Subscriber/AuthTokenSubscriber.php',
'Google\\Auth\\Subscriber\\ScopedAccessTokenSubscriber' => $vendorDir . '/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php',
'Google\\Auth\\Subscriber\\SimpleSubscriber' => $vendorDir . '/google/auth/src/Subscriber/SimpleSubscriber.php',
'Google_AccessToken_Revoke' => $vendorDir . '/google/apiclient/src/Google/AccessToken/Revoke.php',
'Google_AccessToken_Verify' => $vendorDir . '/google/apiclient/src/Google/AccessToken/Verify.php',
'Google_AuthHandler_AuthHandlerFactory' => $vendorDir . '/google/apiclient/src/Google/AuthHandler/AuthHandlerFactory.php',
'Google_AuthHandler_Guzzle5AuthHandler' => $vendorDir . '/google/apiclient/src/Google/AuthHandler/Guzzle5AuthHandler.php',
'Google_AuthHandler_Guzzle6AuthHandler' => $vendorDir . '/google/apiclient/src/Google/AuthHandler/Guzzle6AuthHandler.php',
'Google_Client' => $vendorDir . '/google/apiclient/src/Google/Client.php',
'Google_Collection' => $vendorDir . '/google/apiclient/src/Google/Collection.php',
'Google_Exception' => $vendorDir . '/google/apiclient/src/Google/Exception.php',
'Google_Http_Batch' => $vendorDir . '/google/apiclient/src/Google/Http/Batch.php',
'Google_Http_MediaFileUpload' => $vendorDir . '/google/apiclient/src/Google/Http/MediaFileUpload.php',
'Google_Http_REST' => $vendorDir . '/google/apiclient/src/Google/Http/REST.php',
'Google_Model' => $vendorDir . '/google/apiclient/src/Google/Model.php',
'Google_Service' => $vendorDir . '/google/apiclient/src/Google/Service.php',
'Google_Service_Exception' => $vendorDir . '/google/apiclient/src/Google/Service/Exception.php',
'Google_Service_Resource' => $vendorDir . '/google/apiclient/src/Google/Service/Resource.php',
'Google_Task_Exception' => $vendorDir . '/google/apiclient/src/Google/Task/Exception.php',
'Google_Task_Retryable' => $vendorDir . '/google/apiclient/src/Google/Task/Retryable.php',
'Google_Task_Runner' => $vendorDir . '/google/apiclient/src/Google/Task/Runner.php',
'Google_Utils_UriTemplate' => $vendorDir . '/google/apiclient/src/Google/Utils/UriTemplate.php',
'GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php',
'GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php',
'GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
'GuzzleHttp\\Cookie\\CookieJarInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php',
'GuzzleHttp\\Cookie\\FileCookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php',
'GuzzleHttp\\Cookie\\SessionCookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php',
'GuzzleHttp\\Cookie\\SetCookie' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php',
'GuzzleHttp\\Exception\\BadResponseException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php',
'GuzzleHttp\\Exception\\ClientException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ClientException.php',
'GuzzleHttp\\Exception\\ConnectException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ConnectException.php',
'GuzzleHttp\\Exception\\GuzzleException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php',
'GuzzleHttp\\Exception\\RequestException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/RequestException.php',
'GuzzleHttp\\Exception\\SeekException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/SeekException.php',
'GuzzleHttp\\Exception\\ServerException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ServerException.php',
'GuzzleHttp\\Exception\\TooManyRedirectsException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php',
'GuzzleHttp\\Exception\\TransferException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TransferException.php',
'GuzzleHttp\\HandlerStack' => $vendorDir . '/guzzlehttp/guzzle/src/HandlerStack.php',
'GuzzleHttp\\Handler\\CurlFactory' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php',
'GuzzleHttp\\Handler\\CurlFactoryInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php',
'GuzzleHttp\\Handler\\CurlHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php',
'GuzzleHttp\\Handler\\CurlMultiHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php',
'GuzzleHttp\\Handler\\EasyHandle' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php',
'GuzzleHttp\\Handler\\MockHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/MockHandler.php',
'GuzzleHttp\\Handler\\Proxy' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/Proxy.php',
'GuzzleHttp\\Handler\\StreamHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php',
'GuzzleHttp\\MessageFormatter' => $vendorDir . '/guzzlehttp/guzzle/src/MessageFormatter.php',
'GuzzleHttp\\Middleware' => $vendorDir . '/guzzlehttp/guzzle/src/Middleware.php',
'GuzzleHttp\\Pool' => $vendorDir . '/guzzlehttp/guzzle/src/Pool.php',
'GuzzleHttp\\PrepareBodyMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php',
'GuzzleHttp\\Promise\\AggregateException' => $vendorDir . '/guzzlehttp/promises/src/AggregateException.php',
'GuzzleHttp\\Promise\\CancellationException' => $vendorDir . '/guzzlehttp/promises/src/CancellationException.php',
'GuzzleHttp\\Promise\\Coroutine' => $vendorDir . '/guzzlehttp/promises/src/Coroutine.php',
'GuzzleHttp\\Promise\\EachPromise' => $vendorDir . '/guzzlehttp/promises/src/EachPromise.php',
'GuzzleHttp\\Promise\\FulfilledPromise' => $vendorDir . '/guzzlehttp/promises/src/FulfilledPromise.php',
'GuzzleHttp\\Promise\\Promise' => $vendorDir . '/guzzlehttp/promises/src/Promise.php',
'GuzzleHttp\\Promise\\PromiseInterface' => $vendorDir . '/guzzlehttp/promises/src/PromiseInterface.php',
'GuzzleHttp\\Promise\\PromisorInterface' => $vendorDir . '/guzzlehttp/promises/src/PromisorInterface.php',
'GuzzleHttp\\Promise\\RejectedPromise' => $vendorDir . '/guzzlehttp/promises/src/RejectedPromise.php',
'GuzzleHttp\\Promise\\RejectionException' => $vendorDir . '/guzzlehttp/promises/src/RejectionException.php',
'GuzzleHttp\\Promise\\TaskQueue' => $vendorDir . '/guzzlehttp/promises/src/TaskQueue.php',
'GuzzleHttp\\Promise\\TaskQueueInterface' => $vendorDir . '/guzzlehttp/promises/src/TaskQueueInterface.php',
'GuzzleHttp\\Psr7\\AppendStream' => $vendorDir . '/guzzlehttp/psr7/src/AppendStream.php',
'GuzzleHttp\\Psr7\\BufferStream' => $vendorDir . '/guzzlehttp/psr7/src/BufferStream.php',
'GuzzleHttp\\Psr7\\CachingStream' => $vendorDir . '/guzzlehttp/psr7/src/CachingStream.php',
'GuzzleHttp\\Psr7\\DroppingStream' => $vendorDir . '/guzzlehttp/psr7/src/DroppingStream.php',
'GuzzleHttp\\Psr7\\FnStream' => $vendorDir . '/guzzlehttp/psr7/src/FnStream.php',
'GuzzleHttp\\Psr7\\InflateStream' => $vendorDir . '/guzzlehttp/psr7/src/InflateStream.php',
'GuzzleHttp\\Psr7\\LazyOpenStream' => $vendorDir . '/guzzlehttp/psr7/src/LazyOpenStream.php',
'GuzzleHttp\\Psr7\\LimitStream' => $vendorDir . '/guzzlehttp/psr7/src/LimitStream.php',
'GuzzleHttp\\Psr7\\MessageTrait' => $vendorDir . '/guzzlehttp/psr7/src/MessageTrait.php',
'GuzzleHttp\\Psr7\\MultipartStream' => $vendorDir . '/guzzlehttp/psr7/src/MultipartStream.php',
'GuzzleHttp\\Psr7\\NoSeekStream' => $vendorDir . '/guzzlehttp/psr7/src/NoSeekStream.php',
'GuzzleHttp\\Psr7\\PumpStream' => $vendorDir . '/guzzlehttp/psr7/src/PumpStream.php',
'GuzzleHttp\\Psr7\\Request' => $vendorDir . '/guzzlehttp/psr7/src/Request.php',
'GuzzleHttp\\Psr7\\Response' => $vendorDir . '/guzzlehttp/psr7/src/Response.php',
'GuzzleHttp\\Psr7\\ServerRequest' => $vendorDir . '/guzzlehttp/psr7/src/ServerRequest.php',
'GuzzleHttp\\Psr7\\Stream' => $vendorDir . '/guzzlehttp/psr7/src/Stream.php',
'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php',
'GuzzleHttp\\Psr7\\StreamWrapper' => $vendorDir . '/guzzlehttp/psr7/src/StreamWrapper.php',
'GuzzleHttp\\Psr7\\UploadedFile' => $vendorDir . '/guzzlehttp/psr7/src/UploadedFile.php',
'GuzzleHttp\\Psr7\\Uri' => $vendorDir . '/guzzlehttp/psr7/src/Uri.php',
'GuzzleHttp\\Psr7\\UriNormalizer' => $vendorDir . '/guzzlehttp/psr7/src/UriNormalizer.php',
'GuzzleHttp\\Psr7\\UriResolver' => $vendorDir . '/guzzlehttp/psr7/src/UriResolver.php',
'GuzzleHttp\\RedirectMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/RedirectMiddleware.php',
'GuzzleHttp\\RequestOptions' => $vendorDir . '/guzzlehttp/guzzle/src/RequestOptions.php',
'GuzzleHttp\\RetryMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/RetryMiddleware.php',
'GuzzleHttp\\TransferStats' => $vendorDir . '/guzzlehttp/guzzle/src/TransferStats.php',
'GuzzleHttp\\UriTemplate' => $vendorDir . '/guzzlehttp/guzzle/src/UriTemplate.php',
'Monolog\\ErrorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/ErrorHandler.php',
'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
'Monolog\\Formatter\\ElasticaFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
'Monolog\\Formatter\\FlowdockFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
'Monolog\\Formatter\\FluentdFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
'Monolog\\Formatter\\FormatterInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
'Monolog\\Formatter\\GelfMessageFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
'Monolog\\Formatter\\HtmlFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
'Monolog\\Formatter\\JsonFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php',
'Monolog\\Formatter\\LineFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
'Monolog\\Formatter\\LogglyFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php',
'Monolog\\Formatter\\LogstashFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php',
'Monolog\\Formatter\\MongoDBFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php',
'Monolog\\Formatter\\NormalizerFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
'Monolog\\Formatter\\ScalarFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php',
'Monolog\\Formatter\\WildfireFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php',
'Monolog\\Handler\\AbstractHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
'Monolog\\Handler\\AbstractProcessingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php',
'Monolog\\Handler\\AbstractSyslogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php',
'Monolog\\Handler\\AmqpHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AmqpHandler.php',
'Monolog\\Handler\\BrowserConsoleHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php',
'Monolog\\Handler\\BufferHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/BufferHandler.php',
'Monolog\\Handler\\ChromePHPHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php',
'Monolog\\Handler\\CouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
'Monolog\\Handler\\CubeHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
'Monolog\\Handler\\Curl\\Util' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
'Monolog\\Handler\\DeduplicationHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
'Monolog\\Handler\\DoctrineCouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
'Monolog\\Handler\\DynamoDbHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
'Monolog\\Handler\\ElasticSearchHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
'Monolog\\Handler\\ErrorLogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php',
'Monolog\\Handler\\FilterHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FilterHandler.php',
'Monolog\\Handler\\FingersCrossedHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php',
'Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php',
'Monolog\\Handler\\FingersCrossed\\ChannelLevelActivationStrategy' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php',
'Monolog\\Handler\\FingersCrossed\\ErrorLevelActivationStrategy' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php',
'Monolog\\Handler\\FirePHPHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php',
'Monolog\\Handler\\FleepHookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php',
'Monolog\\Handler\\FlowdockHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php',
'Monolog\\Handler\\GelfHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
'Monolog\\Handler\\GroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
'Monolog\\Handler\\HandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
'Monolog\\Handler\\HandlerWrapper' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
'Monolog\\Handler\\HipChatHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
'Monolog\\Handler\\IFTTTHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
'Monolog\\Handler\\LogEntriesHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
'Monolog\\Handler\\LogglyHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogglyHandler.php',
'Monolog\\Handler\\MailHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MailHandler.php',
'Monolog\\Handler\\MandrillHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MandrillHandler.php',
'Monolog\\Handler\\MissingExtensionException' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php',
'Monolog\\Handler\\MongoDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php',
'Monolog\\Handler\\NativeMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php',
'Monolog\\Handler\\NewRelicHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php',
'Monolog\\Handler\\NullHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NullHandler.php',
'Monolog\\Handler\\PHPConsoleHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php',
'Monolog\\Handler\\PsrHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PsrHandler.php',
'Monolog\\Handler\\PushoverHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PushoverHandler.php',
'Monolog\\Handler\\RavenHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RavenHandler.php',
'Monolog\\Handler\\RedisHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RedisHandler.php',
'Monolog\\Handler\\RollbarHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RollbarHandler.php',
'Monolog\\Handler\\RotatingFileHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
'Monolog\\Handler\\SamplingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
'Monolog\\Handler\\SlackHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
'Monolog\\Handler\\SlackWebhookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
'Monolog\\Handler\\Slack\\SlackRecord' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
'Monolog\\Handler\\SlackbotHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
'Monolog\\Handler\\SocketHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
'Monolog\\Handler\\StreamHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
'Monolog\\Handler\\SwiftMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
'Monolog\\Handler\\SyslogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php',
'Monolog\\Handler\\SyslogUdpHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php',
'Monolog\\Handler\\SyslogUdp\\UdpSocket' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php',
'Monolog\\Handler\\WhatFailureGroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php',
'Monolog\\Handler\\ZendMonitorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php',
'Monolog\\Logger' => $vendorDir . '/monolog/monolog/src/Monolog/Logger.php',
'Monolog\\Processor\\GitProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/GitProcessor.php',
'Monolog\\Processor\\IntrospectionProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php',
'Monolog\\Processor\\MemoryPeakUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
'Monolog\\Processor\\MemoryProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
'Monolog\\Processor\\MemoryUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
'Monolog\\Processor\\MercurialProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php',
'Monolog\\Processor\\ProcessIdProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
'Monolog\\Processor\\PsrLogMessageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
'Monolog\\Processor\\TagProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
'Monolog\\Processor\\UidProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/UidProcessor.php',
'Monolog\\Processor\\WebProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/WebProcessor.php',
'Monolog\\Registry' => $vendorDir . '/monolog/monolog/src/Monolog/Registry.php',
'Psr\\Cache\\CacheException' => $vendorDir . '/psr/cache/src/CacheException.php',
'Psr\\Cache\\CacheItemInterface' => $vendorDir . '/psr/cache/src/CacheItemInterface.php',
'Psr\\Cache\\CacheItemPoolInterface' => $vendorDir . '/psr/cache/src/CacheItemPoolInterface.php',
'Psr\\Cache\\InvalidArgumentException' => $vendorDir . '/psr/cache/src/InvalidArgumentException.php',
'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php',
'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php',
'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php',
'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php',
'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php',
'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php',
'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php',
'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
'Psr\\Log\\LoggerAwareInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareInterface.php',
'Psr\\Log\\LoggerAwareTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareTrait.php',
'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
'phpseclib\\Crypt\\AES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php',
'phpseclib\\Crypt\\Base' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php',
'phpseclib\\Crypt\\Blowfish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php',
'phpseclib\\Crypt\\DES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php',
'phpseclib\\Crypt\\Hash' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php',
'phpseclib\\Crypt\\RC2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php',
'phpseclib\\Crypt\\RC4' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php',
'phpseclib\\Crypt\\RSA' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php',
'phpseclib\\Crypt\\Random' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
'phpseclib\\Crypt\\Rijndael' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php',
'phpseclib\\Crypt\\TripleDES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php',
'phpseclib\\Crypt\\Twofish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php',
'phpseclib\\Math\\BigInteger' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php',
);

View File

@@ -0,0 +1,27 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'36d9695c51c127dacf01b83c468dbbdb' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail.php',
'd95a5932fb3c05855cde09b51efec1ac' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Message.php',
'1a8cb0c91ca8ad9f9147193a084f80bd' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/Users.php',
'5d5f545fa7a58b1185f901d0c1006a41' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersDrafts.php',
'79c900432abc031cbad7036b9fce5523' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersHistory.php',
'1a56422ddba9140c62183b59448a7227' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersLabels.php',
'f7d0eb6d1da014e7ff1b6038c3314921' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersMessages.php',
'ed22ed3db05c96f75d2885e41650be07' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersMessagesAttachments.php',
'535c184b9a328f2295fc70c028f13aa7' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettings.php',
'fc9b994b4190b187884a1bb5b334c54d' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsFilters.php',
'3a081d084d3ba366d67d7139e5d9fbcf' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsForwardingAddresses.php',
'60d509e933e5ca336a897bb7b549f15b' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsSendAs.php',
'39c11aa4169566f44661343f8929bbd0' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsSendAsSmimeInfo.php',
'cf7f0634ca5d41f748c82f89bd3e960b' => $vendorDir . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersThreads.php',
);

View File

@@ -0,0 +1,11 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Google_Service_' => array($vendorDir . '/google/apiclient-services/src'),
'Google_' => array($vendorDir . '/google/apiclient/src'),
);

View File

@@ -0,0 +1,20 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Google\\Auth\\' => array($vendorDir . '/google/auth/src'),
'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
);

View File

@@ -0,0 +1,61 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitbd625bfb904527ebcdc364a59295e538
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitbd625bfb904527ebcdc364a59295e538', 'loadClassLoader'), true, false);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitbd625bfb904527ebcdc364a59295e538', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitbd625bfb904527ebcdc364a59295e538::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->setClassMapAuthoritative(true);
$loader->register(false);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitbd625bfb904527ebcdc364a59295e538::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirebd625bfb904527ebcdc364a59295e538($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequirebd625bfb904527ebcdc364a59295e538($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@@ -0,0 +1,366 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitbd625bfb904527ebcdc364a59295e538
{
public static $files = array (
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'36d9695c51c127dacf01b83c468dbbdb' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail.php',
'd95a5932fb3c05855cde09b51efec1ac' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Message.php',
'1a8cb0c91ca8ad9f9147193a084f80bd' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/Users.php',
'5d5f545fa7a58b1185f901d0c1006a41' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersDrafts.php',
'79c900432abc031cbad7036b9fce5523' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersHistory.php',
'1a56422ddba9140c62183b59448a7227' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersLabels.php',
'f7d0eb6d1da014e7ff1b6038c3314921' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersMessages.php',
'ed22ed3db05c96f75d2885e41650be07' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersMessagesAttachments.php',
'535c184b9a328f2295fc70c028f13aa7' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettings.php',
'fc9b994b4190b187884a1bb5b334c54d' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsFilters.php',
'3a081d084d3ba366d67d7139e5d9fbcf' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsForwardingAddresses.php',
'60d509e933e5ca336a897bb7b549f15b' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsSendAs.php',
'39c11aa4169566f44661343f8929bbd0' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersSettingsSendAsSmimeInfo.php',
'cf7f0634ca5d41f748c82f89bd3e960b' => __DIR__ . '/..' . '/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersThreads.php',
);
public static $prefixLengthsPsr4 = array (
'p' =>
array (
'phpseclib\\' => 10,
),
'P' =>
array (
'Psr\\Log\\' => 8,
'Psr\\Http\\Message\\' => 17,
'Psr\\Cache\\' => 10,
),
'M' =>
array (
'Monolog\\' => 8,
),
'G' =>
array (
'GuzzleHttp\\Psr7\\' => 16,
'GuzzleHttp\\Promise\\' => 19,
'GuzzleHttp\\' => 11,
'Google\\Auth\\' => 12,
),
'F' =>
array (
'Firebase\\JWT\\' => 13,
),
'C' =>
array (
'Composer\\Installers\\' => 20,
),
);
public static $prefixDirsPsr4 = array (
'phpseclib\\' =>
array (
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
),
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-message/src',
),
'Psr\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/psr/cache/src',
),
'Monolog\\' =>
array (
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
),
'GuzzleHttp\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
),
'GuzzleHttp\\Promise\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/promises/src',
),
'GuzzleHttp\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
),
'Google\\Auth\\' =>
array (
0 => __DIR__ . '/..' . '/google/auth/src',
),
'Firebase\\JWT\\' =>
array (
0 => __DIR__ . '/..' . '/firebase/php-jwt/src',
),
'Composer\\Installers\\' =>
array (
0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
),
);
public static $prefixesPsr0 = array (
'G' =>
array (
'Google_Service_' =>
array (
0 => __DIR__ . '/..' . '/google/apiclient-services/src',
),
'Google_' =>
array (
0 => __DIR__ . '/..' . '/google/apiclient/src',
),
),
);
public static $classMap = array (
'Google\\Auth\\ApplicationDefaultCredentials' => __DIR__ . '/..' . '/google/auth/src/ApplicationDefaultCredentials.php',
'Google\\Auth\\CacheTrait' => __DIR__ . '/..' . '/google/auth/src/CacheTrait.php',
'Google\\Auth\\Cache\\InvalidArgumentException' => __DIR__ . '/..' . '/google/auth/src/Cache/InvalidArgumentException.php',
'Google\\Auth\\Cache\\Item' => __DIR__ . '/..' . '/google/auth/src/Cache/Item.php',
'Google\\Auth\\Cache\\MemoryCacheItemPool' => __DIR__ . '/..' . '/google/auth/src/Cache/MemoryCacheItemPool.php',
'Google\\Auth\\CredentialsLoader' => __DIR__ . '/..' . '/google/auth/src/CredentialsLoader.php',
'Google\\Auth\\Credentials\\AppIdentityCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/AppIdentityCredentials.php',
'Google\\Auth\\Credentials\\GCECredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/GCECredentials.php',
'Google\\Auth\\Credentials\\IAMCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/IAMCredentials.php',
'Google\\Auth\\Credentials\\ServiceAccountCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/ServiceAccountCredentials.php',
'Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php',
'Google\\Auth\\Credentials\\UserRefreshCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/UserRefreshCredentials.php',
'Google\\Auth\\FetchAuthTokenCache' => __DIR__ . '/..' . '/google/auth/src/FetchAuthTokenCache.php',
'Google\\Auth\\FetchAuthTokenInterface' => __DIR__ . '/..' . '/google/auth/src/FetchAuthTokenInterface.php',
'Google\\Auth\\HttpHandler\\Guzzle5HttpHandler' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/Guzzle5HttpHandler.php',
'Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php',
'Google\\Auth\\HttpHandler\\HttpHandlerFactory' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/HttpHandlerFactory.php',
'Google\\Auth\\Middleware\\AuthTokenMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/AuthTokenMiddleware.php',
'Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php',
'Google\\Auth\\Middleware\\SimpleMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/SimpleMiddleware.php',
'Google\\Auth\\OAuth2' => __DIR__ . '/..' . '/google/auth/src/OAuth2.php',
'Google\\Auth\\Subscriber\\AuthTokenSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/AuthTokenSubscriber.php',
'Google\\Auth\\Subscriber\\ScopedAccessTokenSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php',
'Google\\Auth\\Subscriber\\SimpleSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/SimpleSubscriber.php',
'Google_AccessToken_Revoke' => __DIR__ . '/..' . '/google/apiclient/src/Google/AccessToken/Revoke.php',
'Google_AccessToken_Verify' => __DIR__ . '/..' . '/google/apiclient/src/Google/AccessToken/Verify.php',
'Google_AuthHandler_AuthHandlerFactory' => __DIR__ . '/..' . '/google/apiclient/src/Google/AuthHandler/AuthHandlerFactory.php',
'Google_AuthHandler_Guzzle5AuthHandler' => __DIR__ . '/..' . '/google/apiclient/src/Google/AuthHandler/Guzzle5AuthHandler.php',
'Google_AuthHandler_Guzzle6AuthHandler' => __DIR__ . '/..' . '/google/apiclient/src/Google/AuthHandler/Guzzle6AuthHandler.php',
'Google_Client' => __DIR__ . '/..' . '/google/apiclient/src/Google/Client.php',
'Google_Collection' => __DIR__ . '/..' . '/google/apiclient/src/Google/Collection.php',
'Google_Exception' => __DIR__ . '/..' . '/google/apiclient/src/Google/Exception.php',
'Google_Http_Batch' => __DIR__ . '/..' . '/google/apiclient/src/Google/Http/Batch.php',
'Google_Http_MediaFileUpload' => __DIR__ . '/..' . '/google/apiclient/src/Google/Http/MediaFileUpload.php',
'Google_Http_REST' => __DIR__ . '/..' . '/google/apiclient/src/Google/Http/REST.php',
'Google_Model' => __DIR__ . '/..' . '/google/apiclient/src/Google/Model.php',
'Google_Service' => __DIR__ . '/..' . '/google/apiclient/src/Google/Service.php',
'Google_Service_Exception' => __DIR__ . '/..' . '/google/apiclient/src/Google/Service/Exception.php',
'Google_Service_Resource' => __DIR__ . '/..' . '/google/apiclient/src/Google/Service/Resource.php',
'Google_Task_Exception' => __DIR__ . '/..' . '/google/apiclient/src/Google/Task/Exception.php',
'Google_Task_Retryable' => __DIR__ . '/..' . '/google/apiclient/src/Google/Task/Retryable.php',
'Google_Task_Runner' => __DIR__ . '/..' . '/google/apiclient/src/Google/Task/Runner.php',
'Google_Utils_UriTemplate' => __DIR__ . '/..' . '/google/apiclient/src/Google/Utils/UriTemplate.php',
'GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php',
'GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php',
'GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
'GuzzleHttp\\Cookie\\CookieJarInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php',
'GuzzleHttp\\Cookie\\FileCookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php',
'GuzzleHttp\\Cookie\\SessionCookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php',
'GuzzleHttp\\Cookie\\SetCookie' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php',
'GuzzleHttp\\Exception\\BadResponseException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php',
'GuzzleHttp\\Exception\\ClientException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ClientException.php',
'GuzzleHttp\\Exception\\ConnectException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ConnectException.php',
'GuzzleHttp\\Exception\\GuzzleException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php',
'GuzzleHttp\\Exception\\RequestException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/RequestException.php',
'GuzzleHttp\\Exception\\SeekException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/SeekException.php',
'GuzzleHttp\\Exception\\ServerException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ServerException.php',
'GuzzleHttp\\Exception\\TooManyRedirectsException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php',
'GuzzleHttp\\Exception\\TransferException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TransferException.php',
'GuzzleHttp\\HandlerStack' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/HandlerStack.php',
'GuzzleHttp\\Handler\\CurlFactory' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php',
'GuzzleHttp\\Handler\\CurlFactoryInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php',
'GuzzleHttp\\Handler\\CurlHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php',
'GuzzleHttp\\Handler\\CurlMultiHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php',
'GuzzleHttp\\Handler\\EasyHandle' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php',
'GuzzleHttp\\Handler\\MockHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/MockHandler.php',
'GuzzleHttp\\Handler\\Proxy' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/Proxy.php',
'GuzzleHttp\\Handler\\StreamHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php',
'GuzzleHttp\\MessageFormatter' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/MessageFormatter.php',
'GuzzleHttp\\Middleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Middleware.php',
'GuzzleHttp\\Pool' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Pool.php',
'GuzzleHttp\\PrepareBodyMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php',
'GuzzleHttp\\Promise\\AggregateException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/AggregateException.php',
'GuzzleHttp\\Promise\\CancellationException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/CancellationException.php',
'GuzzleHttp\\Promise\\Coroutine' => __DIR__ . '/..' . '/guzzlehttp/promises/src/Coroutine.php',
'GuzzleHttp\\Promise\\EachPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/EachPromise.php',
'GuzzleHttp\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/FulfilledPromise.php',
'GuzzleHttp\\Promise\\Promise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/Promise.php',
'GuzzleHttp\\Promise\\PromiseInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/PromiseInterface.php',
'GuzzleHttp\\Promise\\PromisorInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/PromisorInterface.php',
'GuzzleHttp\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/RejectedPromise.php',
'GuzzleHttp\\Promise\\RejectionException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/RejectionException.php',
'GuzzleHttp\\Promise\\TaskQueue' => __DIR__ . '/..' . '/guzzlehttp/promises/src/TaskQueue.php',
'GuzzleHttp\\Promise\\TaskQueueInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/TaskQueueInterface.php',
'GuzzleHttp\\Psr7\\AppendStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/AppendStream.php',
'GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/BufferStream.php',
'GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/CachingStream.php',
'GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/DroppingStream.php',
'GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/FnStream.php',
'GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/InflateStream.php',
'GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LazyOpenStream.php',
'GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LimitStream.php',
'GuzzleHttp\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MessageTrait.php',
'GuzzleHttp\\Psr7\\MultipartStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MultipartStream.php',
'GuzzleHttp\\Psr7\\NoSeekStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/NoSeekStream.php',
'GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/PumpStream.php',
'GuzzleHttp\\Psr7\\Request' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Request.php',
'GuzzleHttp\\Psr7\\Response' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Response.php',
'GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/ServerRequest.php',
'GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Stream.php',
'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php',
'GuzzleHttp\\Psr7\\StreamWrapper' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamWrapper.php',
'GuzzleHttp\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UploadedFile.php',
'GuzzleHttp\\Psr7\\Uri' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Uri.php',
'GuzzleHttp\\Psr7\\UriNormalizer' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriNormalizer.php',
'GuzzleHttp\\Psr7\\UriResolver' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriResolver.php',
'GuzzleHttp\\RedirectMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RedirectMiddleware.php',
'GuzzleHttp\\RequestOptions' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RequestOptions.php',
'GuzzleHttp\\RetryMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RetryMiddleware.php',
'GuzzleHttp\\TransferStats' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/TransferStats.php',
'GuzzleHttp\\UriTemplate' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/UriTemplate.php',
'Monolog\\ErrorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ErrorHandler.php',
'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
'Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
'Monolog\\Formatter\\FlowdockFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
'Monolog\\Formatter\\FluentdFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
'Monolog\\Formatter\\FormatterInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
'Monolog\\Formatter\\GelfMessageFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
'Monolog\\Formatter\\HtmlFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
'Monolog\\Formatter\\JsonFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php',
'Monolog\\Formatter\\LineFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
'Monolog\\Formatter\\LogglyFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php',
'Monolog\\Formatter\\LogstashFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php',
'Monolog\\Formatter\\MongoDBFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php',
'Monolog\\Formatter\\NormalizerFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
'Monolog\\Formatter\\ScalarFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php',
'Monolog\\Formatter\\WildfireFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php',
'Monolog\\Handler\\AbstractHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
'Monolog\\Handler\\AbstractProcessingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php',
'Monolog\\Handler\\AbstractSyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php',
'Monolog\\Handler\\AmqpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AmqpHandler.php',
'Monolog\\Handler\\BrowserConsoleHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php',
'Monolog\\Handler\\BufferHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/BufferHandler.php',
'Monolog\\Handler\\ChromePHPHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php',
'Monolog\\Handler\\CouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
'Monolog\\Handler\\CubeHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
'Monolog\\Handler\\Curl\\Util' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
'Monolog\\Handler\\DeduplicationHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
'Monolog\\Handler\\DoctrineCouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
'Monolog\\Handler\\DynamoDbHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
'Monolog\\Handler\\ElasticSearchHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
'Monolog\\Handler\\ErrorLogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php',
'Monolog\\Handler\\FilterHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FilterHandler.php',
'Monolog\\Handler\\FingersCrossedHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php',
'Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php',
'Monolog\\Handler\\FingersCrossed\\ChannelLevelActivationStrategy' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php',
'Monolog\\Handler\\FingersCrossed\\ErrorLevelActivationStrategy' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php',
'Monolog\\Handler\\FirePHPHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php',
'Monolog\\Handler\\FleepHookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php',
'Monolog\\Handler\\FlowdockHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php',
'Monolog\\Handler\\GelfHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
'Monolog\\Handler\\GroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
'Monolog\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
'Monolog\\Handler\\HandlerWrapper' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
'Monolog\\Handler\\HipChatHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
'Monolog\\Handler\\IFTTTHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
'Monolog\\Handler\\LogEntriesHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
'Monolog\\Handler\\LogglyHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogglyHandler.php',
'Monolog\\Handler\\MailHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MailHandler.php',
'Monolog\\Handler\\MandrillHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MandrillHandler.php',
'Monolog\\Handler\\MissingExtensionException' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php',
'Monolog\\Handler\\MongoDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php',
'Monolog\\Handler\\NativeMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php',
'Monolog\\Handler\\NewRelicHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php',
'Monolog\\Handler\\NullHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NullHandler.php',
'Monolog\\Handler\\PHPConsoleHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php',
'Monolog\\Handler\\PsrHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PsrHandler.php',
'Monolog\\Handler\\PushoverHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PushoverHandler.php',
'Monolog\\Handler\\RavenHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RavenHandler.php',
'Monolog\\Handler\\RedisHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RedisHandler.php',
'Monolog\\Handler\\RollbarHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RollbarHandler.php',
'Monolog\\Handler\\RotatingFileHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
'Monolog\\Handler\\SamplingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
'Monolog\\Handler\\SlackHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
'Monolog\\Handler\\SlackWebhookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
'Monolog\\Handler\\Slack\\SlackRecord' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
'Monolog\\Handler\\SlackbotHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
'Monolog\\Handler\\SocketHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
'Monolog\\Handler\\StreamHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
'Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
'Monolog\\Handler\\SyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php',
'Monolog\\Handler\\SyslogUdpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php',
'Monolog\\Handler\\SyslogUdp\\UdpSocket' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php',
'Monolog\\Handler\\WhatFailureGroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php',
'Monolog\\Handler\\ZendMonitorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php',
'Monolog\\Logger' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Logger.php',
'Monolog\\Processor\\GitProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/GitProcessor.php',
'Monolog\\Processor\\IntrospectionProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php',
'Monolog\\Processor\\MemoryPeakUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
'Monolog\\Processor\\MemoryProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
'Monolog\\Processor\\MemoryUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
'Monolog\\Processor\\MercurialProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php',
'Monolog\\Processor\\ProcessIdProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
'Monolog\\Processor\\PsrLogMessageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
'Monolog\\Processor\\TagProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
'Monolog\\Processor\\UidProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/UidProcessor.php',
'Monolog\\Processor\\WebProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/WebProcessor.php',
'Monolog\\Registry' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Registry.php',
'Psr\\Cache\\CacheException' => __DIR__ . '/..' . '/psr/cache/src/CacheException.php',
'Psr\\Cache\\CacheItemInterface' => __DIR__ . '/..' . '/psr/cache/src/CacheItemInterface.php',
'Psr\\Cache\\CacheItemPoolInterface' => __DIR__ . '/..' . '/psr/cache/src/CacheItemPoolInterface.php',
'Psr\\Cache\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/cache/src/InvalidArgumentException.php',
'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php',
'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php',
'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php',
'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php',
'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php',
'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php',
'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php',
'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php',
'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php',
'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php',
'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
'phpseclib\\Crypt\\AES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php',
'phpseclib\\Crypt\\Base' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php',
'phpseclib\\Crypt\\Blowfish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php',
'phpseclib\\Crypt\\DES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php',
'phpseclib\\Crypt\\Hash' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php',
'phpseclib\\Crypt\\RC2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php',
'phpseclib\\Crypt\\RC4' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php',
'phpseclib\\Crypt\\RSA' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php',
'phpseclib\\Crypt\\Random' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
'phpseclib\\Crypt\\Rijndael' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php',
'phpseclib\\Crypt\\TripleDES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php',
'phpseclib\\Crypt\\Twofish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php',
'phpseclib\\Math\\BigInteger' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitbd625bfb904527ebcdc364a59295e538::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitbd625bfb904527ebcdc364a59295e538::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitbd625bfb904527ebcdc364a59295e538::$prefixesPsr0;
$loader->classMap = ComposerStaticInitbd625bfb904527ebcdc364a59295e538::$classMap;
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1,203 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,48 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_AutoForwarding extends Google_Model
{
public $disposition;
public $emailAddress;
public $enabled;
public function setDisposition($disposition)
{
$this->disposition = $disposition;
}
public function getDisposition()
{
return $this->disposition;
}
public function setEmailAddress($emailAddress)
{
$this->emailAddress = $emailAddress;
}
public function getEmailAddress()
{
return $this->emailAddress;
}
public function setEnabled($enabled)
{
$this->enabled = $enabled;
}
public function getEnabled()
{
return $this->enabled;
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_BatchDeleteMessagesRequest extends Google_Collection
{
protected $collection_key = 'ids';
public $ids;
public function setIds($ids)
{
$this->ids = $ids;
}
public function getIds()
{
return $this->ids;
}
}

View File

@@ -0,0 +1,49 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_BatchModifyMessagesRequest extends Google_Collection
{
protected $collection_key = 'removeLabelIds';
public $addLabelIds;
public $ids;
public $removeLabelIds;
public function setAddLabelIds($addLabelIds)
{
$this->addLabelIds = $addLabelIds;
}
public function getAddLabelIds()
{
return $this->addLabelIds;
}
public function setIds($ids)
{
$this->ids = $ids;
}
public function getIds()
{
return $this->ids;
}
public function setRemoveLabelIds($removeLabelIds)
{
$this->removeLabelIds = $removeLabelIds;
}
public function getRemoveLabelIds()
{
return $this->removeLabelIds;
}
}

View File

@@ -0,0 +1,46 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_Draft extends Google_Model
{
public $id;
protected $messageType = 'Google_Service_Gmail_Message';
protected $messageDataType = '';
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
/**
* @param Google_Service_Gmail_Message
*/
public function setMessage(Google_Service_Gmail_Message $message)
{
$this->message = $message;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessage()
{
return $this->message;
}
}

View File

@@ -0,0 +1,62 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_Filter extends Google_Model
{
protected $actionType = 'Google_Service_Gmail_FilterAction';
protected $actionDataType = '';
protected $criteriaType = 'Google_Service_Gmail_FilterCriteria';
protected $criteriaDataType = '';
public $id;
/**
* @param Google_Service_Gmail_FilterAction
*/
public function setAction(Google_Service_Gmail_FilterAction $action)
{
$this->action = $action;
}
/**
* @return Google_Service_Gmail_FilterAction
*/
public function getAction()
{
return $this->action;
}
/**
* @param Google_Service_Gmail_FilterCriteria
*/
public function setCriteria(Google_Service_Gmail_FilterCriteria $criteria)
{
$this->criteria = $criteria;
}
/**
* @return Google_Service_Gmail_FilterCriteria
*/
public function getCriteria()
{
return $this->criteria;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
}

View File

@@ -0,0 +1,49 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_FilterAction extends Google_Collection
{
protected $collection_key = 'removeLabelIds';
public $addLabelIds;
public $forward;
public $removeLabelIds;
public function setAddLabelIds($addLabelIds)
{
$this->addLabelIds = $addLabelIds;
}
public function getAddLabelIds()
{
return $this->addLabelIds;
}
public function setForward($forward)
{
$this->forward = $forward;
}
public function getForward()
{
return $this->forward;
}
public function setRemoveLabelIds($removeLabelIds)
{
$this->removeLabelIds = $removeLabelIds;
}
public function getRemoveLabelIds()
{
return $this->removeLabelIds;
}
}

View File

@@ -0,0 +1,102 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_FilterCriteria extends Google_Model
{
public $excludeChats;
public $from;
public $hasAttachment;
public $negatedQuery;
public $query;
public $size;
public $sizeComparison;
public $subject;
public $to;
public function setExcludeChats($excludeChats)
{
$this->excludeChats = $excludeChats;
}
public function getExcludeChats()
{
return $this->excludeChats;
}
public function setFrom($from)
{
$this->from = $from;
}
public function getFrom()
{
return $this->from;
}
public function setHasAttachment($hasAttachment)
{
$this->hasAttachment = $hasAttachment;
}
public function getHasAttachment()
{
return $this->hasAttachment;
}
public function setNegatedQuery($negatedQuery)
{
$this->negatedQuery = $negatedQuery;
}
public function getNegatedQuery()
{
return $this->negatedQuery;
}
public function setQuery($query)
{
$this->query = $query;
}
public function getQuery()
{
return $this->query;
}
public function setSize($size)
{
$this->size = $size;
}
public function getSize()
{
return $this->size;
}
public function setSizeComparison($sizeComparison)
{
$this->sizeComparison = $sizeComparison;
}
public function getSizeComparison()
{
return $this->sizeComparison;
}
public function setSubject($subject)
{
$this->subject = $subject;
}
public function getSubject()
{
return $this->subject;
}
public function setTo($to)
{
$this->to = $to;
}
public function getTo()
{
return $this->to;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ForwardingAddress extends Google_Model
{
public $forwardingEmail;
public $verificationStatus;
public function setForwardingEmail($forwardingEmail)
{
$this->forwardingEmail = $forwardingEmail;
}
public function getForwardingEmail()
{
return $this->forwardingEmail;
}
public function setVerificationStatus($verificationStatus)
{
$this->verificationStatus = $verificationStatus;
}
public function getVerificationStatus()
{
return $this->verificationStatus;
}
}

View File

@@ -0,0 +1,111 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_History extends Google_Collection
{
protected $collection_key = 'messagesDeleted';
public $id;
protected $labelsAddedType = 'Google_Service_Gmail_HistoryLabelAdded';
protected $labelsAddedDataType = 'array';
protected $labelsRemovedType = 'Google_Service_Gmail_HistoryLabelRemoved';
protected $labelsRemovedDataType = 'array';
protected $messagesType = 'Google_Service_Gmail_Message';
protected $messagesDataType = 'array';
protected $messagesAddedType = 'Google_Service_Gmail_HistoryMessageAdded';
protected $messagesAddedDataType = 'array';
protected $messagesDeletedType = 'Google_Service_Gmail_HistoryMessageDeleted';
protected $messagesDeletedDataType = 'array';
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
/**
* @param Google_Service_Gmail_HistoryLabelAdded
*/
public function setLabelsAdded($labelsAdded)
{
$this->labelsAdded = $labelsAdded;
}
/**
* @return Google_Service_Gmail_HistoryLabelAdded
*/
public function getLabelsAdded()
{
return $this->labelsAdded;
}
/**
* @param Google_Service_Gmail_HistoryLabelRemoved
*/
public function setLabelsRemoved($labelsRemoved)
{
$this->labelsRemoved = $labelsRemoved;
}
/**
* @return Google_Service_Gmail_HistoryLabelRemoved
*/
public function getLabelsRemoved()
{
return $this->labelsRemoved;
}
/**
* @param Google_Service_Gmail_Message
*/
public function setMessages($messages)
{
$this->messages = $messages;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessages()
{
return $this->messages;
}
/**
* @param Google_Service_Gmail_HistoryMessageAdded
*/
public function setMessagesAdded($messagesAdded)
{
$this->messagesAdded = $messagesAdded;
}
/**
* @return Google_Service_Gmail_HistoryMessageAdded
*/
public function getMessagesAdded()
{
return $this->messagesAdded;
}
/**
* @param Google_Service_Gmail_HistoryMessageDeleted
*/
public function setMessagesDeleted($messagesDeleted)
{
$this->messagesDeleted = $messagesDeleted;
}
/**
* @return Google_Service_Gmail_HistoryMessageDeleted
*/
public function getMessagesDeleted()
{
return $this->messagesDeleted;
}
}

View File

@@ -0,0 +1,47 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_HistoryLabelAdded extends Google_Collection
{
protected $collection_key = 'labelIds';
public $labelIds;
protected $messageType = 'Google_Service_Gmail_Message';
protected $messageDataType = '';
public function setLabelIds($labelIds)
{
$this->labelIds = $labelIds;
}
public function getLabelIds()
{
return $this->labelIds;
}
/**
* @param Google_Service_Gmail_Message
*/
public function setMessage(Google_Service_Gmail_Message $message)
{
$this->message = $message;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessage()
{
return $this->message;
}
}

View File

@@ -0,0 +1,47 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_HistoryLabelRemoved extends Google_Collection
{
protected $collection_key = 'labelIds';
public $labelIds;
protected $messageType = 'Google_Service_Gmail_Message';
protected $messageDataType = '';
public function setLabelIds($labelIds)
{
$this->labelIds = $labelIds;
}
public function getLabelIds()
{
return $this->labelIds;
}
/**
* @param Google_Service_Gmail_Message
*/
public function setMessage(Google_Service_Gmail_Message $message)
{
$this->message = $message;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessage()
{
return $this->message;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_HistoryMessageAdded extends Google_Model
{
protected $messageType = 'Google_Service_Gmail_Message';
protected $messageDataType = '';
/**
* @param Google_Service_Gmail_Message
*/
public function setMessage(Google_Service_Gmail_Message $message)
{
$this->message = $message;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessage()
{
return $this->message;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_HistoryMessageDeleted extends Google_Model
{
protected $messageType = 'Google_Service_Gmail_Message';
protected $messageDataType = '';
/**
* @param Google_Service_Gmail_Message
*/
public function setMessage(Google_Service_Gmail_Message $message)
{
$this->message = $message;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessage()
{
return $this->message;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ImapSettings extends Google_Model
{
public $autoExpunge;
public $enabled;
public $expungeBehavior;
public $maxFolderSize;
public function setAutoExpunge($autoExpunge)
{
$this->autoExpunge = $autoExpunge;
}
public function getAutoExpunge()
{
return $this->autoExpunge;
}
public function setEnabled($enabled)
{
$this->enabled = $enabled;
}
public function getEnabled()
{
return $this->enabled;
}
public function setExpungeBehavior($expungeBehavior)
{
$this->expungeBehavior = $expungeBehavior;
}
public function getExpungeBehavior()
{
return $this->expungeBehavior;
}
public function setMaxFolderSize($maxFolderSize)
{
$this->maxFolderSize = $maxFolderSize;
}
public function getMaxFolderSize()
{
return $this->maxFolderSize;
}
}

View File

@@ -0,0 +1,102 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_Label extends Google_Model
{
public $id;
public $labelListVisibility;
public $messageListVisibility;
public $messagesTotal;
public $messagesUnread;
public $name;
public $threadsTotal;
public $threadsUnread;
public $type;
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setLabelListVisibility($labelListVisibility)
{
$this->labelListVisibility = $labelListVisibility;
}
public function getLabelListVisibility()
{
return $this->labelListVisibility;
}
public function setMessageListVisibility($messageListVisibility)
{
$this->messageListVisibility = $messageListVisibility;
}
public function getMessageListVisibility()
{
return $this->messageListVisibility;
}
public function setMessagesTotal($messagesTotal)
{
$this->messagesTotal = $messagesTotal;
}
public function getMessagesTotal()
{
return $this->messagesTotal;
}
public function setMessagesUnread($messagesUnread)
{
$this->messagesUnread = $messagesUnread;
}
public function getMessagesUnread()
{
return $this->messagesUnread;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setThreadsTotal($threadsTotal)
{
$this->threadsTotal = $threadsTotal;
}
public function getThreadsTotal()
{
return $this->threadsTotal;
}
public function setThreadsUnread($threadsUnread)
{
$this->threadsUnread = $threadsUnread;
}
public function getThreadsUnread()
{
return $this->threadsUnread;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
}

View File

@@ -0,0 +1,56 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListDraftsResponse extends Google_Collection
{
protected $collection_key = 'drafts';
protected $draftsType = 'Google_Service_Gmail_Draft';
protected $draftsDataType = 'array';
public $nextPageToken;
public $resultSizeEstimate;
/**
* @param Google_Service_Gmail_Draft
*/
public function setDrafts($drafts)
{
$this->drafts = $drafts;
}
/**
* @return Google_Service_Gmail_Draft
*/
public function getDrafts()
{
return $this->drafts;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setResultSizeEstimate($resultSizeEstimate)
{
$this->resultSizeEstimate = $resultSizeEstimate;
}
public function getResultSizeEstimate()
{
return $this->resultSizeEstimate;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListFiltersResponse extends Google_Collection
{
protected $collection_key = 'filter';
protected $filterType = 'Google_Service_Gmail_Filter';
protected $filterDataType = 'array';
/**
* @param Google_Service_Gmail_Filter
*/
public function setFilter($filter)
{
$this->filter = $filter;
}
/**
* @return Google_Service_Gmail_Filter
*/
public function getFilter()
{
return $this->filter;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListForwardingAddressesResponse extends Google_Collection
{
protected $collection_key = 'forwardingAddresses';
protected $forwardingAddressesType = 'Google_Service_Gmail_ForwardingAddress';
protected $forwardingAddressesDataType = 'array';
/**
* @param Google_Service_Gmail_ForwardingAddress
*/
public function setForwardingAddresses($forwardingAddresses)
{
$this->forwardingAddresses = $forwardingAddresses;
}
/**
* @return Google_Service_Gmail_ForwardingAddress
*/
public function getForwardingAddresses()
{
return $this->forwardingAddresses;
}
}

View File

@@ -0,0 +1,56 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListHistoryResponse extends Google_Collection
{
protected $collection_key = 'history';
protected $historyType = 'Google_Service_Gmail_History';
protected $historyDataType = 'array';
public $historyId;
public $nextPageToken;
/**
* @param Google_Service_Gmail_History
*/
public function setHistory($history)
{
$this->history = $history;
}
/**
* @return Google_Service_Gmail_History
*/
public function getHistory()
{
return $this->history;
}
public function setHistoryId($historyId)
{
$this->historyId = $historyId;
}
public function getHistoryId()
{
return $this->historyId;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListLabelsResponse extends Google_Collection
{
protected $collection_key = 'labels';
protected $labelsType = 'Google_Service_Gmail_Label';
protected $labelsDataType = 'array';
/**
* @param Google_Service_Gmail_Label
*/
public function setLabels($labels)
{
$this->labels = $labels;
}
/**
* @return Google_Service_Gmail_Label
*/
public function getLabels()
{
return $this->labels;
}
}

View File

@@ -0,0 +1,56 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListMessagesResponse extends Google_Collection
{
protected $collection_key = 'messages';
protected $messagesType = 'Google_Service_Gmail_Message';
protected $messagesDataType = 'array';
public $nextPageToken;
public $resultSizeEstimate;
/**
* @param Google_Service_Gmail_Message
*/
public function setMessages($messages)
{
$this->messages = $messages;
}
/**
* @return Google_Service_Gmail_Message
*/
public function getMessages()
{
return $this->messages;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setResultSizeEstimate($resultSizeEstimate)
{
$this->resultSizeEstimate = $resultSizeEstimate;
}
public function getResultSizeEstimate()
{
return $this->resultSizeEstimate;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListSendAsResponse extends Google_Collection
{
protected $collection_key = 'sendAs';
protected $sendAsType = 'Google_Service_Gmail_SendAs';
protected $sendAsDataType = 'array';
/**
* @param Google_Service_Gmail_SendAs
*/
public function setSendAs($sendAs)
{
$this->sendAs = $sendAs;
}
/**
* @return Google_Service_Gmail_SendAs
*/
public function getSendAs()
{
return $this->sendAs;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListSmimeInfoResponse extends Google_Collection
{
protected $collection_key = 'smimeInfo';
protected $smimeInfoType = 'Google_Service_Gmail_SmimeInfo';
protected $smimeInfoDataType = 'array';
/**
* @param Google_Service_Gmail_SmimeInfo
*/
public function setSmimeInfo($smimeInfo)
{
$this->smimeInfo = $smimeInfo;
}
/**
* @return Google_Service_Gmail_SmimeInfo
*/
public function getSmimeInfo()
{
return $this->smimeInfo;
}
}

View File

@@ -0,0 +1,56 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ListThreadsResponse extends Google_Collection
{
protected $collection_key = 'threads';
public $nextPageToken;
public $resultSizeEstimate;
protected $threadsType = 'Google_Service_Gmail_Thread';
protected $threadsDataType = 'array';
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setResultSizeEstimate($resultSizeEstimate)
{
$this->resultSizeEstimate = $resultSizeEstimate;
}
public function getResultSizeEstimate()
{
return $this->resultSizeEstimate;
}
/**
* @param Google_Service_Gmail_Thread
*/
public function setThreads($threads)
{
$this->threads = $threads;
}
/**
* @return Google_Service_Gmail_Thread
*/
public function getThreads()
{
return $this->threads;
}
}

View File

@@ -0,0 +1,110 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_Message extends Google_Collection
{
protected $collection_key = 'labelIds';
public $historyId;
public $id;
public $internalDate;
public $labelIds;
protected $payloadType = 'Google_Service_Gmail_MessagePart';
protected $payloadDataType = '';
public $raw;
public $sizeEstimate;
public $snippet;
public $threadId;
public function setHistoryId($historyId)
{
$this->historyId = $historyId;
}
public function getHistoryId()
{
return $this->historyId;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setInternalDate($internalDate)
{
$this->internalDate = $internalDate;
}
public function getInternalDate()
{
return $this->internalDate;
}
public function setLabelIds($labelIds)
{
$this->labelIds = $labelIds;
}
public function getLabelIds()
{
return $this->labelIds;
}
/**
* @param Google_Service_Gmail_MessagePart
*/
public function setPayload(Google_Service_Gmail_MessagePart $payload)
{
$this->payload = $payload;
}
/**
* @return Google_Service_Gmail_MessagePart
*/
public function getPayload()
{
return $this->payload;
}
public function setRaw($raw)
{
$this->raw = $raw;
}
public function getRaw()
{
return $this->raw;
}
public function setSizeEstimate($sizeEstimate)
{
$this->sizeEstimate = $sizeEstimate;
}
public function getSizeEstimate()
{
return $this->sizeEstimate;
}
public function setSnippet($snippet)
{
$this->snippet = $snippet;
}
public function getSnippet()
{
return $this->snippet;
}
public function setThreadId($threadId)
{
$this->threadId = $threadId;
}
public function getThreadId()
{
return $this->threadId;
}
}

View File

@@ -0,0 +1,97 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_MessagePart extends Google_Collection
{
protected $collection_key = 'parts';
protected $bodyType = 'Google_Service_Gmail_MessagePartBody';
protected $bodyDataType = '';
public $filename;
protected $headersType = 'Google_Service_Gmail_MessagePartHeader';
protected $headersDataType = 'array';
public $mimeType;
public $partId;
protected $partsType = 'Google_Service_Gmail_MessagePart';
protected $partsDataType = 'array';
/**
* @param Google_Service_Gmail_MessagePartBody
*/
public function setBody(Google_Service_Gmail_MessagePartBody $body)
{
$this->body = $body;
}
/**
* @return Google_Service_Gmail_MessagePartBody
*/
public function getBody()
{
return $this->body;
}
public function setFilename($filename)
{
$this->filename = $filename;
}
public function getFilename()
{
return $this->filename;
}
/**
* @param Google_Service_Gmail_MessagePartHeader
*/
public function setHeaders($headers)
{
$this->headers = $headers;
}
/**
* @return Google_Service_Gmail_MessagePartHeader
*/
public function getHeaders()
{
return $this->headers;
}
public function setMimeType($mimeType)
{
$this->mimeType = $mimeType;
}
public function getMimeType()
{
return $this->mimeType;
}
public function setPartId($partId)
{
$this->partId = $partId;
}
public function getPartId()
{
return $this->partId;
}
/**
* @param Google_Service_Gmail_MessagePart
*/
public function setParts($parts)
{
$this->parts = $parts;
}
/**
* @return Google_Service_Gmail_MessagePart
*/
public function getParts()
{
return $this->parts;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_MessagePartBody extends Google_Model
{
public $attachmentId;
public $data;
public $size;
public function setAttachmentId($attachmentId)
{
$this->attachmentId = $attachmentId;
}
public function getAttachmentId()
{
return $this->attachmentId;
}
public function setData($data)
{
$this->data = $data;
}
public function getData()
{
return $this->data;
}
public function setSize($size)
{
$this->size = $size;
}
public function getSize()
{
return $this->size;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_MessagePartHeader extends Google_Model
{
public $name;
public $value;
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setValue($value)
{
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ModifyMessageRequest extends Google_Collection
{
protected $collection_key = 'removeLabelIds';
public $addLabelIds;
public $removeLabelIds;
public function setAddLabelIds($addLabelIds)
{
$this->addLabelIds = $addLabelIds;
}
public function getAddLabelIds()
{
return $this->addLabelIds;
}
public function setRemoveLabelIds($removeLabelIds)
{
$this->removeLabelIds = $removeLabelIds;
}
public function getRemoveLabelIds()
{
return $this->removeLabelIds;
}
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_ModifyThreadRequest extends Google_Collection
{
protected $collection_key = 'removeLabelIds';
public $addLabelIds;
public $removeLabelIds;
public function setAddLabelIds($addLabelIds)
{
$this->addLabelIds = $addLabelIds;
}
public function getAddLabelIds()
{
return $this->addLabelIds;
}
public function setRemoveLabelIds($removeLabelIds)
{
$this->removeLabelIds = $removeLabelIds;
}
public function getRemoveLabelIds()
{
return $this->removeLabelIds;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_PopSettings extends Google_Model
{
public $accessWindow;
public $disposition;
public function setAccessWindow($accessWindow)
{
$this->accessWindow = $accessWindow;
}
public function getAccessWindow()
{
return $this->accessWindow;
}
public function setDisposition($disposition)
{
$this->disposition = $disposition;
}
public function getDisposition()
{
return $this->disposition;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Gmail_Profile extends Google_Model
{
public $emailAddress;
public $historyId;
public $messagesTotal;
public $threadsTotal;
public function setEmailAddress($emailAddress)
{
$this->emailAddress = $emailAddress;
}
public function getEmailAddress()
{
return $this->emailAddress;
}
public function setHistoryId($historyId)
{
$this->historyId = $historyId;
}
public function getHistoryId()
{
return $this->historyId;
}
public function setMessagesTotal($messagesTotal)
{
$this->messagesTotal = $messagesTotal;
}
public function getMessagesTotal()
{
return $this->messagesTotal;
}
public function setThreadsTotal($threadsTotal)
{
$this->threadsTotal = $threadsTotal;
}
public function getThreadsTotal()
{
return $this->threadsTotal;
}
}

View File

@@ -0,0 +1,71 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "users" collection of methods.
* Typical usage is:
* <code>
* $gmailService = new Google_Service_Gmail(...);
* $users = $gmailService->users;
* </code>
*/
class Google_Service_Gmail_Resource_Users extends Google_Service_Resource
{
/**
* Gets the current user's Gmail profile. (users.getProfile)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Profile
*/
public function getProfile($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('getProfile', array($params), "Google_Service_Gmail_Profile");
}
/**
* Stop receiving push notifications for the given user mailbox. (users.stop)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param array $optParams Optional parameters.
*/
public function stop($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('stop', array($params));
}
/**
* Set up or update a push notification watch on the given user mailbox.
* (users.watch)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_WatchRequest $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_WatchResponse
*/
public function watch($userId, Google_Service_Gmail_WatchRequest $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('watch', array($params), "Google_Service_Gmail_WatchResponse");
}
}

View File

@@ -0,0 +1,130 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "drafts" collection of methods.
* Typical usage is:
* <code>
* $gmailService = new Google_Service_Gmail(...);
* $drafts = $gmailService->drafts;
* </code>
*/
class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
{
/**
* Creates a new draft with the DRAFT label. (drafts.create)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_Draft $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Draft
*/
public function create($userId, Google_Service_Gmail_Draft $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('create', array($params), "Google_Service_Gmail_Draft");
}
/**
* Immediately and permanently deletes the specified draft. Does not simply
* trash it. (drafts.delete)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the draft to delete.
* @param array $optParams Optional parameters.
*/
public function delete($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('delete', array($params));
}
/**
* Gets the specified draft. (drafts.get)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the draft to retrieve.
* @param array $optParams Optional parameters.
*
* @opt_param string format The format to return the draft in.
* @return Google_Service_Gmail_Draft
*/
public function get($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Gmail_Draft");
}
/**
* Lists the drafts in the user's mailbox. (drafts.listUsersDrafts)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param array $optParams Optional parameters.
*
* @opt_param bool includeSpamTrash Include drafts from SPAM and TRASH in the
* results.
* @opt_param string maxResults Maximum number of drafts to return.
* @opt_param string pageToken Page token to retrieve a specific page of results
* in the list.
* @opt_param string q Only return draft messages matching the specified query.
* Supports the same query format as the Gmail search box. For example,
* "from:someuser@example.com rfc822msgid: is:unread".
* @return Google_Service_Gmail_ListDraftsResponse
*/
public function listUsersDrafts($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Gmail_ListDraftsResponse");
}
/**
* Sends the specified, existing draft to the recipients in the To, Cc, and Bcc
* headers. (drafts.send)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_Draft $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Message
*/
public function send($userId, Google_Service_Gmail_Draft $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('send', array($params), "Google_Service_Gmail_Message");
}
/**
* Replaces a draft's content. (drafts.update)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the draft to update.
* @param Google_Service_Gmail_Draft $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Draft
*/
public function update($userId, $id, Google_Service_Gmail_Draft $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('update', array($params), "Google_Service_Gmail_Draft");
}
}

View File

@@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "history" collection of methods.
* Typical usage is:
* <code>
* $gmailService = new Google_Service_Gmail(...);
* $history = $gmailService->history;
* </code>
*/
class Google_Service_Gmail_Resource_UsersHistory extends Google_Service_Resource
{
/**
* Lists the history of all changes to the given mailbox. History results are
* returned in chronological order (increasing historyId).
* (history.listUsersHistory)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param array $optParams Optional parameters.
*
* @opt_param string historyTypes History types to be returned by the function
* @opt_param string labelId Only return messages with a label matching the ID.
* @opt_param string maxResults The maximum number of history records to return.
* @opt_param string pageToken Page token to retrieve a specific page of results
* in the list.
* @opt_param string startHistoryId Required. Returns history records after the
* specified startHistoryId. The supplied startHistoryId should be obtained from
* the historyId of a message, thread, or previous list response. History IDs
* increase chronologically but are not contiguous with random gaps in between
* valid IDs. Supplying an invalid or out of date startHistoryId typically
* returns an HTTP 404 error code. A historyId is typically valid for at least a
* week, but in some rare circumstances may be valid for only a few hours. If
* you receive an HTTP 404 error response, your application should perform a
* full sync. If you receive no nextPageToken in the response, there are no
* updates to retrieve and you can store the returned historyId for a future
* request.
* @return Google_Service_Gmail_ListHistoryResponse
*/
public function listUsersHistory($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Gmail_ListHistoryResponse");
}
}

View File

@@ -0,0 +1,120 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "labels" collection of methods.
* Typical usage is:
* <code>
* $gmailService = new Google_Service_Gmail(...);
* $labels = $gmailService->labels;
* </code>
*/
class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
{
/**
* Creates a new label. (labels.create)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_Label $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Label
*/
public function create($userId, Google_Service_Gmail_Label $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('create', array($params), "Google_Service_Gmail_Label");
}
/**
* Immediately and permanently deletes the specified label and removes it from
* any messages and threads that it is applied to. (labels.delete)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the label to delete.
* @param array $optParams Optional parameters.
*/
public function delete($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('delete', array($params));
}
/**
* Gets the specified label. (labels.get)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the label to retrieve.
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Label
*/
public function get($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Gmail_Label");
}
/**
* Lists all labels in the user's mailbox. (labels.listUsersLabels)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_ListLabelsResponse
*/
public function listUsersLabels($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Gmail_ListLabelsResponse");
}
/**
* Updates the specified label. This method supports patch semantics.
* (labels.patch)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the label to update.
* @param Google_Service_Gmail_Label $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Label
*/
public function patch($userId, $id, Google_Service_Gmail_Label $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('patch', array($params), "Google_Service_Gmail_Label");
}
/**
* Updates the specified label. (labels.update)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the label to update.
* @param Google_Service_Gmail_Label $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Label
*/
public function update($userId, $id, Google_Service_Gmail_Label $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('update', array($params), "Google_Service_Gmail_Label");
}
}

View File

@@ -0,0 +1,229 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "messages" collection of methods.
* Typical usage is:
* <code>
* $gmailService = new Google_Service_Gmail(...);
* $messages = $gmailService->messages;
* </code>
*/
class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resource
{
/**
* Deletes many messages by message ID. Provides no guarantees that messages
* were not already deleted or even existed at all. (messages.batchDelete)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_BatchDeleteMessagesRequest $postBody
* @param array $optParams Optional parameters.
*/
public function batchDelete($userId, Google_Service_Gmail_BatchDeleteMessagesRequest $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('batchDelete', array($params));
}
/**
* Modifies the labels on the specified messages. (messages.batchModify)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_BatchModifyMessagesRequest $postBody
* @param array $optParams Optional parameters.
*/
public function batchModify($userId, Google_Service_Gmail_BatchModifyMessagesRequest $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('batchModify', array($params));
}
/**
* Immediately and permanently deletes the specified message. This operation
* cannot be undone. Prefer messages.trash instead. (messages.delete)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the message to delete.
* @param array $optParams Optional parameters.
*/
public function delete($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('delete', array($params));
}
/**
* Gets the specified message. (messages.get)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the message to retrieve.
* @param array $optParams Optional parameters.
*
* @opt_param string format The format to return the message in.
* @opt_param string metadataHeaders When given and format is METADATA, only
* include headers specified.
* @return Google_Service_Gmail_Message
*/
public function get($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Gmail_Message");
}
/**
* Imports a message into only this user's mailbox, with standard email delivery
* scanning and classification similar to receiving via SMTP. Does not send a
* message. (messages.import)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_Message $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
* only visible in Google Vault to a Vault administrator. Only used for G Suite
* accounts.
* @opt_param string internalDateSource Source for Gmail's internal date of the
* message.
* @opt_param bool neverMarkSpam Ignore the Gmail spam classifier decision and
* never mark this email as SPAM in the mailbox.
* @opt_param bool processForCalendar Process calendar invites in the email and
* add any extracted meetings to the Google Calendar for this user.
* @return Google_Service_Gmail_Message
*/
public function import($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('import', array($params), "Google_Service_Gmail_Message");
}
/**
* Directly inserts a message into only this user's mailbox similar to IMAP
* APPEND, bypassing most scanning and classification. Does not send a message.
* (messages.insert)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_Message $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
* only visible in Google Vault to a Vault administrator. Only used for G Suite
* accounts.
* @opt_param string internalDateSource Source for Gmail's internal date of the
* message.
* @return Google_Service_Gmail_Message
*/
public function insert($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('insert', array($params), "Google_Service_Gmail_Message");
}
/**
* Lists the messages in the user's mailbox. (messages.listUsersMessages)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param array $optParams Optional parameters.
*
* @opt_param bool includeSpamTrash Include messages from SPAM and TRASH in the
* results.
* @opt_param string labelIds Only return messages with labels that match all of
* the specified label IDs.
* @opt_param string maxResults Maximum number of messages to return.
* @opt_param string pageToken Page token to retrieve a specific page of results
* in the list.
* @opt_param string q Only return messages matching the specified query.
* Supports the same query format as the Gmail search box. For example,
* "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used
* when accessing the api using the gmail.metadata scope.
* @return Google_Service_Gmail_ListMessagesResponse
*/
public function listUsersMessages($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Gmail_ListMessagesResponse");
}
/**
* Modifies the labels on the specified message. (messages.modify)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the message to modify.
* @param Google_Service_Gmail_ModifyMessageRequest $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Message
*/
public function modify($userId, $id, Google_Service_Gmail_ModifyMessageRequest $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('modify', array($params), "Google_Service_Gmail_Message");
}
/**
* Sends the specified message to the recipients in the To, Cc, and Bcc headers.
* (messages.send)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param Google_Service_Gmail_Message $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Message
*/
public function send($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('send', array($params), "Google_Service_Gmail_Message");
}
/**
* Moves the specified message to the trash. (messages.trash)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the message to Trash.
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Message
*/
public function trash($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('trash', array($params), "Google_Service_Gmail_Message");
}
/**
* Removes the specified message from the trash. (messages.untrash)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $id The ID of the message to remove from Trash.
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Message
*/
public function untrash($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('untrash', array($params), "Google_Service_Gmail_Message");
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "attachments" collection of methods.
* Typical usage is:
* <code>
* $gmailService = new Google_Service_Gmail(...);
* $attachments = $gmailService->attachments;
* </code>
*/
class Google_Service_Gmail_Resource_UsersMessagesAttachments extends Google_Service_Resource
{
/**
* Gets the specified message attachment. (attachments.get)
*
* @param string $userId The user's email address. The special value me can be
* used to indicate the authenticated user.
* @param string $messageId The ID of the message containing the attachment.
* @param string $id The ID of the attachment.
* @param array $optParams Optional parameters.
* @return Google_Service_Gmail_MessagePartBody
*/
public function get($userId, $messageId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'messageId' => $messageId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Gmail_MessagePartBody");
}
}

Some files were not shown because too many files have changed in this diff Show More