1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

Improve PayPal Subscription

This commit is contained in:
Daniel 2021-07-29 14:25:36 -03:00
parent 97fc15c0c2
commit b5821d1674
5 changed files with 30 additions and 4 deletions

View file

@ -53,6 +53,7 @@ $count = $obj->getViews_count();
$obj2 = new stdClass();
$obj2->status = !empty($resp);
$obj2->count = $count;
$obj2->countHTML = number_format_short($count);
$obj2->resp = $resp;
echo json_encode($obj2);

View file

@ -406,7 +406,7 @@ class PayPalYPT extends PluginAbstract {
// Create a new billing plan
$plan = new Plan();
$plan->setName(substr(cleanString($name), 0, 126))
->setDescription(substr(cleanString($name), 0, 126))
->setDescription(substr(json_encode(User::getId()), 0, 126))
->setType('INFINITE');
$paymentDefinitionArray = array();
@ -504,6 +504,31 @@ class PayPalYPT extends PluginAbstract {
}
return false;
}
static function listPlans() {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
try {
// Execute agreement
_error_log("PayPal listPlans Try to execute ");
$params = array('page_size' => 20);
$planList = Plan::all($params, $apiContext);
$p = $planList->getPlans();
foreach ($p as $value) {
echo $value->getId()."<br>";
echo $value->getName()."<br>";
echo $value->getDescription()."<br>";
$plan = Plan::get($value->getId(), $apiContext);
var_dump($plan);
}
return $planList;
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("PayPal Error listPlans: " . $ex->getData());
} catch (Exception $ex) {
_error_log("PayPal Error listPlans: " . $ex);
}
return false;
}
static function getBillingAgreement($agreement_id) {
global $global;

View file

@ -443,7 +443,7 @@ function _addView(videos_id, currentTime) {
'currentTime': currentTime
},
success: function (response) {
$('.view-count' + videos_id).text(response.count);
$('.view-count' + videos_id).text(response.countHTML);
}
});
}

View file

@ -94,7 +94,7 @@ if (User::hasBlockedUser($video['users_id'])) {
<?php
if (Video::showYoutubeModeOptions() && empty($advancedCustom->doNotDisplayViews)) {
?>
<span class="watch-view-count pull-right text-muted" itemprop="interactionCount"><span class="view-count<?php echo $video['id']; ?>"><?php echo number_format($video['views_count'], 0); ?></span> <?php echo __("Views"); ?></span>
<span class="watch-view-count pull-right text-muted" itemprop="interactionCount"><span class="view-count<?php echo $video['id']; ?>"><?php echo number_format_short($video['views_count']); ?></span> <?php echo __("Views"); ?></span>
<?php
}
?>

View file

@ -111,7 +111,7 @@ $metaDescription = __("Trending");
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
<?php echo number_format_short($value['views_count']); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php } ?>