Skip to content

Commit

Permalink
MDL-69166 core_payment: Renamed plugintype name from pg to paygw
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Oct 27, 2020
1 parent 9ad96a6 commit 2d7feb7
Show file tree
Hide file tree
Showing 36 changed files with 98 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class manage_payment_gateway_plugins extends \admin_setting_manage_plugins {
* @return string
*/
public function get_section_title() {
return get_string('type_pg_plural', 'plugin');
return get_string('type_paygw_plural', 'plugin');
}

/**
Expand All @@ -43,7 +43,7 @@ public function get_section_title() {
* @return string
*/
public function get_plugin_type() {
return 'pg';
return 'paygw';
}

/**
Expand Down
8 changes: 4 additions & 4 deletions admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@
}

// Payment gateway plugins.
$ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_pg_plural', 'plugin')));
$temp = new admin_settingpage('managepaymentgateways', new lang_string('type_pgmanage', 'plugin'));
$ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin')));
$temp = new admin_settingpage('managepaymentgateways', new lang_string('type_paygwmanage', 'plugin'));
$temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins());
$temp->add(new admin_setting_description(
'managepaymentgatewayspostfix',
Expand All @@ -292,10 +292,10 @@
));
$ADMIN->add('paymentgateways', $temp);

$plugins = core_plugin_manager::instance()->get_plugins_of_type('pg');
$plugins = core_plugin_manager::instance()->get_plugins_of_type('paygw');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\pg $plugin */
/** @var \core\plugininfo\paygw $plugin */
$plugin->load_settings($ADMIN, 'paymentgateways', $hassiteconfig);
}

Expand Down
6 changes: 3 additions & 3 deletions lang/en/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@
$string['type_mnetservice_plural'] = 'MNet services';
$string['type_mod'] = 'Activity module';
$string['type_mod_plural'] = 'Activity modules';
$string['type_pgmanage'] = 'Manage payment gateways';
$string['type_pg'] = 'Payment gateway';
$string['type_pg_plural'] = 'Payment gateways';
$string['type_paygwmanage'] = 'Manage payment gateways';
$string['type_paygw'] = 'Payment gateway';
$string['type_paygw_plural'] = 'Payment gateways';
$string['type_plagiarism'] = 'Plagiarism plugin';
$string['type_plagiarism_plural'] = 'Plagiarism plugins';
$string['type_portfolio'] = 'Portfolio';
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/plugin_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ public static function standard_plugins_list($type) {
'quiz', 'resource', 'scorm', 'survey', 'url', 'wiki', 'workshop'
),

'pg' => [
'paygw' => [
'paypal',
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @copyright 2019 Shamim Rezaie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class pg extends base {
class paygw extends base {
public function is_uninstall_allowed() {
return true;
}
Expand Down Expand Up @@ -73,9 +73,9 @@ public static function get_manage_url() {
public static function get_enabled_plugins() {
global $CFG;

$order = (!empty($CFG->pg_plugins_sortorder)) ? explode(',', $CFG->pg_plugins_sortorder) : [];
$order = (!empty($CFG->paygw_plugins_sortorder)) ? explode(',', $CFG->paygw_plugins_sortorder) : [];
if ($order) {
$plugins = \core_plugin_manager::instance()->get_installed_plugins('pg');
$plugins = \core_plugin_manager::instance()->get_installed_plugins('paygw');
$order = array_intersect($order, array_keys($plugins));
}

Expand All @@ -96,7 +96,7 @@ public function set_enabled(bool $newstate = true) {
}
if ($newstate) {
// Enable gateway plugin.
$plugins = \core_plugin_manager::instance()->get_plugins_of_type('pg');
$plugins = \core_plugin_manager::instance()->get_plugins_of_type('paygw');
if (!array_key_exists($this->name, $plugins)) {
// Can not be enabled.
return;
Expand All @@ -123,10 +123,10 @@ public static function set_enabled_plugins($list) {
$list = explode(',', $list);
}
if ($list) {
$plugins = \core_plugin_manager::instance()->get_installed_plugins('pg');
$plugins = \core_plugin_manager::instance()->get_installed_plugins('paygw');
$list = array_intersect($list, array_keys($plugins));
}
set_config('pg_plugins_sortorder', join(',', $list));
set_config('paygw_plugins_sortorder', join(',', $list));
\core_plugin_manager::reset_caches();
}

Expand All @@ -136,7 +136,7 @@ public static function set_enabled_plugins($list) {
* @return string[] An array of the currency codes in the three-character ISO-4217 format
*/
public function get_supported_currencies(): array {
$classname = '\pg_'.$this->name.'\gateway';
$classname = '\paygw_'.$this->name.'\gateway';

return $classname::get_supported_currencies();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"theme": "theme",
"local": "local",
"h5plib": "h5p\/h5plib",
"pg": "payment\/gateway"
"paygw": "payment\/gateway"
},
"subsystems": {
"access": null,
Expand Down
6 changes: 3 additions & 3 deletions payment/accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
admin_externalpage_setup('paymentaccounts');
$PAGE->set_heading(get_string('paymentaccounts', 'payment'));

$enabledplugins = \core\plugininfo\pg::get_enabled_plugins();
$enabledplugins = \core\plugininfo\paygw::get_enabled_plugins();

echo $OUTPUT->header();

$accounts = \core_payment\helper::get_payment_accounts_to_manage(context_system::instance(), $showarchived);
$table = new html_table();
$table->head = [get_string('accountname', 'payment'), get_string('type_pg_plural', 'plugin'), ''];
$table->head = [get_string('accountname', 'payment'), get_string('type_paygw_plural', 'plugin'), ''];
$table->colclasses = ['', '', 'mdl-right'];
$table->data = [];
foreach ($accounts as $account) {
Expand Down Expand Up @@ -79,7 +79,7 @@
if (has_capability('moodle/site:config', context_system::instance())) {
// For administrators add a link to "Manage payment gateways" page.
$link = html_writer::link(new moodle_url('/admin/settings.php', ['section' => 'managepaymentgateways']),
get_string('type_pgmanage', 'plugin'));
get_string('type_paygwmanage', 'plugin'));
$text = get_string('gotomanageplugins', 'payment', $link);
echo html_writer::div($text, 'pb-2');
}
Expand Down
2 changes: 1 addition & 1 deletion payment/amd/build/gateways_modal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d7feb7

Please sign in to comment.