diff --git a/main/inc/lib/plugin.class.php b/main/inc/lib/plugin.class.php index d7a712462d..0b509ad622 100755 --- a/main/inc/lib/plugin.class.php +++ b/main/inc/lib/plugin.class.php @@ -857,7 +857,8 @@ class Plugin /** * Returns true if the plugin is installed, false otherwise. * - * @param bool $checkEnabled Also check if enabled (instead of only installed) + * @param bool $checkEnabled Also check if enabled (instead of only installed) + * * @return bool True if plugin is installed/enabled, false otherwise */ public function isEnabled($checkEnabled = false) @@ -880,8 +881,8 @@ class Plugin [ "variable = ? AND subkey = ? AND category = 'Plugins' " => [ $this->get_name().'_tool_enable', - $this->get_name() - ] + $this->get_name(), + ], ] ); if (is_array($enabled) && isset($enabled['selected_value']) && $enabled['selected_value'] == 'false') { @@ -890,6 +891,7 @@ class Plugin return false; } } + return true; } diff --git a/plugin/buycourses/src/buy_course_plugin.class.php b/plugin/buycourses/src/buy_course_plugin.class.php index a21b00db19..40be0e052b 100644 --- a/plugin/buycourses/src/buy_course_plugin.class.php +++ b/plugin/buycourses/src/buy_course_plugin.class.php @@ -107,7 +107,8 @@ class BuyCoursesPlugin extends Plugin /** * Check if plugin is enabled. * - * @param bool $checkEnabled Check if, additionnally to being installed, the plugin is enabled + * @param bool $checkEnabled Check if, additionnally to being installed, the plugin is enabled + * * @return bool */ public function isEnabled($checkEnabled = false) diff --git a/plugin/mindmap/ajax/mindmap.ajax.php b/plugin/mindmap/ajax/mindmap.ajax.php index cc396d0d53..0f23e4094e 100644 --- a/plugin/mindmap/ajax/mindmap.ajax.php +++ b/plugin/mindmap/ajax/mindmap.ajax.php @@ -1,7 +1,9 @@ $dataMap + 'mindmap_data' => $dataMap, ]; $whereConditions = [ 'id = ?' => $idMM, 'AND (user_id = ?' => $user['id'], - 'OR is_shared = 1)' + 'OR is_shared = 1)', ]; $isAdmin = api_is_platform_admin(); if ($user['status'] == SESSIONADMIN || $user['status'] == PLATFORM_ADMIN || $isAdmin) { $whereConditions = [ - 'id = ?' => $idMM + 'id = ?' => $idMM, ]; } $resultUp = Database::update($table, $params, $whereConditions); echo 'OK'; - } else { echo 'KO'; } diff --git a/plugin/mindmap/edit-mindmap/index.php b/plugin/mindmap/edit-mindmap/index.php index db4e91d0f9..2725cca790 100644 --- a/plugin/mindmap/edit-mindmap/index.php +++ b/plugin/mindmap/edit-mindmap/index.php @@ -42,7 +42,6 @@ } echo 'titleMM = "'.$titleMM.'";'; } - } ?> diff --git a/plugin/mindmap/inc/action.switch.php b/plugin/mindmap/inc/action.switch.php index 680f94e022..7a5de47623 100644 --- a/plugin/mindmap/inc/action.switch.php +++ b/plugin/mindmap/inc/action.switch.php @@ -1,4 +1,5 @@ (empty($values['is_shared']) ? 0 : (int) $values['is_shared']), 'c_id' => $cid, 'url_id' => $urlId, - 'session_id' => $sessionId + 'session_id' => $sessionId, ]; $result = Database::insert($plugin->table, $params); @@ -39,7 +40,7 @@ switch ($action) { 'title' => $values['title'], 'description' => $values['description'], 'is_public' => $values['is_public'], - 'is_shared' => $values['is_shared'] + 'is_shared' => $values['is_shared'], ]; Database::update($plugin->table, $params, ['id = ?' => $id]); Display::addFlash(Display::return_message(get_lang('Updated'))); diff --git a/plugin/mindmap/inc/edit.form.php b/plugin/mindmap/inc/edit.form.php index 24d92f11c5..8c58798a64 100644 --- a/plugin/mindmap/inc/edit.form.php +++ b/plugin/mindmap/inc/edit.form.php @@ -1,7 +1,7 @@ addText('title', get_lang('Title'), true); $form->addText('description', get_lang('Description'), false); @@ -20,9 +19,7 @@ if ($action == 'add' || $action == 'edit') { $form->addElement('hidden', 'mindmap_type', 'mind'); $form->addButtonSave(get_lang('Save')); - } else { - $ht = '

'.htmlentities(get_lang('Save')).'

'; $form->addElement('static', '', '', $ht); } diff --git a/plugin/mindmap/install.php b/plugin/mindmap/install.php index 220f23b3e7..b3d6bedfed 100644 --- a/plugin/mindmap/install.php +++ b/plugin/mindmap/install.php @@ -1,9 +1,9 @@ isEnabled(true)) { api_not_allowed(true); exit; } else { - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : ''; $cid = 0; if (!empty($_GET['cidReq'])) { $cid = api_get_course_int_id($_GET['cidReq']); } else { - $cid = isset($_GET['cid']) ? (int)$_GET['cid'] : 0; + $cid = isset($_GET['cid']) ? (int) $_GET['cid'] : 0; } if (!empty($_GET['id_session'])) { - $sessionId = (int)$_GET['id_session']; + $sessionId = (int) $_GET['id_session']; } else { - $sessionId = isset($_GET['sid']) ? (int)$_GET['sid'] : 0; + $sessionId = isset($_GET['sid']) ? (int) $_GET['sid'] : 0; } if ($cid == 0) { @@ -90,7 +90,7 @@ if (!$plugin->isEnabled(true)) { } } // Show create/edit form - include('inc/edit.form.php'); + include 'inc/edit.form.php'; $htmlHeadXtra[] = ''; @@ -114,7 +114,7 @@ if (!$plugin->isEnabled(true)) { // Process actions (add/edit/delete) // Also exit and redirect to list if action successful - include('inc/action.switch.php'); + include 'inc/action.switch.php'; } $addButton = Display::url( diff --git a/plugin/mindmap/mindmap_plugin.class.php b/plugin/mindmap/mindmap_plugin.class.php index 125665f778..91571c11a7 100644 --- a/plugin/mindmap/mindmap_plugin.class.php +++ b/plugin/mindmap/mindmap_plugin.class.php @@ -3,7 +3,7 @@ /** * Class MindmapPlugin - * This class defines the course plugin "MindMap", storing its data in the plugin_mindmap table + * This class defines the course plugin "MindMap", storing its data in the plugin_mindmap table. */ class MindmapPlugin extends Plugin { @@ -22,21 +22,22 @@ class MindmapPlugin extends Plugin 'tool_enable' => 'boolean', ] ); - } /** - * Create instance of a Mindmap plugin object + * Create instance of a Mindmap plugin object. + * * @return MindmapPlugin|null */ public static function create() { static $result = null; + return $result ? $result : $result = new self(); } /** - * Install the table structure + * Install the table structure. */ public function install() { @@ -78,7 +79,7 @@ class MindmapPlugin extends Plugin } // Deleting course settings and course home icons $this->uninstall_course_fields_in_all_courses(); - error_log('dropping c_tool'); + $p2 = api_get_path(SYS_PATH).'main/img/icons/64/mindmap.png'; if (file_exists($p2) && is_writable($p2)) { unlink($p2); diff --git a/plugin/whispeakauth/WhispeakAuthPlugin.php b/plugin/whispeakauth/WhispeakAuthPlugin.php index 5365cc23b2..7da445dfb1 100644 --- a/plugin/whispeakauth/WhispeakAuthPlugin.php +++ b/plugin/whispeakauth/WhispeakAuthPlugin.php @@ -407,7 +407,8 @@ class WhispeakAuthPlugin extends Plugin implements HookPluginInterface /** * Check if the WhispeakAuth plugin is installed and enabled. * - * @param bool $checkEnabled Check if, additionnally to being installed, the plugin is enabled + * @param bool $checkEnabled Check if, additionnally to being installed, the plugin is enabled + * * @return bool */ public function isEnabled($checkEnabled = false)