| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link https://socketlabs.com |
| 12 |
* @since 1.0.4 |
| 13 |
* @package SocketLabs |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: SocketLabs |
| 17 |
* Plugin URI: https://github.com/socketlabs/wordpress |
| 18 |
* Description: Send emails using your SocketLabs account. |
| 19 |
* Version: 1.2.2 |
| 20 |
* Author: SocketLabs |
| 21 |
* Author URI: https://socketlabs.com/ |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: socketlabs |
| 25 |
* Domain Path: /languages |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
/* |
| 30 |
The SocketLabs WordPress Plugin is free software: you can redistribute it and/or modify |
| 31 |
it under the terms of the GNU General Public License as published by |
| 32 |
the Free Software Foundation, either version 2 of the License, or |
| 33 |
any later version. |
| 34 |
|
| 35 |
The SocketLabs WordPress Plugin is distributed in the hope that it will be useful, |
| 36 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 37 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 38 |
GNU General Public License for more details. |
| 39 |
|
| 40 |
You should have received a copy of the GNU General Public License |
| 41 |
along with The SocketLabs WordPress Plugin. If not, see http://www.gnu.org/licenses/gpl-2.0.txt. |
| 42 |
*/ |
| 43 |
|
| 44 |
|
| 45 |
// If this file is called directly, abort. |
| 46 |
if ( ! defined( 'WPINC' ) ) { |
| 47 |
die; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Currently plugin version. |
| 52 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 53 |
* Rename this for your plugin and update it as you release new versions. |
| 54 |
*/ |
| 55 |
define('SOCKETLABS_VERSION', '1.2.2'); |
| 56 |
define("SOCKETLABS_OPTION_GROUP", 'socketlabs'); |
| 57 |
define("SOCKETLABS_API_KEY", 'socketlabs_api_key'); |
| 58 |
define("SOCKETLABS_SERVER_ID", 'socketlabs_server_id'); |
| 59 |
define("SOCKETLABS_INJECTION_URL", "https://inject.socketlabs.com/api/v1/email"); |
| 60 |
|
| 61 |
/** |
| 62 |
* The code that runs during plugin activation. |
| 63 |
* This action is documented in includes/class-plugin-name-activator.php |
| 64 |
*/ |
| 65 |
function activate_socketlabs() { |
| 66 |
delete_option(SOCKETLABS_OPTION_GROUP); |
| 67 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-socketlabs-activator.php'; |
| 68 |
Socketlabs_Activator::activate(); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* The code that runs during plugin deactivation. |
| 73 |
* This action is documented in includes/class-socketlabs-deactivator.php |
| 74 |
*/ |
| 75 |
function deactivate_socketlabs() { |
| 76 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-socketlabs-deactivator.php'; |
| 77 |
Socketlabs_Deactivator::deactivate(); |
| 78 |
} |
| 79 |
|
| 80 |
register_activation_hook( __FILE__, 'activate_socketlabs' ); |
| 81 |
register_deactivation_hook( __FILE__, 'deactivate_socketlabs' ); |
| 82 |
//register_uninstall_hook( __FILE__, 'uninstall_socketlabs' ); |
| 83 |
|
| 84 |
/** |
| 85 |
* The core plugin class that is used to define internationalization, |
| 86 |
* admin-specific hooks, and public-facing site hooks. |
| 87 |
*/ |
| 88 |
require plugin_dir_path( __FILE__ ) . 'includes/class-socketlabs.php'; |
| 89 |
|
| 90 |
/** |
| 91 |
* Begins execution of the plugin. |
| 92 |
* |
| 93 |
* Since everything within the plugin is registered via hooks, |
| 94 |
* then kicking off the plugin from this point in the file does |
| 95 |
* not affect the page life cycle. |
| 96 |
* |
| 97 |
* @since 1.0.0 |
| 98 |
*/ |
| 99 |
function run_socketlabs() { |
| 100 |
$plugin = new Socketlabs(); |
| 101 |
$plugin->run(); |
| 102 |
|
| 103 |
|
| 104 |
if(!function_exists("wp_mail")){ |
| 105 |
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { |
| 106 |
|
| 107 |
$socketlabs_mailer = new Socketlabs_Mailer($to, $subject, $message, $headers, $attachments); |
| 108 |
$response = $socketlabs_mailer->send(); |
| 109 |
|
| 110 |
if ( is_wp_error( $response ) ) { |
| 111 |
$error_message = $response->get_error_message(); |
| 112 |
return false; |
| 113 |
} else { |
| 114 |
return true; |
| 115 |
} |
| 116 |
} |
| 117 |
} |
| 118 |
} |
| 119 |
run_socketlabs(); |
| 120 |
|
| 121 |
|