Skip to content

Commit

Permalink
Better use of namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Oct 21, 2024
1 parent 672460b commit b5594eb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
6 changes: 4 additions & 2 deletions classes/admin_setting_highlight.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace filter_synhi;

use stdClass;

/**
* SynHi admin_setting_highlight based on admin_setting_description by Amaia Anabitarte.
*
Expand Down Expand Up @@ -85,11 +87,11 @@ public function write_setting($data) {
public function output_html($data, $query = '') {
global $OUTPUT;

$context = new \stdClass();
$context = new stdClass();
$context->title = $this->visiblename;
$context->description = $this->description;

$toolbox = \filter_synhi\toolbox::get_instance();
$toolbox = toolbox::get_instance();
$highlightcontext = $toolbox->setting_highlight();
if (!empty($highlightcontext)) {
if (empty($highlightcontext->broken)) {
Expand Down
6 changes: 4 additions & 2 deletions classes/admin_setting_information.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace filter_synhi;

use core_plugin_manager;

/**
* Setting that displays information. Based on admin_setting_description in adminlib.php.
*
Expand Down Expand Up @@ -97,11 +99,11 @@ public function write_setting($data) {
public function output_html($data, $query = '') {
global $CFG, $OUTPUT;

$filter = \core_plugin_manager::instance()->get_present_plugins('filter');
$filter = core_plugin_manager::instance()->get_present_plugins('filter');
if (!empty($filter['synhi'])) {
$plugininfo = $filter['synhi'];
} else {
$plugininfo = \core_plugin_manager::instance()->get_plugin_info('filter_synhi');
$plugininfo = core_plugin_manager::instance()->get_plugin_info('filter_synhi');
$plugininfo->version = $plugininfo->versiondisk;
}

Expand Down
4 changes: 3 additions & 1 deletion classes/admin_setting_markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace filter_synhi;

use moodle_url;

/**
* Setting that displays markdown files. Based on admin_setting_description in adminlib.php.
*
Expand Down Expand Up @@ -143,7 +145,7 @@ private function markdown_to_html($markdown) {
if ($url[0] == '/') {
$hasslash = '';
}
$murl = new \moodle_url('/' . $this->pluginpath . $hasslash . $url);
$murl = new moodle_url('/' . $this->pluginpath . $hasslash . $url);
$url = $murl->out(true);
}
return $url;
Expand Down
3 changes: 2 additions & 1 deletion classes/output/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
use filter_synhi\toolbox;

/**
* SynHi filter.
Expand Down Expand Up @@ -57,7 +58,7 @@ public static function setting_highlight_example($engine, $style) {
]
);

$toolbox = \filter_synhi\toolbox::get_instance();
$toolbox = toolbox::get_instance();
$markup = $toolbox->setting_highlight_example($engine, $style);

$result = ['markup' => $markup];
Expand Down
6 changes: 4 additions & 2 deletions classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace filter_synhi;

/**
* SynHi filter.
*
Expand All @@ -25,6 +23,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace filter_synhi;

use stdClass;

/**
* SynHi filter.
*
Expand Down

0 comments on commit b5594eb

Please sign in to comment.