Skip to content

Commit 310db66

Browse files
committed
Thorough review of the BuyCourses plugin - refs #5464
2 parents cfebe41 + 475b37b commit 310db66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3713
-3
lines changed

main/inc/lib/internationalization.lib.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,6 +3315,7 @@ function api_is_valid_date($date, $format = 'Y-m-d H:i:s') {
33153315
$d = DateTime::createFromFormat($format, $date);
33163316
return $d && $d->format($format) == $date;
33173317
}
3318+
33183319
/**
33193320
* Return the encoding country code for jquery datepicker
33203321
* used for exemple in main/exercice/exercise_report.php
@@ -3331,6 +3332,16 @@ function get_datepicker_langage_code() {
33313332
return $languaje;
33323333
}
33333334

3335+
/**
3336+
* Returns the variable translated
3337+
* @param $variable the string to translate
3338+
* @param $pluginName the Plugin name
3339+
* @return string the variable translated
3340+
*/
3341+
function get_plugin_lang($variable, $pluginName) {
3342+
eval("\$plugin = {$pluginName}::create();");
3343+
return $plugin->get_lang($variable);
3344+
}
33343345
/**
33353346
* Functions for internal use behind this API
33363347
*/

main/inc/lib/plugin.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,7 @@ public function addTab($tabName, $url)
544544
/**
545545
* Delete a tab to chamilo's platform
546546
* @param string $key
547-
*
548-
* @return boolean $resp
547+
* @return boolean $resp Transaction response
549548
*/
550549
public function deleteTab($key)
551550
{

main/inc/lib/template.lib.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public function __construct(
9191

9292
$this->twig = new Twig_Environment($loader, $options);
9393

94+
$this->twig->addFilter('get_plugin_lang', new Twig_Filter_Function('get_plugin_lang'));
9495
$this->twig->addFilter('get_lang', new Twig_Filter_Function('get_lang'));
9596
$this->twig->addFilter('get_path', new Twig_Filter_Function('api_get_path'));
9697
$this->twig->addFilter('get_setting', new Twig_Filter_Function('api_get_setting'));

plugin/buycourses/config.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
/* For licensing terms, see /license.txt */
3+
4+
define('TABLE_BUY_COURSE', 'plugin_buy_course');
5+
define('TABLE_BUY_COURSE_COUNTRY', 'plugin_buy_course_country');
6+
define('TABLE_BUY_COURSE_PAYPAL', 'plugin_buy_course_paypal');
7+
define('TABLE_BUY_COURSE_TRANSFERENCE', 'plugin_buy_course_transference');
8+
define('TABLE_BUY_COURSE_TEMPORAL', 'plugin_buy_course_temporal');
9+
define('TABLE_BUY_COURSE_SALE', 'plugin_buy_course_sale');
10+
11+
require_once __DIR__ . '/../../main/inc/global.inc.php';
12+
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
13+
require_once api_get_path(PLUGIN_PATH) . 'buy_courses/src/buy_course_plugin.class.php';

0 commit comments

Comments
 (0)