Commit e584e6ae authored by Damyon Wiese's avatar Damyon Wiese Committed by Dan Poltawski
Browse files

MDL-55071 theme/output: PHPCS fixes for new theme branch

Part of MDL-55071
parent e8272e74
......@@ -13,7 +13,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
// "themesettings" settingpage
$temp = new admin_settingpage('themesettings', new lang_string('themesettings', 'admin'));
$setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'),
new lang_string('configthemelist','admin'), '', PARAM_NOTAGS);
new lang_string('configthemelist', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'), new lang_string('configthemedesignermode', 'admin'), 0);
......
......@@ -107,7 +107,7 @@ class login implements renderable, templatable {
// Identity providers.
$identityproviders = [];
foreach($authsequence as $authname) {
foreach ($authsequence as $authname) {
$authplugin = get_auth_plugin($authname);
$identityproviders = array_merge($identityproviders, $authplugin->loginpage_idp_list($SESSION->wantsurl));
}
......
......@@ -58,7 +58,7 @@ class modchooser extends chooser {
$sections = [];
$context = context_course::instance($course->id);
// Activities
// Activities.
$activities = array_filter($modules, function($mod) {
return ($mod->archetype !== MOD_ARCHETYPE_RESOURCE && $mod->archetype !== MOD_ARCHETYPE_SYSTEM);
});
......
......@@ -411,7 +411,7 @@ class grade_edit_tree {
$tpldata = [
'id' => $item->id,
'itemname' => $itemname,
'value' => grade_edit_tree::format_number($item->aggregationcoef2 * 100.0),
'value' => self::format_number($item->aggregationcoef2 * 100.0),
'checked' => $item->weightoverride,
'disabled' => !$item->weightoverride
];
......
......@@ -4411,7 +4411,7 @@ class admin_settings_country_select extends admin_setting_configselect {
protected $includeall;
public function __construct($name, $visiblename, $description, $defaultsetting, $includeall=false) {
$this->includeall = $includeall;
parent::__construct($name, $visiblename, $description, $defaultsetting, NULL);
parent::__construct($name, $visiblename, $description, $defaultsetting, null);
}
/**
......@@ -4691,7 +4691,7 @@ class admin_setting_question_behaviour extends admin_setting_configselect {
* @param string $default default.
*/
public function __construct($name, $visiblename, $description, $default) {
parent::__construct($name, $visiblename, $description, $default, NULL);
parent::__construct($name, $visiblename, $description, $default, null);
}
/**
......@@ -9086,7 +9086,7 @@ class admin_setting_configcolourpicker extends admin_setting {
public function output_html($data, $query = '') {
global $PAGE, $OUTPUT;
$icon = new pix_icon('i/loading', get_string('loading', 'admin'), 'moodle', ['class'=>'loadingicon']);
$icon = new pix_icon('i/loading', get_string('loading', 'admin'), 'moodle', ['class' => 'loadingicon']);
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
......
......@@ -49,7 +49,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
/** @var MoodleQuickForm */
protected $_mform = null;
var $_renderedfromtemplate = false;
protected $_renderedfromtemplate = false;
/**
* constructor
......@@ -198,16 +198,16 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
return $context;
}
/**
* Accepts a renderer
*
* @param object An HTML_QuickForm_Renderer object
* @param bool Whether a group is required
* @param string An error message associated with a group
* @access public
* @return void
*/
function accept(&$renderer, $required = false, $error = null) {
/**
* Accepts a renderer
*
* @param object An HTML_QuickForm_Renderer object
* @param bool Whether a group is required
* @param string An error message associated with a group
* @access public
* @return void
*/
public function accept(&$renderer, $required = false, $error = null) {
$this->_createElementsIfNotExist();
$renderer->startGroup($this, $required, $error);
if (!$this->_renderedfromtemplate) {
......@@ -215,11 +215,11 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
$name = $this->getName();
foreach (array_keys($this->_elements) as $key) {
$element =& $this->_elements[$key];
$elementname = '';
if ($this->_appendName) {
$elementName = $element->getName();
if (isset($elementName)) {
$element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']');
$elementname = $element->getName();
if (isset($elementname)) {
$element->setName($name . '['. (strlen($elementname) ? $elementname : $key) .']');
} else {
$element->setName($name);
}
......@@ -229,9 +229,9 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
$element->accept($renderer, $required);
// restore the element's name
// Restore the element's name.
if ($this->_appendName) {
$element->setName($elementName);
$element->setName($elementname);
}
}
}
......
......@@ -112,7 +112,7 @@ class MoodleQuickForm_text extends HTML_QuickForm_text implements templatable {
*
* @return string
*/
function toHtml() {
public function toHtml() {
// Add the class at the last minute.
if ($this->get_force_ltr()) {
......
......@@ -97,7 +97,6 @@ class MoodleQuickForm_url extends HTML_QuickForm_text implements templatable {
*/
function toHtml(){
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
......@@ -121,23 +120,23 @@ class MoodleQuickForm_url extends HTML_QuickForm_text implements templatable {
return $str;
}
// print out file picker
// Print out file picker.
$str .= $this->getFilePickerHTML();
return $str;
}
function getFilePickerHTML() {
public function getFilePickerHTML() {
global $PAGE, $OUTPUT;
$str = '';
$client_id = uniqid();
$clientid = uniqid();
$args = new stdClass();
$args->accepted_types = '*';
$args->return_types = FILE_EXTERNAL;
$args->context = $PAGE->context;
$args->client_id = $client_id;
$args->client_id = $clientid;
$args->env = 'url';
$fp = new file_picker($args);
$options = $fp->options;
......@@ -145,7 +144,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text implements templatable {
if (count($options->repositories) > 0) {
$straddlink = get_string('choosealink', 'repository');
$str .= <<<EOD
<button id="filepicker-button-js-{$client_id}" class="visibleifjs btn btn-secondary">
<button id="filepicker-button-js-{$clientid}" class="visibleifjs btn btn-secondary">
$straddlink
</button>
EOD;
......
......@@ -2694,17 +2694,17 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
// switch next two lines for ol li containers for form items.
// $this->_elementTemplates=array('default'=>"\n\t\t".'<li class="fitem"><label>{label}{help}<!-- BEGIN required -->{req}<!-- END required --></label><div class="qfelement<!-- BEGIN error --> error<!-- END error --> {typeclass}"><!-- BEGIN error --><span class="error">{error}</span><br /><!-- END error -->{element}</div></li>');
$this->_elementTemplates = array(
'default'=>"\n\t\t".'<div id="{id}" class="fitem {advanced}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel} {class}" {aria-live}><div class="fitemtitle"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div><div class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
'default' => "\n\t\t".'<div id="{id}" class="fitem {advanced}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel} {class}" {aria-live}><div class="fitemtitle"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div><div class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
'actionbuttons'=>"\n\t\t".'<div id="{id}" class="fitem fitem_actionbuttons fitem_{typeclass} {class}"><div class="felement {typeclass}" data-fieldtype="{type}">{element}</div></div>',
'actionbuttons' => "\n\t\t".'<div id="{id}" class="fitem fitem_actionbuttons fitem_{typeclass} {class}"><div class="felement {typeclass}" data-fieldtype="{type}">{element}</div></div>',
'fieldset'=>"\n\t\t".'<div id="{id}" class="fitem {advanced} {class}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel}"><div class="fitemtitle"><div class="fgrouplabel"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div></div><fieldset class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</fieldset></div>',
'fieldset' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {class}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel}"><div class="fitemtitle"><div class="fgrouplabel"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div></div><fieldset class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</fieldset></div>',
'static'=>"\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}"><div class="fitemtitle"><div class="fstaticlabel">{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} {help}</div></div><div class="felement fstatic <!-- BEGIN error --> error<!-- END error -->" data-fieldtype="static"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
'static' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}"><div class="fitemtitle"><div class="fstaticlabel">{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} {help}</div></div><div class="felement fstatic <!-- BEGIN error --> error<!-- END error -->" data-fieldtype="static"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
'warning'=>"\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}">{element}</div>',
'warning' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}">{element}</div>',
'nodisplay'=>'');
'nodisplay' => '');
parent::__construct();
}
......@@ -2871,19 +2871,19 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
if (($this->_inGroup) and !empty($this->_groupElementTemplate)) {
// So it gets substitutions for *each* element.
$html = $this->_groupElementTemplate;
} else if (method_exists($element, 'getElementTemplateType')){
} else if (method_exists($element, 'getElementTemplateType')) {
$html = $this->_elementTemplates[$element->getElementTemplateType()];
} else {
$html = $this->_elementTemplates['default'];
}
if (isset($this->_advancedElements[$element->getName()])){
if (isset($this->_advancedElements[$element->getName()])) {
$html = str_replace(' {advanced}', ' advanced', $html);
$html = str_replace(' {aria-live}', ' aria-live="polite"', $html);
} else {
$html = str_replace(' {advanced}', '', $html);
$html = str_replace(' {aria-live}', '', $html);
}
if (isset($this->_advancedElements[$element->getName()]) || $element->getName() == 'mform_showadvanced'){
if (isset($this->_advancedElements[$element->getName()]) || $element->getName() == 'mform_showadvanced') {
$html = str_replace('{advancedimg}', $this->_advancedHTML, $html);
} else {
$html = str_replace('{advancedimg}', '', $html);
......
......@@ -780,7 +780,7 @@ class theme_config {
}
$url->set_slashargument($slashargs, 'noparam', true);
} else {
$params = array('theme' => $this->name,'rev' => $rev, 'type' => $filename);
$params = array('theme' => $this->name, 'rev' => $rev, 'type' => $filename);
if (!$svg) {
// We add an SVG param so that we know not to serve SVG images.
// We do this because all modern browsers support SVG and this param will one day be removed.
......
......@@ -70,7 +70,10 @@ class behat_action_menu extends behat_base {
throw new DriverException('Action menu steps are not available with Javascript disabled');
}
// Gets the node based on the requested selector type and locator.
$node = $this->get_node_in_container("link", $linkstring, "css_element", ".moodle-actionmenu [role=menu][aria-hidden=false]");
$node = $this->get_node_in_container("link",
$linkstring,
"css_element",
".moodle-actionmenu [role=menu][aria-hidden=false]");
$this->ensure_node_is_visible($node);
$node->click();
}
......
......@@ -613,4 +613,5 @@ class behat_hooks extends behat_base {
* @copyright 2016 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_stop_exception extends \Exception{}
class behat_stop_exception extends \Exception {
}
......@@ -83,7 +83,7 @@ class core_outputrequirementslib_testcase extends advanced_testcase {
$this->assertTrue($requirements->jquery_plugin('ui'));
// Get the code containing the required jquery plugins.
$renderer = $PAGE->get_renderer('core', NULL, RENDERER_TARGET_MAINTENANCE);
$renderer = $PAGE->get_renderer('core', null, RENDERER_TARGET_MAINTENANCE);
$requirecode = $requirements->get_top_of_body_code($renderer);
// Make sure that the generated code does not contain backslashes.
$this->assertFalse(strpos($requirecode, '\\'), "Output contains backslashes: " . $requirecode);
......
......@@ -536,7 +536,9 @@ function lesson_menu_block_contents($cmid, $lesson) {
return null;
}
$content = '<a href="#maincontent" class="accesshide">'.get_string('skip', 'lesson')."</a>\n<div class=\"menuwrapper\">\n<ul>\n";
$content = '<a href="#maincontent" class="accesshide">' .
get_string('skip', 'lesson') .
"</a>\n<div class=\"menuwrapper\">\n<ul>\n";
while ($pageid != 0) {
$page = $pages[$pageid];
......
......@@ -53,17 +53,17 @@ class qbank_chooser extends \core\output\chooser {
public function __construct($real, $fake, $course, $hiddenparams, $context) {
$sections = [];
$sections[] = new chooser_section('questions', new lang_string('questions', 'question'),
array_map(function($qtype) use ($context) {
return new qbank_chooser_item($qtype, $context);
}, $real));
array_map(function($qtype) use ($context) {
return new qbank_chooser_item($qtype, $context);
}, $real));
$sections[] = new chooser_section('other', new lang_string('other'),
array_map(function($qtype) use ($context) {
return new qbank_chooser_item($qtype, $context);
}, $fake));
array_map(function($qtype) use ($context) {
return new qbank_chooser_item($qtype, $context);
}, $fake));
parent::__construct(new moodle_url('/question/question.php'),
new lang_string('chooseqtypetoadd', 'question'), $sections, 'qtype');
new lang_string('chooseqtypetoadd', 'question'), $sections, 'qtype');
$this->set_instructions(new lang_string('selectaqtypefordescription', 'question'));
......
......@@ -126,7 +126,10 @@ class autoprefixer {
$newrule->setValue('-webkit-sticky');
$finalrules[] = $newrule;
} else if ($property === 'background-image' && $value instanceof CSSFUnction && $value->getName() === 'linear-gradient') {
} else if ($property === 'background-image' &&
$value instanceof CSSFunction &&
$value->getName() === 'linear-gradient') {
foreach (['-webkit-', '-o-'] as $prefix) {
$newfunction = clone $value;
$newfunction->setName($prefix . $value->getName());
......
......@@ -45,7 +45,7 @@ class course_renderer extends \core_course_renderer {
* @param string $format display format - 'plain' (default), 'short' or 'navbar'
* @return string
*/
function course_search_form($value = '', $format = 'plain') {
public function course_search_form($value = '', $format = 'plain') {
static $count = 0;
$formid = 'coursesearch';
if ((++$count) > 1) {
......
......@@ -18,10 +18,10 @@ namespace theme_boost\output\core;
use plugin_renderer_base;
require_once($CFG->dirroot . '/files/renderer.php');
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/files/renderer.php');
/**
* Rendering of files viewer related widgets.
* @package theme_boost
......@@ -120,7 +120,8 @@ class files_renderer extends \core_files_renderer {
}
/**
* FilePicker JS template for popup dialogue window asking for action when file with the same name already exists (multiple-file version).
* FilePicker JS template for popup dialogue window asking for action when file with the same name already exists
* (multiple-file version).
*
* @return string
*/
......
......@@ -30,8 +30,8 @@ require_once($CFG->libdir.'/clilib.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help', 'v'=>'variables', 'b'=>'bootswatch', 'p'=>'preset'));
list($options, $unrecognized) = cli_get_params(array('help' => false),
array('h' => 'help', 'v' => 'variables', 'b' => 'bootswatch', 'p' => 'preset'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
......@@ -49,8 +49,7 @@ if (!isset($options['preset'])) {
}
if ($options['help']) {
$help =
"Convert a Bootswatch file from Bootstrap 3 to a Moodle preset file compatible with bootstrap 4.
$help = "Convert a Bootswatch file from Bootstrap 3 to a Moodle preset file compatible with bootstrap 4.
This scripts takes the scss files from a Bootstrap 3 Bootswatch and produces a Moodle compatible preset file.
......@@ -140,7 +139,7 @@ $newrule = '$body-color: $text-color;';
$nextline = '//** Global textual link color.';
$workingvariables = str_replace_one($nextline, "$newrule\n\n$nextline", $workingvariables);
// Add a font-size-root the same as font-size-base;
// Add a font-size-root the same as font-size-base.
$newrule = '$font-size-root: $font-size-base;';
$nextline = '$font-size-large';
$workingvariables = str_replace_one($nextline, "$newrule\n\n$nextline", $workingvariables);
......
......@@ -142,8 +142,6 @@ $THEME->layouts = [
)
];
// $THEME->javascripts = array();
// $THEME->javascripts_footer = array();
$THEME->parents = [];
$THEME->enable_dock = false;
$THEME->csstreepostprocessor = 'theme_boost_css_tree_post_processor';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment