diff --git a/install/database.sql b/install/database.sql
index 62da438c33..5b1ae619cc 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -74,9 +74,11 @@ CREATE TABLE IF NOT EXISTS `categories` (
`users_id` INT(11) NOT NULL DEFAULT 1,
`private` TINYINT(1) NULL DEFAULT 0,
`allow_download` TINYINT(1) NULL DEFAULT 1,
+ `order` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_categories_users1_idx` (`users_id` ASC),
INDEX `clean_name_INDEX2` (`clean_name` ASC),
+ INDEX `sortcategoryOrderIndex` (`order` ASC),
UNIQUE INDEX `clean_name_UNIQUE` (`clean_name` ASC),
CONSTRAINT `fk_categories_users1`
FOREIGN KEY (`users_id`)
diff --git a/objects/ajaxErrorCatcher.php b/objects/ajaxErrorCatcher.php
index e1071b061a..ffbcf6c601 100644
--- a/objects/ajaxErrorCatcher.php
+++ b/objects/ajaxErrorCatcher.php
@@ -1,7 +1,7 @@
diff --git a/objects/bootGrid.php b/objects/bootGrid.php
index e15a36cc4f..7e19d82fe2 100644
--- a/objects/bootGrid.php
+++ b/objects/bootGrid.php
@@ -22,6 +22,9 @@ class BootGrid {
$direction = "DESC";
}
$key = preg_replace("/[^A-Za-z0-9._ ]/", '', $key);
+ if($key=='order'){
+ $key = '`order`';
+ }
$orderBy[] = " {$keyPrefix}{$key} {$direction} ";
}
$sql .= " ORDER BY ".implode(",", $orderBy);
diff --git a/objects/category.php b/objects/category.php
index 9eaf515073..18b1ef8ed9 100644
--- a/objects/category.php
+++ b/objects/category.php
@@ -22,7 +22,16 @@ class Category {
private $users_id;
private $private;
private $allow_download;
+ private $order;
+ function getOrder() {
+ return intval($this->order);
+ }
+
+ function setOrder($order) {
+ $this->order = intval($order);
+ }
+
function getUsers_id() {
if (empty($this->users_id)) {
$this->users_id == User::getId();
@@ -158,9 +167,9 @@ class Category {
. "parentId = ?,"
. "iconClass = ?,"
. "users_id = ?,"
- . "`private` = ?, allow_download = ?, modified = now() WHERE id = ?";
- $format = "sssiisiiii";
- $values = array(xss_esc($this->name), xss_esc($this->clean_name), xss_esc($this->description), $this->nextVideoOrder, $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getPrivate(), $this->getAllow_download(), $this->id);
+ . "`private` = ?, allow_download = ?, `order` = ?, modified = now() WHERE id = ?";
+ $format = "sssiisiiiii";
+ $values = array(xss_esc($this->name), xss_esc($this->clean_name), xss_esc($this->description), $this->nextVideoOrder, $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getPrivate(), $this->getAllow_download(), $this->getOrder(), $this->id);
} else {
$sql = "INSERT INTO categories ( "
. "name,"
@@ -170,9 +179,9 @@ class Category {
. "parentId,"
. "iconClass, "
. "users_id, "
- . "`private`, allow_download, created, modified) VALUES (?, ?,?,?,?,?,?,?,?,now(), now())";
- $format = "sssiisiii";
- $values = array(xss_esc($this->name), xss_esc($this->clean_name), xss_esc($this->description), $this->nextVideoOrder, $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getPrivate(), $this->getAllow_download());
+ . "`private`, allow_download, `order`, created, modified) VALUES (?, ?,?,?,?,?,?,?,?,?,now(), now())";
+ $format = "sssiisiiii";
+ $values = array(xss_esc($this->name), xss_esc($this->clean_name), xss_esc($this->description), $this->nextVideoOrder, $this->parentId, $this->getIconClass(), $this->getUsers_id(), $this->getPrivate(), $this->getAllow_download(), $this->getOrder());
}
$insert_row = sqlDAL::writeSql($sql, $format, $values);
@@ -325,7 +334,7 @@ class Category {
static function getAllCategories($filterCanAddVideoOnly = false) {
global $global, $config;
- if ($config->currentVersionLowerThen('5.01')) {
+ if ($config->currentVersionLowerThen('8.4')) {
return false;
}
$sql = "SELECT * FROM categories WHERE 1=1 ";
@@ -346,7 +355,7 @@ class Category {
if (isset($_POST['sort']['title'])) {
unset($_POST['sort']['title']);
}
- $sql .= BootGrid::getSqlFromPost(array('name'), "", " ORDER BY name ASC ");
+ $sql .= BootGrid::getSqlFromPost(array('name'), "", " ORDER BY `order`, name ASC ");
$res = sqlDAL::readSql($sql);
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
@@ -455,7 +464,7 @@ class Category {
static function getChildCategories($parentId, $filterCanAddVideoOnly = false) {
global $global, $config;
- if ($config->currentVersionLowerThen('5.01')) {
+ if ($config->currentVersionLowerThen('8.4')) {
return false;
}
$sql = "SELECT * FROM categories WHERE parentId=? AND id!=? ";
@@ -470,7 +479,7 @@ class Category {
$sql .= " AND (private=0 OR users_id = '{$users_id}') ";
}
}
- $sql .= BootGrid::getSqlFromPost(array('name'), "", " ORDER BY name ASC ");
+ $sql .= BootGrid::getSqlFromPost(array('name'), "", " ORDER BY `order`, name ASC ");
$res = sqlDAL::readSql($sql, "ii", array($parentId, $parentId));
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
diff --git a/objects/categoryAddNew.json.php b/objects/categoryAddNew.json.php
index dac1cb8108..b757b83ac0 100644
--- a/objects/categoryAddNew.json.php
+++ b/objects/categoryAddNew.json.php
@@ -20,6 +20,7 @@ $obj->setNextVideoOrder($_POST['nextVideoOrder']);
$obj->setParentId($_POST['parentId']);
$obj->setPrivate($_POST['private']);
$obj->setAllow_download($_POST['allow_download']);
+$obj->setOrder($_POST['order']);
diff --git a/objects/include_config.php b/objects/include_config.php
index 5e929a4991..0e2d76a00a 100644
--- a/objects/include_config.php
+++ b/objects/include_config.php
@@ -2,7 +2,7 @@
$global['webSiteRootURL'] .= (substr($global['webSiteRootURL'], -1) == '/' ? '' : '/');
$global['systemRootPath'] .= (substr($global['systemRootPath'], -1) == '/' ? '' : '/');
-
+session_name(preg_replace( '/[\W]/', '', $global['webSiteRootURL']));
ini_set('error_log', $global['systemRootPath'] . 'videos/avideo.log');
global $global, $config, $advancedCustom, $advancedCustomUser;
diff --git a/objects/video.php b/objects/video.php
index 5908808498..fc5f02cf86 100644
--- a/objects/video.php
+++ b/objects/video.php
@@ -154,16 +154,15 @@ if (!class_exists('Video')) {
function setSites_id($sites_id) {
$this->sites_id = $sites_id;
}
-
+
function getVideo_password() {
- return $this->video_password;
+ return trim($this->video_password);
}
function setVideo_password($video_password) {
- $this->video_password = $video_password;
+ $this->video_password = trim($video_password);
}
-
function save($updateVideoGroups = false, $allowOfflineUser = false) {
global $advancedCustom;
global $global;
@@ -525,7 +524,7 @@ if (!class_exists('Video')) {
}
function setType($type) {
- if(empty($this->type)){
+ if (empty($this->type)) {
$this->type = $type;
}
}
@@ -754,7 +753,7 @@ if (!class_exists('Video')) {
return false;
}
$parts = explode("/", $fileName);
- if(!empty($parts[0])){
+ if (!empty($parts[0])) {
$fileName = $parts[0];
}
$sql = "SELECT id FROM videos WHERE filename = ? LIMIT 1";
@@ -954,10 +953,10 @@ if (!class_exists('Video')) {
foreach ($fullData as $row) {
unset($row['password']);
unset($row['recoverPass']);
- if(!self::canEdit($row['id'])){
- if(!empty($row['video_password'])){
+ if (!self::canEdit($row['id'])) {
+ if (!empty($row['video_password'])) {
$row['video_password'] = 1;
- }else{
+ } else {
$row['video_password'] = 0;
}
}
@@ -995,7 +994,7 @@ if (!class_exists('Video')) {
$get = json_encode(@$_GET);
$post = json_encode(@$_POST);
$md5 = md5("{$users_id}{$get}{$post}{$status}{$showOnlyLoggedUserVideos}{$ignoreGroup}" . implode("_", $videosArrayId) . "{$getStatistcs}{$showUnlisted}{$activeUsersOnly}");
- $path = getCacheDir()."getAllVideosAsync/";
+ $path = getCacheDir() . "getAllVideosAsync/";
make_path($path);
$cacheFileName = "{$path}{$md5}";
if (empty($advancedCustom->AsyncJobs) || !file_exists($cacheFileName) || filesize($cacheFileName) === 0) {
@@ -1173,7 +1172,7 @@ if (!class_exists('Video')) {
static function getTotalVideosInfoAsync($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false) {
global $global, $advancedCustom;
- $path = getCacheDir()."getTotalVideosInfo/";
+ $path = getCacheDir() . "getTotalVideosInfo/";
make_path($path);
$cacheFileName = "{$path}_{$status}_{$showOnlyLoggedUserVideos}_{$ignoreGroup}_" . implode($videosArrayId) . "_{$getStatistcs}";
$return = array();
@@ -1688,8 +1687,8 @@ if (!class_exists('Video')) {
} else {
$tags = self::getTagsAsync($video_id, $type);
foreach ($tags as $key => $value) {
- if(is_array($value)){
- $tags[$key] = (object)$value;
+ if (is_array($value)) {
+ $tags[$key] = (object) $value;
}
}
return $tags;
@@ -1697,7 +1696,7 @@ if (!class_exists('Video')) {
}
static function getTags_($video_id, $type = "") {
- global $advancedCustom;
+ global $advancedCustom, $advancedCustomUser;
$video = new Video("", "", $video_id);
$tags = array();
@@ -1705,7 +1704,16 @@ if (!class_exists('Video')) {
if (!empty($advancedCustom->paidOnlyShowLabels)) {
$objTag = new stdClass();
$objTag->label = __("Paid Content");
- if (!empty($video->getOnly_for_paid())) {
+ if ($advancedCustomUser->userCanProtectVideosWithPassword && !empty($video->getVideo_password())) {
+ $objTag->type = "danger";
+ $objTag->text = '';
+ } else if (AVideoPlugin::isEnabledByName("PayPerView") && PayPerView::isVideoPayPerView($video_id)) {
+ $objTag->type = "warning";
+ $objTag->text = "PPV";
+ } else if (!Video::isPublic($video_id)) {
+ $objTag->type = "warning";
+ $objTag->text = __("Private");
+ } else if (!empty($video->getOnly_for_paid())) {
$objTag->type = "warning";
$objTag->text = $advancedCustom->paidOnlyLabel;
} else {
@@ -1804,7 +1812,7 @@ if (!class_exists('Video')) {
foreach ($groups as $value) {
$objTag = new stdClass();
$objTag->label = __("Group");
- $objTag->type = "warning";
+ $objTag->type = "info";
$objTag->text = "{$value['group_name']}";
$tags[] = $objTag;
$objTag = new stdClass();
@@ -1860,7 +1868,7 @@ if (!class_exists('Video')) {
session_start();
}
unset($_SESSION['getVideoTags'][$video_id]);
- $path = getCacheDir()."getTagsAsync/";
+ $path = getCacheDir() . "getTagsAsync/";
if (!is_dir($path)) {
return false;
}
@@ -1875,7 +1883,7 @@ if (!class_exists('Video')) {
static function getTagsAsync($video_id, $type = "video") {
global $global, $advancedCustom;
- $path = getCacheDir()."getTagsAsync/";
+ $path = getCacheDir() . "getTagsAsync/";
make_path($path);
$cacheFileName = "{$path}_{$video_id}_{$type}";
@@ -2029,7 +2037,7 @@ if (!class_exists('Video')) {
function getTitle() {
return $this->title;
}
-
+
function getClean_title() {
return $this->clean_title;
}
@@ -2367,8 +2375,8 @@ if (!class_exists('Video')) {
}
static function getImageFromFilename_($filename, $type = "video") {
- $cache = ObjectYPT::getCache($filename.$type, 0);
- if(!empty($cache)){
+ $cache = ObjectYPT::getCache($filename . $type, 0);
+ if (!empty($cache)) {
return $cache;
}
global $global, $advancedCustom;
@@ -2490,16 +2498,16 @@ if (!class_exists('Video')) {
if (!empty($advancedCustom->disableAnimatedGif)) {
$obj->thumbsGif = false;
}
-
- ObjectYPT::setCache($filename.$type, $obj);
-
+
+ ObjectYPT::setCache($filename . $type, $obj);
+
return $obj;
}
static function getImageFromFilenameAsync($filename, $type = "video") {
global $global, $advancedCustom;
$return = array();
- $path = getCacheDir()."getImageFromFilenameAsync/";
+ $path = getCacheDir() . "getImageFromFilenameAsync/";
make_path($path);
$cacheFileName = "{$path}_{$filename}_{$type}";
if (empty($advancedCustom->AsyncJobs) || !file_exists($cacheFileName)) {
@@ -2569,14 +2577,14 @@ if (!class_exists('Video')) {
return false;
}
- function getChannelName(){
+ function getChannelName() {
return User::_getChannelName($this->getUsers_id());
}
-
- function getChannelLink(){
+
+ function getChannelLink() {
return User::getChannelLink($this->getUsers_id());
}
-
+
/**
*
* @global type $global
@@ -2587,16 +2595,16 @@ if (!class_exists('Video')) {
* @return String a web link
*/
static function getLinkToVideo($videos_id, $clean_title = "", $embed = false, $type = "URLFriendly", $get = array()) {
- global $global, $advancedCustomUser;
+ global $global, $advancedCustomUser;
if (empty($videos_id) && !empty($clean_title)) {
$videos_id = self::get_id_from_clean_title($clean_title);
}
$video = new Video("", "", $videos_id);
-
- if($advancedCustomUser->addChannelNameOnLinks){
+
+ if ($advancedCustomUser->addChannelNameOnLinks) {
$get['channelName'] = $video->getChannelName();
}
-
+
unset($get['v']);
unset($get['videoName']);
unset($get['videoName']);
@@ -2608,7 +2616,7 @@ if (!class_exists('Video')) {
} else {
$get_http = "?{$get_http}";
}
-
+
if ($type == "URLFriendly") {
$cat = "";
if (!empty($_GET['catName'])) {
@@ -2618,7 +2626,7 @@ if (!class_exists('Video')) {
if (empty($clean_title)) {
$clean_title = $video->getClean_title();
}
-
+
if ($embed) {
//return "{$global['webSiteRootURL']}videoEmbed/{$clean_title}{$get_http}";
return "{$global['webSiteRootURL']}videoEmbed/{$videos_id}/{$clean_title}{$get_http}";
@@ -2732,9 +2740,9 @@ if (!class_exists('Video')) {
}
}
ObjectYPT::deleteCache($filename);
- ObjectYPT::deleteCache($filename."article");
- ObjectYPT::deleteCache($filename."pdf");
- ObjectYPT::deleteCache($filename."video");
+ ObjectYPT::deleteCache($filename . "article");
+ ObjectYPT::deleteCache($filename . "pdf");
+ ObjectYPT::deleteCache($filename . "video");
clearVideosURL($filename);
}
@@ -2848,11 +2856,11 @@ if (!class_exists('Video')) {
if (empty($rows)) {
return true;
}
-
+
if (empty($users_id) || empty($videos_id)) {
return false;
}
-
+
$rowsUser = UserGroups::getUserGroups(User::getId());
if (empty($rowsUser)) {
return false;
@@ -2889,7 +2897,7 @@ if (!class_exists('Video')) {
function setSerie_playlists_id($serie_playlists_id) {
$this->serie_playlists_id = $serie_playlists_id;
}
-
+
static function getVideoFromSeriePlayListsId($serie_playlists_id) {
global $global, $config;
$serie_playlists_id = intval($serie_playlists_id);
diff --git a/plugin/CustomizeAdvanced/CustomizeAdvanced.php b/plugin/CustomizeAdvanced/CustomizeAdvanced.php
index 536576607d..493d28cdeb 100644
--- a/plugin/CustomizeAdvanced/CustomizeAdvanced.php
+++ b/plugin/CustomizeAdvanced/CustomizeAdvanced.php
@@ -192,11 +192,24 @@ class CustomizeAdvanced extends PluginAbstract {
}
public function getHTMLMenuLeft() {
+ global $global;
$obj = $this->getDataObject();
if($obj->filterRRating){
-
+ include $global['systemRootPath'] . 'plugin/CustomizeAdvanced/menuLeft.php';
}
- parent::getHTMLMenuLeft();
+ }
+
+ public static function getVideoWhereClause() {
+ $sql = "";
+ $obj = AVideoPlugin::getObjectData("CustomizeAdvanced");
+ if($obj->filterRRating && isset($_GET['rrating'])){
+ if($_GET['rrating']==="0"){
+ $sql .= " AND v.rrating = ''";
+ }else if(in_array($_GET['rrating'],Video::$rratingOptions)){
+ $sql .= " AND v.rrating = '{$_GET['rrating']}'";
+ }
+ }
+ return $sql;
}
diff --git a/plugin/CustomizeAdvanced/menuLeft.php b/plugin/CustomizeAdvanced/menuLeft.php
new file mode 100644
index 0000000000..14c2cb7a52
--- /dev/null
+++ b/plugin/CustomizeAdvanced/menuLeft.php
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugin/CustomizeUser/CustomizeUser.php b/plugin/CustomizeUser/CustomizeUser.php
index 80bb5dad0e..d2107344a8 100644
--- a/plugin/CustomizeUser/CustomizeUser.php
+++ b/plugin/CustomizeUser/CustomizeUser.php
@@ -337,23 +337,4 @@ class CustomizeUser extends PluginAbstract {
}
}
- public static function getVideoTags($videos_id) {
- $obj = AVideoPlugin::getObjectData('CustomizeUser');
- if(!$obj->userCanProtectVideosWithPassword){
- return array();
- }
-
- $video = new Video("", "", $videos_id);
- $videoPassword = $video->getVideo_password();
- if (!empty($videoPassword)) {
- $obj = new stdClass();
- $obj->label = __("Plugin");
- $obj->type = "danger";
- $obj->text = '';
- return array($obj);
- }
-
- return array();
- }
-
}
diff --git a/plugin/RazorPayYPT/RazorPayYPT.php b/plugin/RazorPayYPT/RazorPayYPT.php
index f14da97491..f6fabec886 100644
--- a/plugin/RazorPayYPT/RazorPayYPT.php
+++ b/plugin/RazorPayYPT/RazorPayYPT.php
@@ -3,16 +3,22 @@
global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
+require_once ($global['systemRootPath'] . 'plugin/RazorPayYPT/razorpay-php/Razorpay.php');
+use Razorpay\Api\Api;
class RazorPayYPT extends PluginAbstract {
public function getDescription() {
- $str = "Razorpay module for several purposes
- Go to Razorpay dashboard Site here (you must have Razorpay account, of course)
";
- $str .= "Before you can verify signatures, you need to retrieve your endpoint’s secret from your Dashboard’s"
- . "
Webhooks settings."
- . "
Select an endpoint that you want to obtain the secret for, then select the Click to reveal button."
- . "
The SigningSecret will be available after your first purchase attempt, Webhook will be created automatically.";
+ global $global;
+ $str = "Go to Razorpay dashboard Site here (you must have Razorpay account, of course)
";
+ $str .= "For Subscriptions, you MUST setup this URL ({$global['webSiteRootURL']}plugin/RazorPayYPT/ipn.php) as your webhook from your Dashboard
+ Check more details here here
";
+
+ $p = AVideoPlugin::loadPlugin("Subscription");
+ if(version_compare($p->getPluginVersion(), "3.6")==-1){
+ $str .= "
The Subscription with RazorPay Requires Subscription plugin version 3.6 or greater.";
+ }
+
return $str;
}
@@ -29,9 +35,11 @@ class RazorPayYPT extends PluginAbstract {
}
public function getEmptyDataObject() {
+ global $global;
$obj = new stdClass();
$obj->api_key = "rzp_test_VJCqZwCeMt4CMP";
$obj->api_secret = "DVNniPwmDzRiYniMzJZKpqCf";
+ $obj->webhookSecret = md5($global['systemRootPath'].$global['salt']);
//Before you can verify signatures, you need to retrieve your endpoint’s secret from your Dashboard’s Webhooks settings. Select an endpoint that you want to obtain the secret for, then select the Click to reveal button.
//$obj->SigningSecret = "whsec_54gqoVeSuoeXEiNPcFhMN0jkBZY0JJG3";
//$obj->disableSandbox = false;
@@ -44,291 +52,100 @@ class RazorPayYPT extends PluginAbstract {
return new Api($obj->api_key, $obj->api_secret);
}
- public function setUpPayment($total = '1.00', $currency = "USD", $description = "") {
- global $global;
+ private function getOrCreatePlanId($plans_id) {
+ $plan = new SubscriptionPlansTable($plans_id);
+ $obj = AVideoPlugin::getObjectData('YPTWallet');
$api = $this->start();
- $total = number_format(floatval($total), 2, "", "");
- _error_log("RazorpayYPT::setUpPayment $total , $currency, $description");
- if (!empty($_POST['razorpayToken'])) {
- $token = $_POST['razorpayToken'];
- try {
- $charge = \Razorpay\Charge::create([
- 'amount' => $total,
- 'currency' => $currency,
- 'description' => $description,
- 'source' => $token,
- ]);
- _error_log("RazorpayYPT::setUpPayment charge ". json_encode($charge));
- return $charge;
- } catch (Exception $exc) {
- _error_log("RazorpayYPT::setUpPayment error ");
- _error_log($exc->getTraceAsString());
- }
- }else{
- _error_log("RazorpayYPT::setUpPayment stipeToken empty");
- }
- return false;
- }
-
- static function getAmountFromPayment($payment) {
- if (!is_object($payment)) {
- return false;
- }
- if (empty($payment->amount)) {
- return 0;
- }
- return self::addDot($payment->amount);
- }
-
- static function addDot($value) {
- $val = substr($value, 0, -2);
- $cents = substr($value, -2);
- return floatval("$val.$cents");
- }
-
- static function removeDot($value) {
- $value = floatval($value);
- return number_format($value, 2, "", "");
- }
-
- static function getCurrencyFromPayment($payment) {
- if (!is_object($payment)) {
- return false;
- }
- return $payment->currency;
- }
-
- static function isPaymentOk($payment, $value, $currency) {
- _error_log("isPaymentOk: ". json_encode($payment));
- _error_log("isPaymentOk: $value, $currency");
- if (!is_object($payment)) {
- _error_log("isPaymentOk: NOT object");
- return false;
- }
-
- if (empty($payment->paid)) {
- _error_log("isPaymentOk: NOT paid");
- return false;
- }
-
- if (strcasecmp($currency, self::getCurrencyFromPayment($payment)) !== 0) {
- _error_log("isPaymentOk: NOT same currency");
- return false;
- }
-
- if ($value > self::getAmountFromPayment($payment)) {
- _error_log("isPaymentOk: NOT same amount");
- return false;
- }
- return true;
- }
-
- public function createCostumer($users_id, $razorpayToken) {
- global $global;
-
- $user = new User($users_id);
-
- if (!empty($user)) {
- try {
- $this->start();
- return \Razorpay\Customer::create([
- "description" => "Customer [$users_id] " . $user->getNameIdentification() . "(" . $user->getEmail() . ")",
- "source" => $razorpayToken // obtained with Razorpay.js
- ]);
- } catch (Exception $exc) {
- _error_log($exc->getTraceAsString());
- }
- }
- return false;
- }
-
- public function getCostumerId($users_id, $razorpayToken) {
-
- $costumer = $this->createCostumer($users_id, $razorpayToken);
-
- if (!empty($costumer)) {
- if (self::isCostumerValid($costumer->id)) {
- return $costumer->id;
- } else {
- return false;
- }
- }
-
- return false;
- }
-
- public static function isCostumerValid($id) {
- if ($id == 'canceled') {
- return false;
- }
- _error_log("RazorpayYPT::isCostumerValid $id");
try {
- $c = \Razorpay\Customer::retrieve($id);
- if ($c) {
- _error_log("RazorpayYPT::isCostumerValid IS VALID: " . json_encode($c));
- return true;
- } else {
- _error_log("RazorpayYPT::isCostumerValid NOT FOUND");
- return false;
- }
+ $plans = $api->plan->all();
} catch (Exception $exc) {
- _error_log("RazorpayYPT::isCostumerValid ERROR");
- return false;
+ _error_log($exc->getTraceAsString());
+ die("Looks like you didn't opt for Subscriptions in our dashboard. To enable subscriptions, please go to Dashboard > Subscriptions and click on Get Started button and try again.");
}
- }
- private function createBillingPlan($total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = 'Base Agreement') {
- global $global;
- $this->start();
- return \Razorpay\Plan::create([
- 'currency' => $currency,
- 'interval' => $frequency,
- 'interval_count' => $interval,
- "product" => [
- "name" => $name,
- "type" => "service"
- ],
- 'nickname' => $name,
- 'amount' => self::removeDot($total),
- ]);
- }
-
- function updateBillingPlan($plans_id, $total = '1.00', $currency = "USD", $interval = 1, $name = 'Base Agreement') {
- global $global;
- if (empty($plan_id)) {
- return false;
- }
- $this->start();
- return \Razorpay\Plan::update($plans_id, [
- 'currency' => $currency,
- 'interval_count' => $interval,
- "product" => [
- "name" => $name
- ],
- 'nickname' => $name,
- 'amount' => self::removeDot($total),
- ]);
- }
-
- static function getSubscriptions($razorpay_costumer_id, $plans_id) {
- if (!User::isLogged()) {
- _error_log("getSubscription: User not logged");
- return false;
- }
- if (empty($razorpay_costumer_id)) {
- _error_log("costumer ID is empty");
- return false;
- }
- global $global;
- $users_id = User::getId();
- $obj = AVideoPlugin::getObjectData('RazorpayYPT');
- \Razorpay\Razorpay::setApiKey($obj->Restrictedkey);
- $costumer = \Razorpay\Customer::retrieve($razorpay_costumer_id);
- foreach ($costumer->subscriptions->data as $value) {
- $subscription = \Razorpay\Subscription::retrieve($value->id);
- if ($subscription->metadata->users_id == $users_id && $subscription->metadata->plans_id == $plans_id) {
- _error_log("RazorpayYPT::getSubscriptions $razorpay_costumer_id, $plans_id " . json_encode($subscription));
- return $subscription;
+ $plans = $api->plan->all();
+ $id = "";
+ if (!empty($plans->items)) {
+ foreach ($plans->items as $value) {
+ if ($value->notes->plans_id == $plans_id) {
+ return $value->id;
+ }
}
}
- _error_log("RazorpayYPT::getSubscriptions ERROR $razorpay_costumer_id, $plans_id " . json_encode($costumer));
+ if (empty($id)) {
+ $plans = $api->plan->create(array(
+ 'period' => 'daily',
+ 'interval' => $plan->getHow_many_days(),
+ 'item' => array(
+ 'name' => $plan->getName(),
+ 'description' => $plan->getDescription(),
+ 'amount' => $plan->getPrice() * 100,
+ 'currency' => $obj->currency
+ ),
+ 'notes' => array(
+ 'plans_id' => $plans_id,
+ 'plan' => $plan->getName()
+ )
+ )
+ );
+ }
+ if (!empty($plans->id)) {
+ return $plans->id;
+ }
return false;
}
- public function setUpSubscription($plans_id, $razorpayToken) {
+ public function setUpSubscription($plans_id) {
if (!User::isLogged()) {
_error_log("setUpSubscription: User not logged");
return false;
}
- $subs = new SubscriptionPlansTable($plans_id);
+ $plan = new SubscriptionPlansTable($plans_id);
$obj = AVideoPlugin::getObjectData('YPTWallet');
- if (empty($subs)) {
+ if (empty($plan)) {
_error_log("setUpSubscription: Plan not found");
return false;
}
- // check costumer
- $sub = Subscription::getOrCreateRazorpaySubscription(User::getId(), $plans_id);
- if (!self::isCostumerValid($sub['razorpay_costumer_id'])) {
- $sub['razorpay_costumer_id'] = "";
- }
- if (empty($sub['razorpay_costumer_id'])) {
- $sub['razorpay_costumer_id'] = $this->getCostumerId(User::getId(), $razorpayToken);
- if (empty($sub['razorpay_costumer_id'])) {
- _error_log("setUpSubscription: Could not create a Razorpay costumer");
- return false;
- }
- Subscription::getOrCreateRazorpaySubscription(User::getId(), $plans_id, $sub['razorpay_costumer_id']);
- }
+ $razorpay_plan_id = $this->getOrCreatePlanId($plans_id);
- // check plan
- $razorpay_plan_id = $subs->getRazorpay_plan_id();
- if (empty($razorpay_plan_id)) {
- $interval = $subs->getHow_many_days();
- $price = $subs->getPrice();
- $paymentName = $subs->getName();
- if (empty($paymentName)) {
- $paymentName = "Recurrent Payment";
- }
+ $plan = new SubscriptionPlansTable($plans_id);
- $plan = $this->createBillingPlan($price, $obj->currency, "day", $interval, $paymentName);
- if (empty($plan)) {
- _error_log("setUpSubscription: could not create razorpay plan");
- return false;
- }
- $razorpay_plan_id = $plan->id;
- }
-
- _error_log("setUpSubscription: will start");
- $this->start();
-
- $metadata = new stdClass();
- $metadata->users_id = User::getId();
- $metadata->plans_id = $plans_id;
- $metadata->razorpay_costumer_id = $sub['razorpay_costumer_id'];
-
- $parameters = [
- "customer" => $sub['razorpay_costumer_id'],
- "items" => [
- [
- "plan" => $razorpay_plan_id,
- ]
- ],
- "metadata" => [
+ $options = array(
+ 'plan_id' => $razorpay_plan_id,
+ 'customer_notify' => 1,
+ 'total_count' => 500,
+ 'notes' => array(
+ 'user' => User::getUserName(),
'users_id' => User::getId(),
'plans_id' => $plans_id,
- 'razorpay_costumer_id' => $sub['razorpay_costumer_id']
- ]
- ];
+ 'plan' => $plan->getName()
+ )
+ );
+
+ $trialDays = $plan->getHow_many_days_trial();
- $trialDays = $subs->getHow_many_days_trial();
if (!empty($trialDays)) {
- $trial = strtotime("+{$trialDays} days");
- $parameters['trial_end'] = $trial;
+ $options['start_at'] = strtotime("+ $trialDays days");
}
-
- $Subscription = \Razorpay\Subscription::create($parameters);
- _error_log("setUpSubscription: result " . json_encode($Subscription));
- return $Subscription;
+ $api = $this->start();
+ $subscription = $api->subscription->create($options);
+ return $subscription;
}
- function processSubscriptionIPN($payload) {
- if (!is_object($payload) || empty($payload->data->object->customer)) {
+ function cancelSubscriptions($subscription_id) {
+ if (!User::isAdmin()) {
+ _error_log("cancelSubscriptions: User not admin");
return false;
}
- $pluginS = AVideoPlugin::loadPluginIfEnabled("YPTWallet");
- $plan = Subscription::getFromRazorpayCostumerId($payload->data->object->customer);
- $payment_amount = RazorpayYPT::addDot($payload->data->object->amount);
- $users_id = @$plan['users_id'];
- $plans_id = @$plan['subscriptions_plans_id'];
- if (!empty($users_id)) {
- $pluginS->addBalance($users_id, $payment_amount, "Razorpay recurrent: " . $payload->data->object->description, json_encode($payload));
- if (!empty($plans_id)) {
- Subscription::renew($users_id, $plans_id);
- }
- }
+ global $global;
+ $api = $this->start();
+ $options = array(
+ 'cancel_at_cycle_end' => 1
+ );
+ return $api->subscription->fetch($subscription_id)->cancel($options);
}
function getAllSubscriptions($status = 'active') {
@@ -337,30 +154,37 @@ class RazorPayYPT extends PluginAbstract {
return false;
}
global $global;
- $this->start();
- return \Razorpay\Subscription::all(['limit' => 1000, 'status' => $status]);
+ $api = $this->start();
+ return $api->subscription->all();
}
- function cancelSubscriptions($id) {
- if (!User::isAdmin()) {
- _error_log("cancelSubscriptions: User not admin");
- return false;
- }
+ function updateBillingPlan($plans_id, $total = '1.00', $currency = "USD", $interval = 1, $name = 'Base Agreement') {
global $global;
- try {
- $this->start();
- $sub = \Razorpay\Subscription::retrieve($id);
- $sub->cancel();
- return true;
- } catch (Exception $exc) {
+ if (empty($plan_id)) {
return false;
}
- }
- public function getPluginMenu() {
- global $global;
- $filename = $global['systemRootPath'] . 'plugin/RazorpayYPT/pluginMenu.html';
- //return file_get_contents($filename);
+ $plan = new SubscriptionPlansTable($plans_id);
+
+ if (empty($plan)) {
+ _error_log("updateBillingPlan: Plan not found");
+ return false;
+ }
+ $api = $this->start();
+ return $api->plan->create(array(
+ 'period' => 'daily',
+ 'interval' => $interval,
+ 'item' => array(
+ 'name' => $name,
+ 'amount' => $total * 100,
+ 'currency' => $currency
+ ),
+ 'notes' => array(
+ 'plans_id' => $plans_id,
+ 'plan' => $plan->getName()
+ )
+ )
+ );
}
}
diff --git a/plugin/RazorPayYPT/ipn.php b/plugin/RazorPayYPT/ipn.php
new file mode 100644
index 0000000000..defdfc031b
--- /dev/null
+++ b/plugin/RazorPayYPT/ipn.php
@@ -0,0 +1,52 @@
+error = true;
+
+$api = $razorpay->start();
+
+$json = file_get_contents('php://input');
+$webhookBody = json_decode($json);
+
+_error_log("RazorPayIPN Body - {$json}");
+
+$webhookSignature = $api->header('X-Razorpay-Signature');
+
+$api->utility->verifyWebhookSignature($webhookBody, $webhookSignature, $razorpayObject->webhookSecret);
+
+if (!empty($webhookBody->payload->subscription)) {
+
+ $users_id = $webhookBody->payload->subscription->notes->users_id;
+ $plans_id = $webhookBody->payload->subscription->notes->plans_id;
+
+ if(empty($users_id)){
+ _error_log("RazorPayIPN ERROR, user is empty");
+ }else if(empty($plans_id)){
+ _error_log("RazorPayIPN ERROR, plan is empty");
+ }else{
+ Subscription::renew($users_id, $plans_id);
+ _error_log("RazorPayIPN: Executed Renew $users_id, $plans_id");
+ }
+}else{
+ _error_log("RazorPayIPN ERROR, subscription NOT found");
+}
+
+_error_log("RazorPayIPN: " . json_encode($obj));
+_error_log("RazorPayIPN: POST " . json_encode($_POST));
+_error_log("RazorPayIPN: GET " . json_encode($_GET));
+_error_log("RazorPayIPN END");
+?>
\ No newline at end of file
diff --git a/plugin/YPTWallet/plugins/YPTWalletRazorPay/YPTWalletRazorPay.php b/plugin/YPTWallet/plugins/YPTWalletRazorPay/YPTWalletRazorPay.php
index e7a4b54685..7c84e160cf 100644
--- a/plugin/YPTWallet/plugins/YPTWalletRazorPay/YPTWalletRazorPay.php
+++ b/plugin/YPTWallet/plugins/YPTWalletRazorPay/YPTWalletRazorPay.php
@@ -5,27 +5,11 @@ require_once $global['systemRootPath'] . 'plugin/YPTWallet/YPTWalletPlugin.php';
class YPTWalletRazorPay extends YPTWalletPlugin{
- public function getAprovalLink() {
- global $global;
- $plugin = AVideoPlugin::loadPluginIfEnabled("RazorPayYPT");
- $payment = $plugin->setUpPayment(
- $this->getInvoiceNumber(),
- $this->getRedirectURL(),
- $this->getCancelURL(),
- $this->getValue(),
- $this->getCurrency());
- if (!empty($payment)) {
- return $payment->getApprovalLink();
- }
- return false;
- }
-
public function getAprovalButton() {
global $global;
include $global['systemRootPath'].'plugin/YPTWallet/plugins/YPTWalletRazorPay/confirmButton.php';
}
-
public function getRecurrentAprovalButton() {
global $global;
include $global['systemRootPath'].'plugin/YPTWallet/plugins/YPTWalletRazorPay/confirmRecurrentButton.php';
@@ -34,8 +18,6 @@ class YPTWalletRazorPay extends YPTWalletPlugin{
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
- $obj->RedirectURL = "{$global['webSiteRootURL']}plugin/YPTWallet/plugins/YPTWalletRazorPay/redirect_url.php";
- $obj->CancelURL = "{$global['webSiteRootURL']}plugin/YPTWallet/plugins/YPTWalletRazorPay/cancel_url.php";
return $obj;
}
diff --git a/plugin/YPTWallet/plugins/YPTWalletRazorPay/cancel_url.php b/plugin/YPTWallet/plugins/YPTWalletRazorPay/cancel_url.php
new file mode 100644
index 0000000000..91665f70d4
--- /dev/null
+++ b/plugin/YPTWallet/plugins/YPTWalletRazorPay/cancel_url.php
@@ -0,0 +1,7 @@
+
-
-
-
-
-
+
\ No newline at end of file
diff --git a/plugin/YPTWallet/plugins/YPTWalletRazorPay/confirmRecurrentButton.php b/plugin/YPTWallet/plugins/YPTWalletRazorPay/confirmRecurrentButton.php
index 281e610000..9ecdfd2948 100644
--- a/plugin/YPTWallet/plugins/YPTWalletRazorPay/confirmRecurrentButton.php
+++ b/plugin/YPTWallet/plugins/YPTWalletRazorPay/confirmRecurrentButton.php
@@ -2,157 +2,19 @@
$obj = AVideoPlugin::getObjectData('StripeYPT');
$uid = uniqid();
?>
-
-
-
-
-
+
\ No newline at end of file
diff --git a/plugin/YPTWallet/plugins/YPTWalletRazorPay/redirect_url.php b/plugin/YPTWallet/plugins/YPTWalletRazorPay/redirect_url.php
new file mode 100644
index 0000000000..69f52f0132
--- /dev/null
+++ b/plugin/YPTWallet/plugins/YPTWalletRazorPay/redirect_url.php
@@ -0,0 +1,108 @@
+getDataObject();
+$obj = $razorPay->getDataObject();
+
+$displayCurrency = $objS->currency;
+$users_id = User::getId();
+
+require_once ($global['systemRootPath'] . 'plugin/RazorPayYPT/razorpay-php/Razorpay.php');
+
+use Razorpay\Api\Api;
+use Razorpay\Api\Errors\SignatureVerificationError;
+
+$success = true;
+
+$error = "Payment Failed";
+
+$api = new Api($obj->api_key, $obj->api_secret);
+// payment
+if (!empty($_POST['razorpay_payment_id']) && !empty($_POST['razorpay_order_id'])) {
+
+ try {
+// Please note that the razorpay order ID must
+// come from a trusted source (session here, but
+// could be database or something else)
+ $attributes = array(
+ 'razorpay_order_id' => $_POST['razorpay_order_id'],
+ 'razorpay_payment_id' => $_POST['razorpay_payment_id'],
+ 'razorpay_signature' => $_POST['razorpay_signature']
+ );
+
+ $api->utility->verifyPaymentSignature($attributes);
+ } catch (SignatureVerificationError $e) {
+ $success = false;
+ $error = 'Razorpay Error : ' . $e->getMessage();
+ _error_log("RazorPay redirect_url: {$error}");
+ }
+ if (!empty($_POST['razorpay_payment_id']) && $success === true) {
+ $api = new Api($obj->api_key, $obj->api_secret);
+ $payment = $api->payment->fetch($_POST['razorpay_payment_id']);
+ if ($payment->currency == $displayCurrency) {
+ $plugin->addBalance($users_id, $payment->amount / 100, "RazorPay payment: ", json_encode($attributes));
+ header("Location: {$global['webSiteRootURL']}plugin/YPTWallet/view/addFunds.php?status=success");
+ } else {
+ header("Location: {$global['webSiteRootURL']}plugin/YPTWallet/view/addFunds.php?status=fail");
+ }
+ } else {
+ header("Location: {$global['webSiteRootURL']}plugin/YPTWallet/view/addFunds.php?status=fail");
+ }
+} else if (!empty($_POST['razorpay_payment_id']) && !empty($_POST['razorpay_subscription_id'])) { // this is for the subscription
+ try {
+// Please note that the razorpay order ID must
+// come from a trusted source (session here, but
+// could be database or something else)
+ $attributes = array(
+ 'razorpay_subscription_id' => $_POST['razorpay_subscription_id'],
+ 'razorpay_payment_id' => $_POST['razorpay_payment_id'],
+ 'razorpay_signature' => $_POST['razorpay_signature']
+ );
+
+ $api->utility->verifyPaymentSignature($attributes);
+ } catch (SignatureVerificationError $e) {
+ $success = false;
+ $error = 'Razorpay Error : ' . $e->getMessage();
+ _error_log("RazorPay redirect_url: {$error}");
+ }
+ if (!empty($_POST['razorpay_payment_id']) && $success === true) {
+ $api = new Api($obj->api_key, $obj->api_secret);
+ $payment = $api->payment->fetch($_POST['razorpay_payment_id']);
+ if ($payment->currency == $displayCurrency) {
+ AVideoPlugin::isEnabledByName('Subscription');
+ $plugin->addBalance($users_id, $payment->amount / 100, "RazorPay payment for subscription: ", json_encode($attributes));
+ $currentSubscription = SubscriptionTable::getSubscription(User::getId(), $payment->notes->plans_id, false, false);
+ if (empty($currentSubscription)) {
+ // create a subscription here
+ Subscription::getOrCreateGatewaySubscription(User::getId(), $payment->notes->plans_id, SubscriptionTable::$gatway_razorpay, $payment->id);
+
+ if (Subscription::isTrial($payment->notes->plans_id)) {
+ Subscription::onTrial(User::getId(), $payment->notes->plans_id);
+ }else{
+ Subscription::renew(User::getId(), $payment->notes->plans_id);
+ }
+ }else{
+ Subscription::renew(User::getId(), $payment->notes->plans_id);
+ }
+ header("Location: {$global['webSiteRootURL']}plugin/Subscription/showPlans.php?status=success");
+ } else {
+ header("Location: {$global['webSiteRootURL']}plugin/Subscription/showPlans.php?status=fail");
+ }
+ } else {
+ header("Location: {$global['webSiteRootURL']}plugin/Subscription/showPlans.php?status=fail");
+ }
+}
+
+_error_log(json_encode($obj));
+_error_log("RazorPay redirect_url GET: " . json_encode($_GET));
+_error_log("RazorPay redirect_url POST: " . json_encode($_POST));
+?>
\ No newline at end of file
diff --git a/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestPayment.json.php b/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestPayment.json.php
index 9ef0771611..6ff350420b 100644
--- a/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestPayment.json.php
+++ b/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestPayment.json.php
@@ -1,35 +1,171 @@
getDataObject();
+$obj = $razorPay->getDataObject();
-$obj = new stdClass();
-$obj->error = true;
-
-if (empty($_POST['value'])) {
- $obj->msg = "Invalid Value";
- die(json_encode($obj));
-}
+$api = new Api($obj->api_key, $obj->api_secret);
+//
+// We create an razorpay order using orders api
+// Docs: https://docs.razorpay.com/docs/orders
+//
$invoiceNumber = uniqid();
-//setUpPayment($total = '1.00', $currency = "USD", $description = "");
-$payment = $plugin->setUpPayment($_POST['value'], $objS->currency, $config->getWebSiteTitle() . " Payment");
-if (!empty($payment) && StripeYPT::isPaymentOk($payment, $_POST['value'], $objS->currency)) {
- $obj->error = false;
- $obj->charge = $payment;
- $obj->amount = StripeYPT::getAmountFromPayment($payment);
+$displayCurrency = $objS->currency;
- $pluginS->addBalance(User::getId(), $obj->amount, "Stripe payment", json_encode($payment));
+$orderData = [
+ 'receipt' => $invoiceNumber,
+ 'amount' => $_POST['value'] * 100, // 2000 rupees in paise
+ 'currency' => $displayCurrency,
+ 'payment_capture' => 1, // auto capture
+ 'notes' => array(
+ 'user' => User::getUserName(),
+ 'users_id' => User::getId()
+ )
+];
+
+$data = [];
+try {
+ $razorpayOrder = $api->order->create($orderData);
+} catch (Exception $exc) {
+ if ($exc->getMessage() === "Currency is not supported") {
+ echo "Enable or Disable International Payments
";
+ }
+ error_log("Razorpay requestPayment.json.php: [" . $exc->getCode() . "] " . $exc->getMessage());
+ error_log("Razorpay requestPayment.json.php: " . $exc->getTraceAsString());
+ die("Fail to connect on RazorPay");
}
-$obj->walletBalance = $pluginS->getBalanceFormated(User::getId());
-die(json_encode($obj));
+
+
+$razorpayOrderId = $razorpayOrder['id'];
+
+$_SESSION['razorpay_order_id'] = $razorpayOrderId;
+
+$displayAmount = $amount = $orderData['amount'];
+
+if ($displayCurrency !== 'INR') {
+ $url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR";
+ $exchange = json_decode(file_get_contents($url), true);
+
+ $displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100;
+}
+
+$checkout = 'automatic';
+
+if (isset($_GET['checkout']) and in_array($_GET['checkout'], ['automatic', 'manual'], true)) {
+ $checkout = $_GET['checkout'];
+}
+
+$data = [
+ "key" => $obj->api_key,
+ "amount" => $amount,
+ "name" => $config->getWebSiteTitle() . " Payment",
+ "image" => $config->getLogo(),
+ "prefill" => [
+ "name" => User::getName(),
+ "email" => User::getEmail_()
+ ],
+ "notes" => [
+ "users_id" => User::getId(),
+ ],
+ "order_id" => $razorpayOrderId,
+ "callback_url" => "{$global['webSiteRootURL']}plugin/YPTWallet/plugins/YPTWalletRazorPay/redirect_url.php",
+ "redirect" => true
+];
+
+if ($displayCurrency !== 'INR') {
+ $data['display_currency'] = $displayCurrency;
+ $data['display_amount'] = $displayAmount;
+}
+
+
+$json = json_encode($data);
+
+?>
+
+
+
+ Add Funds
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestSubscription.json.php b/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestSubscription.json.php
index 3a8cbe666f..e0b23ac8d7 100644
--- a/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestSubscription.json.php
+++ b/plugin/YPTWallet/plugins/YPTWalletRazorPay/requestSubscription.json.php
@@ -1,7 +1,4 @@
getDataObject();
+$objR = $plugin->getDataObject();
-$obj= new stdClass();
+$obj = new stdClass();
$obj->error = true;
+$displayCurrency = $objS->currency;
+
+
$invoiceNumber = uniqid();
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
unset($_SESSION['recurrentSubscription']['plans_id']);
-if(!empty($_POST['plans_id'])){
- $_SESSION['recurrentSubscription']['plans_id'] = $_POST['plans_id'];
+if (!empty($_POST['plans_id'])) {
+ $_SESSION['recurrentSubscription']['plans_id'] = $_POST['plans_id'];
}
$subs = new SubscriptionPlansTable($_POST['plans_id']);
-if(empty($subs)){
+if (empty($subs)) {
die("Plan Not found");
}
-if(empty($_POST['stripeToken'])){
- die("stripeToken Not found");
+if (!User::isLogged()) {
+ die("User not logged");
}
-if(!User::isLogged()){
- die("User not logged");
-
-}
$users_id = User::getId();
+
//setUpSubscription($invoiceNumber, $redirect_url, $cancel_url, $total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = 'Base Agreement')
-_error_log("Request subscription setUpSubscription: ". json_encode($_POST));
-$payment = $plugin->setUpSubscription($_POST['plans_id'], $_POST['stripeToken']);
+_error_log("Request subscription setUpSubscription: " . json_encode($_POST));
+$payment = $plugin->setUpSubscription($_POST['plans_id']);
_error_log("Request subscription setUpSubscription Done ");
-if (!empty($payment) && !empty($payment->status) && ($payment->status=="active" || $payment->status=="trialing")) {
- if($payment->status=="trialing" && Subscription::isTrial($_POST['plans_id'])){
- Subscription::onTrial($users_id, $_POST['plans_id']);
+if (!empty($payment) && !empty($payment->status) && ($payment->status == "active" || $payment->status == "created")) {
+
+ $data = [
+ "key" => $objR->api_key,
+ "subscription_id" => $payment->id,
+ "subscription_card_change" => 0,
+ "name" => $config->getWebSiteTitle() . " Payment",
+ "image" => $config->getLogo(),
+ "prefill" => [
+ "name" => User::getName(),
+ "email" => User::getEmail_()
+ ],
+ "notes" => [
+ "users_id" => User::getId(),
+ "plans_id" => $_POST['plans_id']
+ ],
+ "callback_url" => "{$global['webSiteRootURL']}plugin/YPTWallet/plugins/YPTWalletRazorPay/redirect_url.php",
+ "redirect" => true
+ ];
+
+ if ($displayCurrency !== 'INR') {
+ $data['display_currency'] = $displayCurrency;
+ $data['display_amount'] = $displayAmount;
}
+ $json = json_encode($data);
$obj->error = false;
- $obj->subscription = $payment;
-}else{
- _error_log("Request subscription Stripe error: ". json_encode($payment));
+} else {
+ _error_log("Request subscription Stripe error: " . json_encode($payment));
}
-die(json_encode($obj));
\ No newline at end of file
+if ($obj->error) {
+ die("Error on Subscription request");
+}
+?>
+
+
+
+ Add Funds
+
+
+
+
+
+
+
+
+
+
+
+
+
getName(); ?>
+
+ getPrice());
+ ?>
+
+
+ getDescription());
+ ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/updatedb/updateDb.v8.4.sql b/updatedb/updateDb.v8.4.sql
new file mode 100644
index 0000000000..ee45429e0b
--- /dev/null
+++ b/updatedb/updateDb.v8.4.sql
@@ -0,0 +1,14 @@
+SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
+
+ALTER TABLE `categories`
+ADD COLUMN `order` INT(11) NULL DEFAULT NULL,
+ADD INDEX `sortcategoryOrderIndex` (`order` ASC);
+
+
+UPDATE configurations SET version = '8.4', modified = now() WHERE id = 1;
+
+SET SQL_MODE=@OLD_SQL_MODE;
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
+SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
diff --git a/view/css/main.css b/view/css/main.css
index aa4ee9bc46..47988a8f85 100644
--- a/view/css/main.css
+++ b/view/css/main.css
@@ -2,6 +2,9 @@ html,
body {
height: 100vh;
}
+html {
+ scroll-behavior: smooth;
+}
body {
padding-top: 60px;
}
diff --git a/view/js/infinite-scroll.pkgd.min.js b/view/js/infinite-scroll.pkgd.min.js
index ef87adbd28..baa18e8d02 100644
--- a/view/js/infinite-scroll.pkgd.min.js
+++ b/view/js/infinite-scroll.pkgd.min.js
@@ -1,5 +1,5 @@
/*!
- * Infinite Scroll PACKAGED v3.0.5
+ * Infinite Scroll PACKAGED v3.0.6
* Automatically add next page
*
* Licensed GPLv3 for open source use
@@ -9,4 +9,4 @@
* Copyright 2018 Metafizzy
*/
-!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,l){function a(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,a){var h=l.data(a,i);if(!h)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var c=h[e];if(!c||"_"==e.charAt(0))return void s(r+" is not a valid method");var u=c.apply(h,n);o=void 0===o?u:o}),void 0!==o?o:t}function h(t,e){t.each(function(t,n){var o=l.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),l.data(n,i,o))})}l=l||e||t.jQuery,l&&(r.prototype.option||(r.prototype.option=function(t){l.isPlainObject(t)&&(this.options=l.extend(!0,this.options,t))}),l.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return a(this,t,e)}return h(this,t),this},n(l))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return n.indexOf(e)==-1&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return n!=-1&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;o=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},s.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},s.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/scroll-watch",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){var n=e.prototype;return e.defaults.scrollThreshold=400,e.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);var t=this.options.scrollThreshold,e=t||0===t;e&&this.enableScrollWatch()},e.destroy.scrollWatch=function(){this.disableScrollWatch()},n.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},n.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},n.bindScrollWatchEvents=function(e){var i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.pageScrollHandler),t[i]("resize",this.resizeHandler)},n.onPageScroll=e.throttle(function(){var t=this.getBottomDistance();t<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")}),n.getBottomDistance=function(){return this.options.elementScroll?this.getElementBottomDistance():this.getWindowBottomDistance()},n.getWindowBottomDistance=function(){var e=this.top+this.element.clientHeight,i=t.pageYOffset+this.windowHeight;return e-i},n.getElementBottomDistance=function(){var t=this.scroller.scrollHeight,e=this.scroller.scrollTop+this.scroller.clientHeight;return t-e},n.onResize=function(){this.updateMeasurements()},i.debounceMethod(e,"onResize",150),e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/history",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){var n=e.prototype;e.defaults.history="replace";var o=document.createElement("a");return e.create.history=function(){if(this.options.history){o.href=this.getAbsolutePath();var t=o.origin||o.protocol+"//"+o.host,e=t==location.origin;return e?void(this.options.append?this.createHistoryAppend():this.createHistoryPageLoad()):void console.error("[InfiniteScroll] cannot set history with different origin: "+o.origin+" on "+location.origin+" . History behavior disabled.")}},n.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPageIndex=0,this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},n.bindHistoryAppendEvents=function(e){var i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.scrollHistoryHandler),t[i]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},e.destroy.history=n.destroyHistory=function(){var t=this.options.history&&this.options.append;t&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(t,e,i){if(i&&i.length){var n=i[0],r=this.getElementScrollY(n);o.href=e,this.scrollPages.push({top:r,path:o.href,title:t.title})}},n.getElementScrollY=function(t){return this.options.elementScroll?this.getElementElementScrollY(t):this.getElementWindowScrollY(t)},n.getElementWindowScrollY=function(e){var i=e.getBoundingClientRect();return i.top+t.pageYOffset},n.getElementElementScrollY=function(t){return t.offsetTop-this.top},n.onScrollHistory=function(){for(var t,e,i=this.getScrollViewY(),n=0;n=i)break;t=n,e=o}t!=this.scrollPageIndex&&(this.scrollPageIndex=t,this.setHistory(e.title,e.path))},i.debounceMethod(e,"onScrollHistory",150),n.getScrollViewY=function(){return this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:t.pageYOffset+this.windowHeight/2},n.setHistory=function(t,e){var i=this.options.history,n=i&&history[i+"State"];n&&(history[i+"State"](null,t,e),this.options.historyTitle&&(document.title=t),this.dispatchEvent("history",null,[t,e]))},n.onUnload=function(){var e=this.scrollPageIndex;if(0!==e){var i=this.scrollPages[e],n=t.pageYOffset-i.top+this.top;this.destroyHistory(),scrollTo(0,n)}},n.onPageLoadHistory=function(t,e){this.setHistory(t.title,e)},e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/button",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){function n(t,e){this.element=t,this.infScroll=e,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),e.on("request",this.disable.bind(this)),e.on("load",this.enable.bind(this)),e.on("error",this.hide.bind(this)),e.on("last",this.hide.bind(this))}return e.create.button=function(){var t=i.getQueryElement(this.options.button);if(t)return void(this.button=new n(t,this))},e.destroy.button=function(){this.button&&this.button.destroy()},n.prototype.onClick=function(t){t.preventDefault(),this.infScroll.loadNextPage()},n.prototype.enable=function(){this.element.removeAttribute("disabled")},n.prototype.disable=function(){this.element.disabled="disabled"},n.prototype.hide=function(){this.element.style.display="none"},n.prototype.destroy=function(){this.element.removeEventListener("click",this.clickHandler)},e.Button=n,e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/status",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){function n(t){r(t,"none")}function o(t){r(t,"block")}function r(t,e){t&&(t.style.display=e)}var s=e.prototype;return e.create.status=function(){var t=i.getQueryElement(this.options.status);t&&(this.statusElement=t,this.statusEventElements={request:t.querySelector(".infinite-scroll-request"),error:t.querySelector(".infinite-scroll-error"),last:t.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},s.bindHideStatus=function(t){var e=this.options.append?"append":"load";this[t](e,this.hideAllStatus)},s.showRequestStatus=function(){this.showStatus("request")},s.showErrorStatus=function(){this.showStatus("error")},s.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},s.showStatus=function(t){o(this.statusElement),this.hideStatusEventElements();var e=this.statusEventElements[t];o(e)},s.hideAllStatus=function(){n(this.statusElement),this.hideStatusEventElements()},s.hideStatusEventElements=function(){for(var t in this.statusEventElements){var e=this.statusEventElements[t];n(e)}},e}),function(t,e){"function"==typeof define&&define.amd?define(["infinite-scroll/js/core","infinite-scroll/js/page-load","infinite-scroll/js/scroll-watch","infinite-scroll/js/history","infinite-scroll/js/button","infinite-scroll/js/status"],e):"object"==typeof module&&module.exports&&(module.exports=e(require("./core"),require("./page-load"),require("./scroll-watch"),require("./history"),require("./button"),require("./status")))}(window,function(t){return t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){if(Array.isArray(t))return t;var e="object"==typeof t&&"number"==typeof t.length;return e?h.call(t):[t]}function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);var s=t;return"string"==typeof t&&(s=document.querySelectorAll(t)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof e?r=e:i(this.options,e),r&&this.on("always",r),this.getImages(),l&&(this.jqDeferred=new l.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||t))}function r(t){this.img=t}function s(t,e){this.url=t,this.element=e,this.img=new Image}var l=t.jQuery,a=t.console,h=Array.prototype.slice;o.prototype=Object.create(e.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&c[e]){for(var i=t.querySelectorAll("img"),n=0;n=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},s.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},s.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/scroll-watch",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){var n=e.prototype;return e.defaults.scrollThreshold=400,e.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);var t=this.options.scrollThreshold,e=t||0===t;e&&this.enableScrollWatch()},e.destroy.scrollWatch=function(){this.disableScrollWatch()},n.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},n.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},n.bindScrollWatchEvents=function(e){var i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.pageScrollHandler),t[i]("resize",this.resizeHandler)},n.onPageScroll=e.throttle(function(){var t=this.getBottomDistance();t<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")}),n.getBottomDistance=function(){return this.options.elementScroll?this.getElementBottomDistance():this.getWindowBottomDistance()},n.getWindowBottomDistance=function(){var e=this.top+this.element.clientHeight,i=t.pageYOffset+this.windowHeight;return e-i},n.getElementBottomDistance=function(){var t=this.scroller.scrollHeight,e=this.scroller.scrollTop+this.scroller.clientHeight;return t-e},n.onResize=function(){this.updateMeasurements()},i.debounceMethod(e,"onResize",150),e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/history",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){var n=e.prototype;e.defaults.history="replace";var o=document.createElement("a");return e.create.history=function(){if(this.options.history){o.href=this.getAbsolutePath();var t=o.origin||o.protocol+"//"+o.host,e=t==location.origin;return e?void(this.options.append?this.createHistoryAppend():this.createHistoryPageLoad()):void console.error("[InfiniteScroll] cannot set history with different origin: "+o.origin+" on "+location.origin+" . History behavior disabled.")}},n.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPageIndex=0,this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},n.bindHistoryAppendEvents=function(e){var i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.scrollHistoryHandler),t[i]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},e.destroy.history=n.destroyHistory=function(){var t=this.options.history&&this.options.append;t&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(t,e,i){if(i&&i.length){var n=i[0],r=this.getElementScrollY(n);o.href=e,this.scrollPages.push({top:r,path:o.href,title:t.title})}},n.getElementScrollY=function(t){return this.options.elementScroll?this.getElementElementScrollY(t):this.getElementWindowScrollY(t)},n.getElementWindowScrollY=function(e){var i=e.getBoundingClientRect();return i.top+t.pageYOffset},n.getElementElementScrollY=function(t){return t.offsetTop-this.top},n.onScrollHistory=function(){for(var t,e,i=this.getScrollViewY(),n=0;n=i)break;t=n,e=o}t!=this.scrollPageIndex&&(this.scrollPageIndex=t,this.setHistory(e.title,e.path))},i.debounceMethod(e,"onScrollHistory",150),n.getScrollViewY=function(){return this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:t.pageYOffset+this.windowHeight/2},n.setHistory=function(t,e){var i=this.options.history,n=i&&history[i+"State"];n&&(history[i+"State"](null,t,e),this.options.historyTitle&&(document.title=t),this.dispatchEvent("history",null,[t,e]))},n.onUnload=function(){var e=this.scrollPageIndex;if(0!==e){var i=this.scrollPages[e],n=t.pageYOffset-i.top+this.top;this.destroyHistory(),scrollTo(0,n)}},n.onPageLoadHistory=function(t,e){this.setHistory(t.title,e)},e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/button",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){function n(t,e){this.element=t,this.infScroll=e,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),e.on("request",this.disable.bind(this)),e.on("load",this.enable.bind(this)),e.on("error",this.hide.bind(this)),e.on("last",this.hide.bind(this))}return e.create.button=function(){var t=i.getQueryElement(this.options.button);if(t)return void(this.button=new n(t,this))},e.destroy.button=function(){this.button&&this.button.destroy()},n.prototype.onClick=function(t){t.preventDefault(),this.infScroll.loadNextPage()},n.prototype.enable=function(){this.element.removeAttribute("disabled")},n.prototype.disable=function(){this.element.disabled="disabled"},n.prototype.hide=function(){this.element.style.display="none"},n.prototype.destroy=function(){this.element.removeEventListener("click",this.clickHandler)},e.Button=n,e}),function(t,e){"function"==typeof define&&define.amd?define("infinite-scroll/js/status",["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){function n(t){r(t,"none")}function o(t){r(t,"block")}function r(t,e){t&&(t.style.display=e)}var s=e.prototype;return e.create.status=function(){var t=i.getQueryElement(this.options.status);t&&(this.statusElement=t,this.statusEventElements={request:t.querySelector(".infinite-scroll-request"),error:t.querySelector(".infinite-scroll-error"),last:t.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},s.bindHideStatus=function(t){var e=this.options.append?"append":"load";this[t](e,this.hideAllStatus)},s.showRequestStatus=function(){this.showStatus("request")},s.showErrorStatus=function(){this.showStatus("error")},s.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},s.showStatus=function(t){o(this.statusElement),this.hideStatusEventElements();var e=this.statusEventElements[t];o(e)},s.hideAllStatus=function(){n(this.statusElement),this.hideStatusEventElements()},s.hideStatusEventElements=function(){for(var t in this.statusEventElements){var e=this.statusEventElements[t];n(e)}},e}),function(t,e){"function"==typeof define&&define.amd?define(["infinite-scroll/js/core","infinite-scroll/js/page-load","infinite-scroll/js/scroll-watch","infinite-scroll/js/history","infinite-scroll/js/button","infinite-scroll/js/status"],e):"object"==typeof module&&module.exports&&(module.exports=e(require("./core"),require("./page-load"),require("./scroll-watch"),require("./history"),require("./button"),require("./status")))}(window,function(t){return t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){if(Array.isArray(t))return t;var e="object"==typeof t&&"number"==typeof t.length;return e?h.call(t):[t]}function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);var s=t;return"string"==typeof t&&(s=document.querySelectorAll(t)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof e?r=e:i(this.options,e),r&&this.on("always",r),this.getImages(),l&&(this.jqDeferred=new l.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||t))}function r(t){this.img=t}function s(t,e){this.url=t,this.element=e,this.img=new Image}var l=t.jQuery,a=t.console,h=Array.prototype.slice;o.prototype=Object.create(e.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&c[e]){for(var i=t.querySelectorAll("img"),n=0;n
|
|
- |
- |
+ |
+ |
+ |
|
@@ -35,6 +36,8 @@
" required>
+
+ ">