disableNotifications accesses the super-global variable $_GET. Open
private function disableNotifications()
{
if (isset($_GET['disable']) && in_array($_GET['disable'], array('concurrent', 'language'))) {
update_option('codecolorer_' . $_GET['disable'] . '_notification', false);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
disableNotifications accesses the super-global variable $_GET. Open
private function disableNotifications()
{
if (isset($_GET['disable']) && in_array($_GET['disable'], array('concurrent', 'language'))) {
update_option('codecolorer_' . $_GET['disable'] . '_notification', false);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
disableNotifications accesses the super-global variable $_GET. Open
private function disableNotifications()
{
if (isset($_GET['disable']) && in_array($_GET['disable'], array('concurrent', 'language'))) {
update_option('codecolorer_' . $_GET['disable'] . '_notification', false);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Method show
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show()
{
?>
<div class="wrap">
The method show() has 125 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function show()
{
?>
<div class="wrap">
- Exclude checks
Avoid using static access to class 'CodeColorerOptions' in method 'showLanguageWarning'. Open
if (!in_array($locale, CodeColorerOptions::getLanguages())) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'CodeColorerOptions' in method 'showThemeSelectOptions'. Open
foreach (CodeColorerOptions::getThemes() as $theme => $description) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Reference to undeclared property \CodeColorerAdmin->codecolorer
Open
$this->codecolorer->showWarning('language', __('CodeColorer translation is incomplete.', 'codecolorer'), sprintf($msgFormat, $locale, "https://kpumuk.info/projects/wordpress-plugins/codecolorer/#translation"));
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<h2>CodeColorer: <?php _e('Code Highlighting Options', 'codecolorer') ?></h2>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_width"><?php _e('Width', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \esc_html()
Open
<input name="codecolorer_height" type="number" class="small-text" size="60" id="codecolorer_height" value="<?php echo esc_html(get_option('codecolorer_height')) ?>"/>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_inline_theme"><?php _e('Inline Theme', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \__()
(Did you mean _()) Open
$msgFormat = __('Your current locale is %1$s, and CodeColorer has incomplete or does not have a translation into your language. It would be great, if you have a time to <a href="%2$s">help us to translate</a> it.', 'codecolorer');
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('When code has more than "Lines to Scroll" lines, block height will be set to this value.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('Indicating how many spaces would represent TAB symbol.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_theme"><?php _e('Theme', 'codecolorer') ?>:</label></th>
- Exclude checks
Reference to undeclared property \CodeColorerAdmin->codecolorer
(Did you mean $codecolorer) Open
$this->codecolorer = $codecolorer;
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_lines_to_scroll"><?php _e('Lines to scroll', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_rss_width"><?php _e('Width in RSS', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \esc_html()
Open
<input name="codecolorer_tab_size" type="number" class="small-text" size="60" id="codecolorer_tab_size" value="<?php echo esc_html(get_option('codecolorer_tab_size')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
if (!get_option('codecolorer_language_notification')) {
- Exclude checks
Call to undeclared function \settings_fields()
Open
<?php settings_fields('codecolorer') ?>
- Exclude checks
Call to undeclared function \checked()
Open
<input name="codecolorer_line_numbers" type="checkbox" id="codecolorer_line_numbers" value="1" <?php checked(true, get_option('codecolorer_line_numbers')); ?> />
- Exclude checks
Call to undeclared function \esc_html()
Open
<textarea name="codecolorer_css_style" id="codecolorer_css_style" class="large-text code" rows="10" cols="60"><?php echo esc_html(get_option('codecolorer_css_style')) ?></textarea><br />
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('Default code block width. Integer means pixels, also you can specify <tt>em</tt> or <tt>%</tt> suffix. Could be omitted to use whole width.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_height"><?php _e('Height', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \get_option()
Open
<?php $this->showThemeSelectOptions(get_option('codecolorer_inline_theme')) ?>
- Exclude checks
Call to undeclared function \esc_html()
Open
<input name="codecolorer_css_class" type="text" class="regular-text code" size="60" id="codecolorer_css_class" value="<?php echo esc_html(get_option('codecolorer_css_class')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
<?php $this->showThemeSelectOptions(get_option('codecolorer_theme')) ?>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('Default color scheme.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('Default color scheme for inline code blocks.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_css_style"><?php _e('Custom CSS Styles', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \get_locale()
(Did you mean \setlocale()) Open
$locale = get_locale();
- Exclude checks
Call to undeclared function \get_option()
Open
<textarea name="codecolorer_css_style" id="codecolorer_css_style" class="large-text code" rows="10" cols="60"><?php echo esc_html(get_option('codecolorer_css_style')) ?></textarea><br />
- Exclude checks
Call to undeclared function \esc_html()
Open
<input name="codecolorer_width" type="string" class="small-text" size="60" id="codecolorer_width" value="<?php echo esc_html(get_option('codecolorer_width')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_width" type="string" class="small-text" size="60" id="codecolorer_width" value="<?php echo esc_html(get_option('codecolorer_width')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_height" type="number" class="small-text" size="60" id="codecolorer_height" value="<?php echo esc_html(get_option('codecolorer_height')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_disable_keyword_linking" type="checkbox" id="codecolorer_disable_keyword_linking" value="1" <?php checked(true, get_option('codecolorer_disable_keyword_linking')); ?> />
- Exclude checks
Call to undeclared function \esc_html()
Open
<input name="codecolorer_lines_to_scroll" type="number" class="small-text" size="60" id="codecolorer_lines_to_scroll" value="<?php echo esc_html(get_option('codecolorer_lines_to_scroll')) ?>"/>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<h3><?php _e('Preview', 'codecolorer') ?></h3>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<input type="submit" class="button-primary" name="Submit" value="<?php _e('Save Options', 'codecolorer') ?> »" />
- Exclude checks
Call to undeclared function \update_option()
Open
update_option('codecolorer_' . $_GET['disable'] . '_notification', false);
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><?php _e('Formatting', 'codecolorer') ?>:</th>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('These custom CSS rules will be appended to the CodeColorer default CSS file.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_lines_to_scroll" type="number" class="small-text" size="60" id="codecolorer_lines_to_scroll" value="<?php echo esc_html(get_option('codecolorer_lines_to_scroll')) ?>"/>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('If your code lines number is less than this value, block height would not be fixed. Set to <b>-1</b> to remove vertical scroll.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \esc_html()
Open
<input name="codecolorer_rss_width" type="number" class="small-text" size="60" id="codecolorer_rss_width" value="<?php echo esc_html(get_option('codecolorer_rss_width')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_rss_width" type="number" class="small-text" size="60" id="codecolorer_rss_width" value="<?php echo esc_html(get_option('codecolorer_rss_width')) ?>"/>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_tab_size"><?php _e('Tab size', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<?php _e('Disable keyword linking', 'codecolorer') ?>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_css_class" type="text" class="regular-text code" size="60" id="codecolorer_css_class" value="<?php echo esc_html(get_option('codecolorer_css_class')) ?>"/>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_line_numbers" type="checkbox" id="codecolorer_line_numbers" value="1" <?php checked(true, get_option('codecolorer_line_numbers')); ?> />
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_css_class"><?php _e('Custom CSS Classes', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<?php _e('Show line numbers', 'codecolorer') ?>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<th scope="row"><label for="codecolorer_css_style"><?php _e('Code Example', 'codecolorer') ?>:</label></th>
- Exclude checks
Call to undeclared function \__()
(Did you mean _()) Open
$this->codecolorer->showWarning('language', __('CodeColorer translation is incomplete.', 'codecolorer'), sprintf($msgFormat, $locale, "https://kpumuk.info/projects/wordpress-plugins/codecolorer/#translation"));
- Exclude checks
Call to undeclared function \screen_icon()
Open
<?php screen_icon(); ?>
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('Default code block width in RSS. See Width option description.', 'codecolorer') ?></p>
- Exclude checks
Call to undeclared function \get_option()
Open
<input name="codecolorer_tab_size" type="number" class="small-text" size="60" id="codecolorer_tab_size" value="<?php echo esc_html(get_option('codecolorer_tab_size')) ?>"/>
- Exclude checks
Call to undeclared function \checked()
Open
<input name="codecolorer_disable_keyword_linking" type="checkbox" id="codecolorer_disable_keyword_linking" value="1" <?php checked(true, get_option('codecolorer_disable_keyword_linking')); ?> />
- Exclude checks
Call to undeclared function \_e()
(Did you mean _()) Open
<p class="description"><?php _e('These custom CSS classes will be appended to the wrapper HTML element.', 'codecolorer') ?></p>
- Exclude checks
Reference to undeclared property \CodeColorerAdmin->codecolorer
Open
<?php echo $this->codecolorer->getSampleCodeHighlighted(); ?>
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class CodeColorerAdmin
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
<th scope="row"><label for="codecolorer_lines_to_scroll"><?php _e('Lines to scroll', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 200 characters Open
<input name="codecolorer_tab_size" type="number" class="small-text" size="60" id="codecolorer_tab_size" value="<?php echo esc_html(get_option('codecolorer_tab_size')) ?>"/>
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
<th scope="row"><label for="codecolorer_inline_theme"><?php _e('Inline Theme', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
<input type="submit" class="button-primary" name="Submit" value="<?php _e('Save Options', 'codecolorer') ?> »" />
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
<p class="description"><?php _e('Default code block width in RSS. See Width option description.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
<p class="description"><?php _e('Default color scheme for inline code blocks.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
<th scope="row"><label for="codecolorer_css_style"><?php _e('Code Example', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 242 characters Open
$msgFormat = __('Your current locale is %1$s, and CodeColorer has incomplete or does not have a translation into your language. It would be great, if you have a time to <a href="%2$s">help us to translate</a> it.', 'codecolorer');
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
<p class="description"><?php _e('These custom CSS classes will be appended to the wrapper HTML element.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 212 characters Open
<p class="description"><?php _e('If your code lines number is less than this value, block height would not be fixed. Set to <b>-1</b> to remove vertical scroll.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 191 characters Open
<input name="codecolorer_width" type="string" class="small-text" size="60" id="codecolorer_width" value="<?php echo esc_html(get_option('codecolorer_width')) ?>"/>
- Exclude checks
Line exceeds 120 characters; contains 226 characters Open
<input name="codecolorer_disable_keyword_linking" type="checkbox" id="codecolorer_disable_keyword_linking" value="1" <?php checked(true, get_option('codecolorer_disable_keyword_linking')); ?> />
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
<th scope="row"><label for="codecolorer_css_style"><?php _e('Custom CSS Styles', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 208 characters Open
<input name="codecolorer_css_class" type="text" class="regular-text code" size="60" id="codecolorer_css_class" value="<?php echo esc_html(get_option('codecolorer_css_class')) ?>"/>
- Exclude checks
Line exceeds 120 characters; contains 224 characters Open
<p class="description"><?php _e('Default code block width. Integer means pixels, also you can specify <tt>em</tt> or <tt>%</tt> suffix. Could be omitted to use whole width.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 194 characters Open
<input name="codecolorer_height" type="number" class="small-text" size="60" id="codecolorer_height" value="<?php echo esc_html(get_option('codecolorer_height')) ?>"/>
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
<p class="description"><?php _e('These custom CSS rules will be appended to the CodeColorer default CSS file.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 193 characters Open
<input name="codecolorer_line_numbers" type="checkbox" id="codecolorer_line_numbers" value="1" <?php checked(true, get_option('codecolorer_line_numbers')); ?> />
- Exclude checks
Line exceeds 120 characters; contains 222 characters Open
$this->codecolorer->showWarning('language', __('CodeColorer translation is incomplete.', 'codecolorer'), sprintf($msgFormat, $locale, "https://kpumuk.info/projects/wordpress-plugins/codecolorer/#translation"));
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
<th scope="row"><label for="codecolorer_height"><?php _e('Height', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 183 characters Open
<p class="description"><?php _e('When code has more than "Lines to Scroll" lines, block height will be set to this value.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 221 characters Open
<input name="codecolorer_lines_to_scroll" type="number" class="small-text" size="60" id="codecolorer_lines_to_scroll" value="<?php echo esc_html(get_option('codecolorer_lines_to_scroll')) ?>"/>
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
<p class="description"><?php _e('Indicating how many spaces would represent TAB symbol.', 'codecolorer') ?></p>
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
<th scope="row"><label for="codecolorer_css_class"><?php _e('Custom CSS Classes', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 214 characters Open
<textarea name="codecolorer_css_style" id="codecolorer_css_style" class="large-text code" rows="10" cols="60"><?php echo esc_html(get_option('codecolorer_css_style')) ?></textarea><br />
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
<th scope="row"><label for="codecolorer_rss_width"><?php _e('Width in RSS', 'codecolorer') ?>:</label></th>
- Exclude checks
Line exceeds 120 characters; contains 203 characters Open
<input name="codecolorer_rss_width" type="number" class="small-text" size="60" id="codecolorer_rss_width" value="<?php echo esc_html(get_option('codecolorer_rss_width')) ?>"/>
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
<th scope="row"><label for="codecolorer_tab_size"><?php _e('Tab size', 'codecolorer') ?>:</label></th>
- Exclude checks