1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76:
<?php
class Inbound_Maintenance_Lists {
public static function get_lists() {
global $inbound_memory;
if ($inbound_memory) {
return $inbound_memory;
}
$inbound_memory = Inbound_Options_API::get_option('inbound-pro', 'memory', array());
$update = false;
$inbound_memory['maintenance_lists'] = (isset($inbound_memory['maintenance_lists'])) ? $inbound_memory['maintenance_lists'] : array();
$inbound_memory['maintenance_lists']['parent'] = (isset($inbound_memory['maintenance_lists']['parent'])) ? $inbound_memory['maintenance_lists']['parent'] : '';
$inbound_memory['maintenance_lists']['rejected'] = (isset($inbound_memory['maintenance_lists']['rejected'])) ? $inbound_memory['maintenance_lists']['rejected'] : '';
$inbound_memory['maintenance_lists']['spam'] = (isset($inbound_memory['maintenance_lists']['spam'])) ? $inbound_memory['maintenance_lists']['spam'] : '';
$inbound_memory['maintenance_lists']['bounces'] = (isset($inbound_memory['maintenance_lists']['bounces'])) ? $inbound_memory['maintenance_lists']['bounces'] : '';
if (!$inbound_memory['maintenance_lists']['parent']) {
$inbound_memory['maintenance_lists']['parent'] = Inbound_Leads::create_lead_list( array(
'name' => __( 'Maintenance' , 'inbound-pro' )
));
$update = true;
}
if (!$inbound_memory['maintenance_lists']['rejected']) {
$inbound_memory['maintenance_lists']['rejected'] = Inbound_Leads::create_lead_list( array(
'name' => __( 'Rejected' , 'inbound-pro' ),
'parent' => $inbound_memory['maintenance_lists']['parent']
));
$update = true;
}
if (!$inbound_memory['maintenance_lists']['spam']) {
$inbound_memory['maintenance_lists']['spam'] = Inbound_Leads::create_lead_list( array(
'name' => __( 'Spam Complaints' , 'inbound-pro' ),
'parent' => $inbound_memory['maintenance_lists']['parent']
));
$update = true;
}
if (!$inbound_memory['maintenance_lists']['bounces']) {
$inbound_memory['maintenance_lists']['bounces'] = Inbound_Leads::create_lead_list( array(
'name' => __( 'Bounces' , 'inbound-pro' ),
'parent' => $inbound_memory['maintenance_lists']['parent']
));
$update = true;
}
if ($update) {
Inbound_Options_API::update_option('inbound-pro', 'memory', $inbound_memory);
}
return $inbound_memory['maintenance_lists'];
}
}