File: /home/coopserp/www/init.php.tar
home/coopserp/public_html/wp-content/plugins/gosmtp/init.php 0000644 00000021470 15152642325 0020405 0 ustar 00 <?php
/*
* GoSMTP
* https://gosmtp.net
* (c) Softaculous Team
*/
// We need the ABSPATH
if (!defined('ABSPATH')) exit;
define('GOSMTP_BASE', plugin_basename(GOSMTP_FILE));
define('GOSMTP_VERSION', '1.1.9');
define('GOSMTP_DIR', dirname(GOSMTP_FILE));
define('GOSMTP_SLUG', 'gosmtp');
define('GOSMTP_URL', plugins_url('', GOSMTP_FILE));
define('GOSMTP_CSS', GOSMTP_URL.'/css');
define('GOSMTP_JS', GOSMTP_URL.'/js');
define('GOSMTP_PRO_URL', 'https://gosmtp.net/pricing?from=plugin');
define('GOSMTP_WWW_URL', 'https://gosmtp.net/');
define('GOSMTP_DOCS', 'https://gosmtp.net/docs/');
define('GOSMTP_DB_PREFIX', 'gosmtp_');
include_once(GOSMTP_DIR.'/main/functions.php');
spl_autoload_register('gosmtp_autoload_register');
function gosmtp_autoload_register($class){
if(!preg_match('/GOSMTP\\\\/', $class)){
return;
}
$file = strtolower(str_replace( array('GOSMTP', '\\'), array('', DIRECTORY_SEPARATOR), $class));
$file = trim(strtolower($file), '/').'.php';
// For Free
if(file_exists(GOSMTP_DIR.'/main/'.$file)){
include_once(GOSMTP_DIR.'/main/'.$file);
}
// For Pro
if(defined('GOSMTP_PRO_DIR') && file_exists(GOSMTP_PRO_DIR.'/main/'.$file)){
include_once(GOSMTP_PRO_DIR.'/main/'.$file);
}
}
function gosmtp_died(){
print_r(error_get_last());
}
//register_shutdown_function('gosmtp_died');
// Ok so we are now ready to go
register_activation_hook(GOSMTP_FILE, 'gosmtp_activation');
// Is called when the ADMIN enables the plugin
function gosmtp_activation(){
global $wpdb;
add_option('gosmtp_version', GOSMTP_VERSION);
}
// Checks if we are to update ?
function gosmtp_update_check(){
global $wpdb;
$current_version = get_option('gosmtp_version');
$version = (int) str_replace('.', '', $current_version);
// No update required
if($current_version == GOSMTP_VERSION){
return true;
}
// Is it first run ?
if(empty($current_version)){
// Reinstall
gosmtp_activation();
// Trick the following if conditions to not run
$version = (int) str_replace('.', '', GOSMTP_VERSION);
}
// Save the new Version
update_option('gosmtp_version', GOSMTP_VERSION);
}
// Add action to load GoSMTP
add_action('plugins_loaded', 'gosmtp_load_plugin');
function gosmtp_load_plugin(){
global $gosmtp;
if(empty($gosmtp)){
$gosmtp = new stdClass();
}
// Check if the installed version is outdated
gosmtp_update_check();
$options = get_option('gosmtp_options', array());
$gosmtp->options = empty($options) ? array() : $options;
}
// The function that will be called when the plugin is loaded
add_action('wp_mail', 'gosmtp_load_phpmailer');
function gosmtp_load_phpmailer($atts){
global $gosmtp, $phpmailer;
if(!class_exists('GOSMTP_PHPMailer')){
// Load PHPMailer class, so we can subclass it.
require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
class GOSMTP_PHPMailer extends \PHPMailer\PHPMailer\PHPMailer {
// Modify the default send() behaviour of PHPMailer.
public function send(){
global $gosmtp, $phpmailer;
// Define a custom header, that will be used to identify the plugin and the mailer.
$this->XMailer = 'GOSMTP/Mailer/' . $gosmtp->_mailer . ' ' . GOSMTP_VERSION;
do_action( 'gosmtp_mailer_mail_pre_send' );
// If mailer not exists or send function not exists
if(!method_exists($gosmtp->mailer, 'send')){
return parent::send();
}
do_action( 'gosmtp_mailer_mail_send_before' );
// Are we to enforce from ?
$gosmtp->mailer->set_from();
$exception = false;
/*
* Send the actual email.
* We reuse everything, that was preprocessed for usage in \PHPMailer.
*/
try{
$is_sent = $gosmtp->mailer->send();
}catch(PHPMailer\PHPMailer\Exception $e){
$is_sent = false;
$exception = $e;
}
// Get backup connection
$backup_connection = $gosmtp->mailer->get_backup_connection();
$backup_sent = false;
// Store current values
$current_data = array(
'_mailer' => $gosmtp->_mailer,
'mailer' => $gosmtp->mailer,
'conn_id' => $gosmtp->mailer->conn_id
);
// Try to send email with secondary email
if(empty($is_sent) && !empty($backup_connection) ){
$mailer = sanitize_key( $gosmtp->options['mailer'][$backup_connection]['mail_type'] );
$class = $gosmtp->mailer_list[$mailer]['class'];
$parent_log = $gosmtp->mailer->last_log;
if(class_exists($class)){
$gosmtp->_mailer = $mailer;
$gosmtp->mailer = new $class();
$gosmtp->mailer->conn_id = $backup_connection;
$gosmtp->mailer->parent_log = $parent_log;
try{
$backup_sent = $phpmailer->send();
}catch(Exception $e){}
}
}
// Reset connection
$gosmtp->_mailer = $current_data['_mailer'];
$gosmtp->mailer = $current_data['mailer'];
$gosmtp->mailer->conn_id = $current_data['conn_id'];
do_action( 'gosmtp_mailer_mail_send_after', $is_sent, $exception, $backup_sent );
if($exception && !$backup_sent){
throw $exception;
}
return $is_sent || $backup_sent;
}
}
}
if($phpmailer instanceof GOSMTP_PHPMailer){
return $atts;
}
// Load all mailer
$gosmtp->mailer_list = gosmtp_get_mailer_list();
$connection_key = apply_filters('gosmtp_connection_key', 0);
// Making sure the filter returns expected type
if(!is_string($connection_key) && !is_int($connection_key)){
$connection_key = 0;
}
// For PHP Email dont do anything
if(empty($gosmtp->options['mailer'][$connection_key]['mail_type'])){
return $atts;
}
$mailer = sanitize_key( $gosmtp->options['mailer'][$connection_key]['mail_type'] );
$class = $gosmtp->mailer_list[$mailer]['class'];
if(!class_exists($class)){
return $atts;
}
$gosmtp->_mailer = $mailer;
$gosmtp->mailer = new $class();
$gosmtp->mailer->conn_id = $connection_key;
// Handle the from email name
add_filter('wp_mail_from', [$gosmtp->mailer, 'get_from'], 100, 1);
$phpmailer = new GOSMTP_PHPMailer(true);
return $atts;
}
// This adds the left menu in WordPress Admin page
add_action('admin_menu', 'gosmtp_admin_menu', 5);
function gosmtp_admin_menu() {
global $wp_version;
$capability = 'activate_plugins';// TODO : Capability for accessing this page
// Add the menu page
add_menu_page(__('GoSMTP', 'gosmtp'), __('GoSMTP', 'gosmtp'), $capability, 'gosmtp', 'gosmtp_page_handler', 'dashicons-email-alt');
// Settings Page
add_submenu_page( 'gosmtp', __('Settings', 'gosmtp'), __('Settings', 'gosmtp'), $capability, 'gosmtp', 'gosmtp_page_handler');
// Test Mail Page
add_submenu_page( 'gosmtp', 'Test Mail', 'Test Mail', $capability, 'gosmtp#test-mail', 'gosmtp_page_handler');
if(defined('GOSMTP_PREMIUM')){
// Logs Page
add_submenu_page( 'gosmtp', __('Email Logs', 'gosmtp'), __('Email Logs', 'gosmtp'), $capability, 'gosmtp-logs', 'gosmtp_logs_handler');
// Email reports
add_submenu_page( 'gosmtp', __('Email Reports', 'gosmtp'), __('Email Reports', 'gosmtp'), $capability, 'email_reports', 'gosmtp_email_reports_handler');
// Export Page
add_submenu_page( 'gosmtp', __('Export', 'gosmtp'), __('Export', 'gosmtp'), $capability, 'export', 'gosmtp_export_handler');
// Email reports
add_submenu_page( '', __('Email Reports', 'gosmtp'), __('Weekly Email', 'gosmtp'), $capability, 'weekly_email_reports', 'gosmtp_weekly_email_handler');
// License Page
if(!defined('SITEPAD')){
add_submenu_page( 'gosmtp', __('License', 'gosmtp'), __('License', 'gosmtp'), $capability, 'gosmtp-license', 'gosmtp_license_handler');
}
}
// Support
if(!defined('SITEPAD')){
add_submenu_page( 'gosmtp', __('Support', 'gosmtp'), __('Support', 'gosmtp'), $capability, 'gosmtp#support', 'gosmtp_page_handler');
}
}
// SMTP page Handler
function gosmtp_page_handler(){
include_once GOSMTP_DIR .'/main/settings.php';
gosmtp_settings_page();
}
function gosmtp_logs_handler(){
include_once GOSMTP_PRO_DIR .'/main/smtp-logs.php';
}
function gosmtp_email_reports_handler(){
include_once GOSMTP_PRO_DIR .'/main/email-reports.php';
gosmtp_reports_table();
}
function gosmtp_export_handler(){
include_once GOSMTP_PRO_DIR .'/main/export.php';
gosmtp_export_page();
}
function gosmtp_weekly_email_handler(){
include_once GOSMTP_PRO_DIR .'/main/weekly_email_reports.php';
gosmtp_send_email_reports();
}
function gosmtp_license_handler(){
global $gosmtp;
include_once GOSMTP_PRO_DIR .'/main/license.php';
}
if(wp_doing_ajax()){
include_once GOSMTP_DIR.'/main/ajax.php';
}
add_action( 'admin_init', 'gosmtp_admin_init');
function gosmtp_admin_init(){
wp_register_style( 'gosmtp-admin', GOSMTP_URL .'/css/admin.css', array(), GOSMTP_VERSION);
wp_register_script( 'gosmtp-admin', GOSMTP_URL .'/js/admin.js', array('jquery'), GOSMTP_VERSION);
include_once GOSMTP_DIR .'/main/admin.php';
gosmtp_admin_hooks();
} home/coopserp/public_html/wp-content/plugins/speedycache-pro/init.php 0000644 00000020522 15152643456 0022152 0 ustar 00 <?php
if(!defined('ABSPATH')){
die('Hacking Attempt!');
}
if(!class_exists('SpeedyCache')){
#[\AllowDynamicProperties]
class SpeedyCache{
public $options = array();
public $brand_name = 'SpeedyCache';
public $logs;
public $settings;
public $license;
public $image;
public $mobile_cache;
public $columnjs;
public $js;
public $css_util;
public $render_blocking;
public $enhanced;
public $object;
public $bloat;
}
}
// Prevent update of speedycache free
// This also work for auto update
add_filter('site_transient_update_plugins', 'speedycache_pro_disable_manual_update_for_plugin');
add_filter('pre_site_transient_update_plugins', 'speedycache_pro_disable_manual_update_for_plugin');
// Auto update free version after update pro version
add_action('upgrader_process_complete', 'speedycache_pro_update_free_after_pro', 10, 2);
add_action('plugins_loaded', 'speedycache_pro_load_plugin');
register_activation_hook( __FILE__, 'speedycache_pro_activate');
function speedycache_pro_load_plugin(){
global $speedycache;
if(empty($speedycache)){
$speedycache = new \SpeedyCache();
}
speedycache_pro_load_license();
// Actions to handle WP Cron schedules
add_action('speedycache_auto_optm', '\SpeedyCache\Image::auto_optimize', 10, 1);
add_action('speedycache_img_delete', '\SpeedyCache\Image::scheduled_delete', 10, 1);
add_action('speedycache_generate_ccss', '\SpeedyCache\CriticalCss::generate', 10, 1);
add_action('speedycache_unused_css', '\SpeedyCache\UnusedCss::generate', 10, 1);
speedycache_pro_update_check();
add_action('speedycache_test_event', 'speedycache_pro_run_test');
// Check for updates
include_once(SPEEDYCACHE_PRO_DIR . '/main/plugin-update-checker.php');
$speedycache_updater = SpeedyCache_PucFactory::buildUpdateChecker(speedycache_pro_api_url().'/updates.php?version='.SPEEDYCACHE_PRO_VERSION, SPEEDYCACHE_PRO_FILE);
// Add the license key to query arguments
$speedycache_updater->addQueryArgFilter('speedycache_pro_updater_filter_args');
// Show the text to install the license key
add_filter('puc_manual_final_check_link-speedycache-pro', 'speedycache_pro_updater_check_link', 10, 1);
if(!is_admin() && !current_user_can('activate_plugins')){
return;
}
include_once SPEEDYCACHE_PRO_DIR . '/main/admin.php';
add_action('admin_notices', 'speedycachepro_free_version_nag');
}
// Nag when plugins dont have same version.
function speedycachepro_free_version_nag(){
if(!defined('SPEEDYCACHE_VERSION')){
return;
}
$dismissed_free = (int) get_option('speedycache_version_free_nag');
$dismissed_pro = (int) get_option('speedycache_version_pro_nag');
// Checking if time has passed since the dismiss.
if(!empty($dismissed_free) && time() < $dismissed_pro && !empty($dismissed_pro) && time() < $dismissed_pro){
return;
}
$showing_error = false;
if(version_compare(SPEEDYCACHE_VERSION, SPEEDYCACHE_PRO_VERSION) > 0 && (empty($dismissed_pro) || time() > $dismissed_pro)){
$showing_error = true;
echo '<div class="notice notice-warning is-dismissible" id="speedycache-pro-version-notice" onclick="speedycache_pro_dismiss_notice(event)" data-type="pro">
<p style="font-size:16px;">'.esc_html__('You are using an older version of SpeedyCache Pro. We recommend updating to the latest version to ensure seamless and uninterrupted use of the application.', 'speedycache').'</p>
</div>';
}elseif(version_compare(SPEEDYCACHE_VERSION, SPEEDYCACHE_PRO_VERSION) < 0 && (empty($dismissed_free) || time() > $dismissed_free)){
$showing_error = true;
echo '<div class="notice notice-warning is-dismissible" id="speedycache-pro-version-notice" onclick="speedycache_pro_dismiss_notice(event)" data-type="free">
<p style="font-size:16px;">'.esc_html__('You are using an older version of SpeedyCache. We recommend updating to the latest free version to ensure smooth and uninterrupted use of the application.', 'speedycache').'</p>
</div>';
}
if(!empty($showing_error)){
wp_register_script('speedycache-pro-version-notice', '', array('jquery'), SPEEDYCACHE_PRO_VERSION, true );
wp_enqueue_script('speedycache-pro-version-notice');
wp_add_inline_script('speedycache-pro-version-notice', '
function speedycache_pro_dismiss_notice(e){
e.preventDefault();
let target = jQuery(e.target);
if(!target.hasClass("notice-dismiss")){
return;
}
let jEle = target.closest("#speedycache-pro-version-notice"),
type = jEle.data("type");
jEle.slideUp();
jQuery.post("'.admin_url('admin-ajax.php').'", {
security : "'.wp_create_nonce('speedycache_version_notice').'",
action: "speedycache_pro_version_notice",
type: type
}, function(res){
if(!res["success"]){
alert(res["data"]);
}
}).fail(function(data){
alert("There seems to be some issue dismissing this alert");
});
}');
}
}
// Version nag ajax
function speedycache_pro_version_notice(){
check_admin_referer('speedycache_version_notice', 'security');
if(!current_user_can('activate_plugins')){
wp_send_json_error(__('You do not have required access to do this action', 'speedycache-pro'));
}
$type = '';
if(!empty($_REQUEST['type'])){
$type = sanitize_text_field(wp_unslash($_REQUEST['type']));
}
if(empty($type)){
wp_send_json_error(__('Unknown version difference type', 'speedycache-pro'));
}
update_option('speedycache_version_'. $type .'_nag', time() + WEEK_IN_SECONDS);
wp_send_json_success();
}
add_action('wp_ajax_speedycache_pro_version_notice', 'speedycache_pro_version_notice');
function speedycache_pro_run_test() {
update_option('speedycache_test_executed', 1);
$speedycache_options = get_option('speedycache_options', []);
$should_test_optimization = (empty($speedycache_options['delay_js']) || empty($speedycache_options['render_blocking']));
if (!$should_test_optimization){
return;
}
$url = site_url();
$old_score_arr = speedycache_pro_test_score($url);
$new_score_arr = speedycache_pro_test_score($url . '?test_speedycache=1');
$old_score = intval($old_score_arr['score']);
$new_score = intval($new_score_arr['score']);
if($new_score <= $old_score){
return;
}
$test_results = [
'old_score' => $old_score,
'new_score' => $new_score,
];
// Deleting the test file
$test_dir = \SpeedyCache\Util::cache_path('test');
if(file_exists($test_dir) && file_exists($test_dir .'/index.html')){
unlink($test_dir .'/index.html');
}
update_option('speedycache_test_results', $test_results);
}
function speedycache_pro_test_score($url) {
$parsed_url = parse_url($url);
parse_str($parsed_url['query'] ?? '', $query_params);
$is_test_mode = isset($query_params['test_speedycache']) && $query_params['test_speedycache'] === '1';
if($is_test_mode){
global $speedycache;
$speedycache_test_options = ['minify_html' => true, 'delay_js' => true, 'render_blocking' => true, 'minify_js' => true, 'critical_images' => true, 'lazy_load' => true, 'delay_js_mode' => 'selected', 'delay_js_scripts' => ['fbevents.js', 'google-analytics.com', 'adsbygoogle.js', 'googletagmanager.com', 'fbq(', "ga( '", "ga('", '/gtm.js', '/gtag/js', 'gtag(', '/gtm-', '/gtm.']];
$speedycache->options = array_merge($speedycache->options, $speedycache_test_options);
$test_folder = \SpeedyCache\Util::cache_path('test');
if(!file_exists($test_folder)){
mkdir($test_folder, 0755, true);
}
$cache_content = speedycache_pro_generate_test_cache($url);
if($cache_content){
file_put_contents($test_folder . '/index.html', $cache_content);
}
}
$api_url = SPEEDYCACHE_API . 'pagespeed.php?url=' . $url;
$res = wp_remote_post($api_url, [
'sslverify' => false,
'timeout' => 30
]);
if(is_wp_error($res) || empty($res['body'])){
return 0;
}
$body = json_decode($res['body'], true);
return !empty($body['success']) && !empty($body['results']) ? $body['results'] : 0;
}
function speedycache_pro_generate_test_cache($url) {
$response = wp_safe_remote_get($url);
if(is_wp_error($response) || empty($response['body'])){
return false;
}
return $response['body'];
}
//register_deactivation_hook( __FILE__, '\SpeedyCache\Install::deactivate');
// Load WP CLI command(s) on demand.
if(defined('WP_CLI') && !empty(WP_CLI) && defined('SPEEDYCACHE_PRO')){
include_once SPEEDYCACHE_PRO_DIR.'/main/cli.php';
}