Completed
Pull Request — 1.11.x (#1214)
by José
50:40
created
plugin/buycourses/src/buy_course_plugin.class.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             return false;
92 92
         }
93 93
 
94
-        require_once api_get_path(SYS_PLUGIN_PATH) . 'buycourses/database.php';
94
+        require_once api_get_path(SYS_PLUGIN_PATH).'buycourses/database.php';
95 95
     }
96 96
 
97 97
     /**
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
             $item = $this->getItemByProduct(intval($productId), $productType);
136 136
             $return['html'] = '<div class="buycourses-price">';
137 137
             if ($item) {
138
-                $return['html'] .= '<span class="label label-primary"><b>'. $item['iso_code'] .' ' . $item['price'] . '</b></span>';
138
+                $return['html'] .= '<span class="label label-primary"><b>'.$item['iso_code'].' '.$item['price'].'</b></span>';
139 139
                 $return['verificator'] = true;
140 140
             } else {
141
-                $return['html'] .= '<span class="label label-primary"><b>'. $this->get_lang('Free'). '</b></span>';
141
+                $return['html'] .= '<span class="label label-primary"><b>'.$this->get_lang('Free').'</b></span>';
142 142
                 $return['verificator'] = false;
143 143
             }
144 144
             $return['html'] .= '</div>';
@@ -156,15 +156,15 @@  discard block
 block discarded – undo
156 156
      * @return string $html
157 157
      */
158 158
     public function returnBuyCourseButton($productId, $productType) {
159
-        $url = api_get_path(WEB_PLUGIN_PATH) .
160
-            'buycourses/src/process.php?i=' .
161
-            intval($productId) .
162
-            '&t=' .
159
+        $url = api_get_path(WEB_PLUGIN_PATH).
160
+            'buycourses/src/process.php?i='.
161
+            intval($productId).
162
+            '&t='.
163 163
             $productType
164 164
         ;
165 165
 
166
-        $html = ' <a class="btn btn-success btn-sm" title="' . $this->get_lang('Buy') . '" href="' . $url . '">' .
167
-            Display::returnFontAwesomeIcon('fa fa-shopping-cart') . '</a>';
166
+        $html = ' <a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'.
167
+            Display::returnFontAwesomeIcon('fa fa-shopping-cart').'</a>';
168 168
 
169 169
         return $html;
170 170
     }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         );
710 710
 
711 711
         if (!empty($sessionImage)) {
712
-            $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH) . $sessionImage['value'];
712
+            $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH).$sessionImage['value'];
713 713
         }
714 714
 
715 715
         $sessionCourses = $session->getCourses();
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
         $str = '';
1153 1153
 
1154
-        srand((double)microtime() * 1000000);
1154
+        srand((double) microtime() * 1000000);
1155 1155
 
1156 1156
         for ($i = 0; $i < $length; $i++) {
1157 1157
             $numbers = rand(0, strlen($salt) - 1);
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
      */
1499 1499
     public function getPayouts($status = self::PAYOUT_STATUS_PENDING, $payoutId = false, $userId = false)
1500 1500
     {
1501
-        $condition = ($payoutId) ? 'AND p.id = '. intval($payoutId) : '';
1502
-        $condition2 = ($userId) ? ' AND p.user_id = ' . intval($userId) : '';
1501
+        $condition = ($payoutId) ? 'AND p.id = '.intval($payoutId) : '';
1502
+        $condition2 = ($userId) ? ' AND p.user_id = '.intval($userId) : '';
1503 1503
         $typeResult = ($condition) ? 'first' : 'all';
1504 1504
         $payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS);
1505 1505
         $saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
@@ -1526,14 +1526,14 @@  discard block
 block discarded – undo
1526 1526
             INNER JOIN $saleTable s ON s.id = p.sale_id
1527 1527
             INNER JOIN $currencyTable c ON s.currency_id = c.id
1528 1528
             LEFT JOIN  $extraFieldValues efv ON p.user_id = efv.item_id 
1529
-            AND field_id = " . intval($paypalExtraField['id']) . "
1529
+            AND field_id = ".intval($paypalExtraField['id'])."
1530 1530
         ";
1531 1531
 
1532 1532
         $payouts = Database::select(
1533 1533
             "p.* , u.firstname, u.lastname, efv.value as paypal_account, s.reference as sale_reference, s.price as item_price, c.iso_code",
1534 1534
             "$payoutsTable p $innerJoins",
1535 1535
             [
1536
-                'where' => ['p.status = ? '.$condition . ' ' .$condition2 => $status]
1536
+                'where' => ['p.status = ? '.$condition.' '.$condition2 => $status]
1537 1537
             ],
1538 1538
             $typeResult
1539 1539
         );
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
         $platformCommission = $this->getPlatformCommission();
1598 1598
 
1599 1599
         $sale = $this->getSale($saleId);
1600
-        $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission']))/100, 2);
1600
+        $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission'])) / 100, 2);
1601 1601
 
1602 1602
 
1603 1603
         $beneficiaries = $this->getBeneficiariesBySale($saleId);
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
                     'payout_date' => getdate(),
1610 1610
                     'sale_id' => intval($saleId),
1611 1611
                     'user_id' => $beneficiary['user_id'],
1612
-                    'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions']))/100, 2),
1612
+                    'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions'])) / 100, 2),
1613 1613
                     'status' => self::PAYOUT_STATUS_PENDING
1614 1614
                 ]
1615 1615
             );
Please login to merge, or discard this patch.