| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @package Logtivity |
| 5 |
* @contact logtivity.io, [email protected] |
| 6 |
* @copyright 2024-2026 Logtivity. All rights reserved |
| 7 |
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL |
| 8 |
* |
| 9 |
* This file is part of Logtivity. |
| 10 |
* |
| 11 |
* Logtivity is free software: you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License as published by |
| 13 |
* the Free Software Foundation, either version 2 of the License, or |
| 14 |
* (at your option) any later version. |
| 15 |
* |
| 16 |
* Logtivity is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with Logtivity. If not, see <https://www.gnu.org/licenses/>. |
| 23 |
*/ |
| 24 |
|
| 25 |
abstract class Logtivity_Abstract_Easy_Digital_Downloads |
| 26 |
{ |
| 27 |
public function getDownloadTitle($licenseOrSubscriptionOrDownloadId, $price_id = null) |
| 28 |
{ |
| 29 |
$priceOptionName = false; |
| 30 |
|
| 31 |
if ($licenseOrSubscriptionOrDownloadId instanceof EDD_Subscription) { |
| 32 |
$download_id = $licenseOrSubscriptionOrDownloadId->product_id; |
| 33 |
$price_id = $licenseOrSubscriptionOrDownloadId->price_id; |
| 34 |
} elseif($licenseOrSubscriptionOrDownloadId instanceof EDD_SL_License) { |
| 35 |
$download_id = $licenseOrSubscriptionOrDownloadId->download_id; |
| 36 |
$price_id = $licenseOrSubscriptionOrDownloadId->price_id; |
| 37 |
} else { |
| 38 |
$download_id = $licenseOrSubscriptionOrDownloadId; |
| 39 |
} |
| 40 |
|
| 41 |
$prices = edd_get_variable_prices($download_id); |
| 42 |
|
| 43 |
if ($prices && count($prices) && $price_id) { |
| 44 |
if (isset($prices[$price_id])) { |
| 45 |
$priceOptionName = $prices[$price_id]['name']; |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
return logtivity_get_the_title($download_id) . ( $priceOptionName ? ' - ' .$priceOptionName : ''); |
| 50 |
} |
| 51 |
} |
| 52 |
|