From 8384403af18b4a7e4cd11f8957010fb3b2901e6a Mon Sep 17 00:00:00 2001
From: Lai Power '.__( 'You\'re set and ready to go', 'companion-auto-update' ).' '.__( 'The plugin is all set and ready to go with the recommended settings, but if you\'d like you can change them below.' ).' '.__( 'Get Started' ).': '.__( 'Update filter', 'companion-auto-update' ).' |
- '.__( 'More Actions' ).': '.__('Give feedback', 'companion-auto-update').' - '.__( 'Help us translate', 'companion-auto-update' ).' '.__( 'You\'re set and ready to go', 'companion-auto-update' ).' '.__( 'The plugin is all set and ready to go with the recommended settings, but if you\'d like you can change them below.' ).' '.__( 'Get Started' ).': '.__( 'Update filter', 'companion-auto-update' ).' |
+ '.__( 'More Actions' ).': '.__('Give feedback', 'companion-auto-update').' - '.__( 'Help us translate', 'companion-auto-update' ).''.__( 'Welcome to Companion Auto Update', 'companion-auto-update' ).'
-
-
- '.__( 'Welcome to Companion Auto Update', 'companion-auto-update' ).'
+
+
+
'; - - echo '
'; - - echo '
'; - - echo '
'; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; ?> @@ -267,8 +249,12 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
- + @@ -310,8 +296,8 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' ); |
|
@@ -443,23 +429,35 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
+
+
- - + + | |
- + | |
diff --git a/wp-content/plugins/companion-auto-update/cau_emails.php b/wp-content/plugins/companion-auto-update/cau_emails.php
index f1f29f94..19634c88 100644
--- a/wp-content/plugins/companion-auto-update/cau_emails.php
+++ b/wp-content/plugins/companion-auto-update/cau_emails.php
@@ -1,525 +1,524 @@
- $version ) {
- if( $version == '' ) $version = __( "Unknown", "companion-auto-update" );
- $text .= "- ".sprintf( esc_html__( "%s tested up to: %s", "companion-auto-update" ), $plugin, $version )."\n";
- }
-
- }
-
- return $text;
-
-}
-
-// Set the content for the emails about pending updates
-function cau_pending_message( $single, $plural, $list ) {
-
- // What markup to use
- if( cau_is_html() ) $break = ' '; - else $break = "\n"; - - // Base text - $text = sprintf( esc_html__( 'You have pending %1$s updates on your WordPress site at %2$s.', 'companion-auto-update' ), $single, get_site_url() ); - $text .= $break; - - if( !empty( $list ) ) { - - $text .= $break; - $text .= sprintf( esc_html__( 'The following %1$s have new versions available.', 'companion-auto-update' ), $plural ); - $text .= $break; - - if( cau_is_html() ) $text .= "
'; - else $break = "\n"; - - // The message - $text = sprintf( esc_html__( - 'One or more %1$s on your WordPress site at %2$s have been updated by Companion Auto Update. No further action is needed on your part. -For more info on what is new visit your dashboard and check the changelog.', 'companion-auto-update' - ), $type, get_site_url() ); - - $text .= $break; - $text .= $break; - $text .= sprintf( esc_html__( - 'The following %1$s have been updated:', 'companion-auto-update' - ), $type ); - - $text .= $break; - $text .= $updatedList; - - $text .= $break; - $text .= __( "(You'll also receive this email if you manually updated a plugin or theme)", "companion-auto-update" ); - - return $text; - -} - -// Checks if plugins are out of date -function cau_list_outdated_software() { - - // Check if cau_get_db_value() function exists. - if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' ); - - // Set up mail - $subject = '['.get_bloginfo( 'name' ).'] ' . __( 'You have outdated plugins on your site.', 'companion-auto-update' ); - $type = __( 'plugin', 'companion-auto-update' ); - $type_plural = __( 'plugins', 'companion-auto-update' ); - $message = cau_outdated_message( $type, $type_plural, cau_list_outdated() ); - - // Send to all addresses - foreach ( cau_set_email() as $key => $value ) { - foreach ( $value as $k => $v ) { - wp_mail( $v, $subject, $message ); - } - break; - } - -} - -// Checks if theme updates are available -function cau_list_theme_updates() { - - global $wpdb; - $table_name = $wpdb->prefix . "auto_updates"; - - $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'"); - foreach ( $configs as $config ) { - - if( $config->onoroff != 'on' ) { - - require_once ABSPATH . '/wp-admin/includes/update.php'; - $themes = get_theme_updates(); - $list = array(); - - if ( !empty( $themes ) ) { - - foreach ( $themes as $stylesheet => $theme ) { - array_push( $list, $theme->get( 'Name' ) ); - } - - $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Theme update available.', 'companion-auto-update' ); - $type = __('theme', 'companion-auto-update'); - $type_plural = __('themes', 'companion-auto-update'); - $message = cau_pending_message( $type, $type_plural, $list ); - - foreach ( cau_set_email() as $key => $value) { - foreach ($value as $k => $v) { - wp_mail( $v, $subject, $message ); - } - break; - } - } - - } - - } - -} - -// Checks if plugin updates are available -function cau_list_plugin_updates() { - - global $wpdb; - $table_name = $wpdb->prefix . "auto_updates"; - - $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'"); - foreach ( $configs as $config ) { - - if( $config->onoroff != 'on' ) { - - require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); - - if ( !function_exists( 'get_plugin_updates' ) ) require_once ABSPATH . 'wp-admin/includes/update.php'; - $plugins = get_plugin_updates(); - - if ( !empty( $plugins ) ) { - - $list = array(); - foreach ( (array) $plugins as $plugin_file => $plugin_data ) { - $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); - $name = $plugin_data->Name; - array_push( $list, $name ); - } - - $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Plugin update available.', 'companion-auto-update' ); - $type = __( 'plugin', 'companion-auto-update' ); - $type_plural = __( 'plugins', 'companion-auto-update' ); - $message = cau_pending_message( $type, $type_plural, $list ); - - foreach ( cau_set_email() as $key => $value) { - foreach ($value as $k => $v) { - wp_mail( $v, $subject, $message ); - } - break; - } - } - - } - - } -} - -// Alerts when plugin has been updated -function cau_plugin_updated() { - - // Check if cau_get_db_value() function exists. - if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' ); - - // Set the correct timezone for emails - date_default_timezone_set( cau_get_proper_timezone() ); - - // Create arrays - $pluginNames = array(); - $pluginDates = array(); - $pluginVersion = array(); - $pluginSlug = array(); - $pluginTimes = array(); - $themeNames = array(); - $themeDates = array(); - $themeTimes = array(); - - // Where to look for plugins - $plugdir = plugin_dir_path( __DIR__ ); - if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Check if get_plugins() function exists. - $allPlugins = get_plugins(); - - // Where to look for themes - $themedir = get_theme_root(); - $allThemes = wp_get_themes(); - - // Mail schedule - $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' ); - - // Loop trough all plugins - foreach ( $allPlugins as $key => $value ) { - - // Get plugin data - $fullPath = $plugdir.'/'.$key; - $getFile = $path_parts = pathinfo( $fullPath ); - $pluginData = get_plugin_data( $fullPath ); - - // Get the slug - $explosion = explode( '/', $key ); - $actualSlug = array_shift( $explosion ); - - // Get last update date - $fileDate = date ( 'YmdHi', filemtime( $fullPath ) ); - - switch ( $schedule_mail ) { - case 'hourly': - $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) ); - break; - case 'twicedaily': - $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) ); - break; - default: - $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) ); - break; - } - - $dateFormat = get_option( 'date_format' ); - $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) ); - $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) ); - - if( $fileDate >= $lastday ) { - - // Get plugin name - foreach ( $pluginData as $dataKey => $dataValue ) { - if( $dataKey == 'Name') { - array_push( $pluginNames , $dataValue ); - } - if( $dataKey == 'Version') { - array_push( $pluginVersion , $dataValue ); - } - } - - array_push( $pluginDates, $fileDate ); - array_push( $pluginSlug, $actualSlug ); - array_push( $pluginTimes, $timestamp ); - } - - } - - // Loop trough all themes - foreach ( $allThemes as $key => $value ) { - - // Get theme data - $fullPath = $themedir.'/'.$key; - $getFile = $path_parts = pathinfo( $fullPath ); - - // Get last update date - $dateFormat = get_option( 'date_format' ); - $fileDate = date ( 'YmdHi', filemtime( $fullPath ) ); - - if( $schedule_mail == 'hourly' ) { - $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) ); - } elseif( $schedule_mail == 'twicedaily' ) { - $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) ); - } elseif( $schedule_mail == 'daily' ) { - $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) ); - } - - $dateFormat = get_option( 'date_format' ); - $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) ); - $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) ); - - if( $fileDate >= $lastday ) { - array_push( $themeNames, $path_parts['filename'] ); - array_push( $themeDates, $fileDate ); - array_push( $themeTimes, $timestamp ); - } - - } - - $totalNumP = 0; - $totalNumT = 0; - $updatedListP = ''; - $updatedListT = ''; - - if( cau_get_db_value( 'html_or_text' ) == 'html' ) { - $updatedListP .= '
".__( "Time of update", "companion-auto-update" ).": ".$themeTimes[$key].""; - $updatedListT .= " '; + else $break = "\n"; + + // Base text + $text = sprintf( esc_html__( 'You have pending %1$s updates on your WordPress site at %2$s.', 'companion-auto-update' ), $single, get_site_url() ); + $text .= $break; + + if( !empty( $list ) ) { + + $text .= $break; + $text .= sprintf( esc_html__( 'The following %1$s have new versions available.', 'companion-auto-update' ), $plural ); + $text .= $break; + + if( cau_is_html() ) $text .= "
'; + else $break = "\n"; + + // The message + $text = sprintf( esc_html__( + 'One or more %1$s on your WordPress site at %2$s have been updated by Companion Auto Update. No further action is needed on your part. +For more info on what is new visit your dashboard and check the changelog.', 'companion-auto-update' + ), $type, get_site_url() ); + + $text .= $break; + $text .= $break; + $text .= sprintf( esc_html__( + 'The following %1$s have been updated:', 'companion-auto-update' + ), $type ); + + $text .= $break; + $text .= $updatedList; + + $text .= $break; + $text .= __( "(You'll also receive this email if you manually updated a plugin or theme)", "companion-auto-update" ); + + return $text; + +} + +// Checks if plugins are out of date +function cau_list_outdated_software() { + + // Check if cau_get_db_value() function exists. + if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' ); + + // Set up mail + $subject = '['.get_bloginfo( 'name' ).'] ' . __( 'You have outdated plugins on your site.', 'companion-auto-update' ); + $type = __( 'plugin', 'companion-auto-update' ); + $type_plural = __( 'plugins', 'companion-auto-update' ); + $message = cau_outdated_message( $type, $type_plural, cau_list_outdated() ); + + // Send to all addresses + foreach ( cau_set_email() as $key => $value ) { + foreach ( $value as $k => $v ) { + wp_mail( $v, $subject, $message ); + } + break; + } + +} + +// Checks if theme updates are available +function cau_list_theme_updates() { + + global $wpdb; + $table_name = $wpdb->prefix . "auto_updates"; + + $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'"); + foreach ( $configs as $config ) { + + if( $config->onoroff != 'on' ) { + + require_once ABSPATH . '/wp-admin/includes/update.php'; + $themes = get_theme_updates(); + $list = array(); + + if ( !empty( $themes ) ) { + + foreach ( $themes as $stylesheet => $theme ) { + array_push( $list, $theme->get( 'Name' ) ); + } + + $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Theme update available.', 'companion-auto-update' ); + $type = __('theme', 'companion-auto-update'); + $type_plural = __('themes', 'companion-auto-update'); + $message = cau_pending_message( $type, $type_plural, $list ); + + foreach ( cau_set_email() as $key => $value) { + foreach ($value as $k => $v) { + wp_mail( $v, $subject, $message ); + } + break; + } + } + + } + + } + +} + +// Checks if plugin updates are available +function cau_list_plugin_updates() { + + global $wpdb; + $table_name = $wpdb->prefix . "auto_updates"; + + $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'"); + foreach ( $configs as $config ) { + + if( $config->onoroff != 'on' ) { + + require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); + + if ( !function_exists( 'get_plugin_updates' ) ) require_once ABSPATH . 'wp-admin/includes/update.php'; + $plugins = get_plugin_updates(); + + if ( !empty( $plugins ) ) { + + $list = array(); + foreach ( (array) $plugins as $plugin_file => $plugin_data ) { + $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); + $name = $plugin_data->Name; + array_push( $list, $name ); + } + + $subject = '[' . get_bloginfo( 'name' ) . '] ' . __( 'Plugin update available.', 'companion-auto-update' ); + $type = __( 'plugin', 'companion-auto-update' ); + $type_plural = __( 'plugins', 'companion-auto-update' ); + $message = cau_pending_message( $type, $type_plural, $list ); + + foreach ( cau_set_email() as $key => $value) { + foreach ($value as $k => $v) { + wp_mail( $v, $subject, $message ); + } + break; + } + } + + } + + } +} + +// Alerts when plugin has been updated +function cau_plugin_updated() { + + // Check if cau_get_db_value() function exists. + if ( !function_exists( 'cau_get_db_value' ) ) require_once( plugin_dir_path( __FILE__ ) . 'cau_function.php' ); + + // Set the correct timezone for emails + date_default_timezone_set( cau_get_proper_timezone() ); + + // Create arrays + $pluginNames = array(); + $pluginDates = array(); + $pluginVersion = array(); + $pluginSlug = array(); + $pluginTimes = array(); + $themeNames = array(); + $themeDates = array(); + $themeTimes = array(); + + // Where to look for plugins + $plugdir = plugin_dir_path( __DIR__ ); + if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Check if get_plugins() function exists. + $allPlugins = get_plugins(); + + // Where to look for themes + $themedir = get_theme_root(); + $allThemes = wp_get_themes(); + + // Mail schedule + $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' ); + + // Loop trough all plugins + foreach ( $allPlugins as $key => $value ) { + + // Get plugin data + $fullPath = $plugdir.'/'.$key; + $getFile = $path_parts = pathinfo( $fullPath ); + $pluginData = get_plugin_data( $fullPath ); + + // Get the slug + $explosion = explode( '/', $key ); + $actualSlug = array_shift( $explosion ); + + // Get last update date + $fileDate = date ( 'YmdHi', filemtime( $fullPath ) ); + + switch ( $schedule_mail ) { + case 'hourly': + $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) ); + break; + case 'twicedaily': + $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) ); + break; + default: + $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) ); + break; + } + + $dateFormat = get_option( 'date_format' ); + $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) ); + $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) ); + + if( $fileDate >= $lastday ) { + + // Get plugin name + foreach ( $pluginData as $dataKey => $dataValue ) { + if( $dataKey == 'Name') { + array_push( $pluginNames , $dataValue ); + } + if( $dataKey == 'Version') { + array_push( $pluginVersion , $dataValue ); + } + } + + array_push( $pluginDates, $fileDate ); + array_push( $pluginSlug, $actualSlug ); + array_push( $pluginTimes, $timestamp ); + } + + } + + // Loop trough all themes + foreach ( $allThemes as $key => $value ) { + + // Get theme data + $fullPath = $themedir.'/'.$key; + $getFile = $path_parts = pathinfo( $fullPath ); + + // Get last update date + $dateFormat = get_option( 'date_format' ); + $fileDate = date ( 'YmdHi', filemtime( $fullPath ) ); + + if( $schedule_mail == 'hourly' ) { + $lastday = date( 'YmdHi', strtotime( '-1 hour', time() ) ); + } elseif( $schedule_mail == 'twicedaily' ) { + $lastday = date( 'YmdHi', strtotime( '-12 hours', time() ) ); + } elseif( $schedule_mail == 'daily' ) { + $lastday = date( 'YmdHi', strtotime( '-1 day', time() ) ); + } + + $dateFormat = get_option( 'date_format' ); + $timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) ); + $timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) ); + + if( $fileDate >= $lastday ) { + array_push( $themeNames, $path_parts['filename'] ); + array_push( $themeDates, $fileDate ); + array_push( $themeTimes, $timestamp ); + } + + } + + $totalNumP = 0; + $totalNumT = 0; + $updatedListP = ''; + $updatedListT = ''; + + if( cau_get_db_value( 'html_or_text' ) == 'html' ) { + $updatedListP .= '
".__( "Time of update", "companion-auto-update" ).": ".$themeTimes[$key].""; + $updatedListT .= " |