| @@ -41,14 +41,12 @@ | ||
| 41 | 41 | * |
| 42 | 42 | */ |
| 43 | 43 | public static function remove( $property = 'uploaded', $source_type = 'media_library' ){ |
| 44 | 44 | $settings_key = Schema::getConstant('COUNTER_KEY'); |
| 45 | - $data = Utils::maybe_unserialize( Utils::get_option_meta( $settings_key, true, true ) ) ?: []; | |
| 45 | + $data = Utils::get_option( $source_type, [], $settings_key ); | |
| 46 | + $data[$property] = isset($data[$property]) ? (int)$data[$property] - 1 : -1; | |
| 46 | 47 | |
| 47 | - $source_type_data = isset($data[$source_type]) ? $data[$source_type] : []; | |
| 48 | - $source_type_data[$property] = isset($source_type_data[$property]) ? (int)$source_type_data[$property] - 1 : -1; | |
| 49 | - | |
| 50 | - return Utils::update_option( $source_type, $source_type_data, $settings_key ); | |
| 48 | + return Utils::update_option( $source_type, $data, $settings_key ); | |
| 51 | 49 | } |
| 52 | 50 | |
| 53 | 51 | /** |
| 54 | 52 | * Get Count |