PluginProbe ʕ •ᴥ•ʔ
Check & Log Email – Easy Email Testing & Mail logging / 2.0
Check & Log Email – Easy Email Testing & Mail logging v2.0
1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 2.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.13.2 2.0.14 2.0.2 2.0.3 2.0.4 2.0.5 2.0.5.1 2.0.6 2.0.7 2.0.8 2.0.9 trunk 0.5.7 0.6.0 0.6.1 0.6.2 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.12.1 1.0.13 1.0.13.1 1.0.2 1.0.3
check-email / include / Core / Request / Check_Email_Override_PluginAPI.php
check-email / include / Core / Request Last commit date
Check_Email_Log_List_Action.php 1 year ago Check_Email_Nonce_Checker.php 1 year ago Check_Email_Override_PluginAPI.php 1 year ago
Check_Email_Override_PluginAPI.php
71 lines
1 <?php namespace CheckEmail\Core\Request;
2
3 use CheckEmail\Addon\API\EDDUpdater;
4 use CheckEmail\Core\Loadie;
5
6 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
7
8 /**
9 * Override WordPress Plugin API.
10 * This is already done by EDD_SL_Plugin_Updater for Active add-on
11 * and this class does it for all in active or yet to be installed add-ons.
12 */
13 class Check_Email_Override_PluginAPI implements Loadie {
14
15 public function load() {
16 add_action( 'admin_init', array( $this, 'setup_updaters_for_inactive_addons' ) );
17
18 add_filter( 'plugins_api_result', array( $this, 'add_version_to_plugin_api_response' ), 100, 3 );
19 }
20
21 public function setup_updaters_for_inactive_addons() {
22 $check_email = wpchill_check_email();
23 $licenser = $check_email->get_licenser();
24
25 if ( is_null( $licenser ) ) {
26 return;
27 }
28
29 $inactive_addons = $licenser->get_addon_list()->get_inactive_addons();
30
31 foreach ( $inactive_addons as $inactive_addon ) {
32 $license_key = $licenser->get_addon_license_key( $inactive_addon->name );
33
34 $updater = new EDDUpdater(
35 $check_email->get_store_url(),
36 $inactive_addon->file,
37 array(
38 'version' => $inactive_addon->get_version(),
39 'license' => $license_key,
40 'item_name' => $inactive_addon->name,
41 'author' => $inactive_addon->author,
42 )
43 );
44
45 $licenser->add_updater( $updater );
46 }
47 }
48
49 public function add_version_to_plugin_api_response( $response, $action, $args ) {
50 if ( 'plugin_information' !== $action ) {
51 return $response;
52 }
53
54 if ( ! isset( $args->slug ) || ( substr( $args->slug, 0, 10 ) != 'check-email-log-' ) ) {
55 return $response;
56 }
57
58 if ( isset( $response->version ) ) {
59 return $response;
60 }
61
62 if ( ! isset( $response->new_version ) ) {
63 return $response;
64 }
65
66 $response->version = $response->new_version;
67
68 return $response;
69 }
70 }
71