mambax7/extgallery

View on GitHub
assets/js/ml-slider/inc/slider/metaslider.class.php

Summary

Maintainability
C
1 day
Test Coverage

save accesses the super-global variable $_POST.
Open

    private function save()
    {
        if (!is_admin()) {
            return;
        }

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

save accesses the super-global variable $_POST.
Open

    private function save()
    {
        if (!is_admin()) {
            return;
        }

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

save accesses the super-global variable $_GET.
Open

    private function save()
    {
        if (!is_admin()) {
            return;
        }

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

save accesses the super-global variable $_POST.
Open

    private function save()
    {
        if (!is_admin()) {
            return;
        }

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

File metaslider.class.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Generic Slider super class. Extended by library specific classes.
 *
Severity: Minor
Found in assets/js/ml-slider/inc/slider/metaslider.class.php - About 4 hrs to fix

    The class MetaSlider has an overall complexity of 72 which is very high. The configured complexity threshold is 50.
    Open

    class MetaSlider
    {
        public $id         = 0; // slider ID
        public $identifier = 0; // unique identifier
        public $slides     = []; //slides belonging to this slider

    MetaSlider has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MetaSlider
    {
        public $id         = 0; // slider ID
        public $identifier = 0; // unique identifier
        public $slides     = []; //slides belonging to this slider
    Severity: Minor
    Found in assets/js/ml-slider/inc/slider/metaslider.class.php - About 2 hrs to fix

      Method get_default_parameters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_default_parameters()
          {
              $params = [
                  'type'           => 'flex',
                  'random'         => false,
      Severity: Minor
      Found in assets/js/ml-slider/inc/slider/metaslider.class.php - About 1 hr to fix

        Function get_javascript_parameters has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private function get_javascript_parameters()
            {
                $options = [];
        
                // construct an array of all parameters
        Severity: Minor
        Found in assets/js/ml-slider/inc/slider/metaslider.class.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function populate_slides has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function populate_slides()
            {
                $slides = [];
        
                $query = $this->get_slides();
        Severity: Minor
        Found in assets/js/ml-slider/inc/slider/metaslider.class.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function get_setting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get_setting($name)
            {
                if (!isset($this->settings[$name])) {
                    $defaults = $this->get_default_parameters();
        
        
        Severity: Minor
        Found in assets/js/ml-slider/inc/slider/metaslider.class.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '        ' . $this->get_html_after();

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '    <script type="text/javascript">';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '<!-- meta slider -->';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '    <div id="' . $this->get_container_id() . '">';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$pairs' which will lead to PHP notices.
        Open

                        $pairs[] = "{$key}: function($arg) {\n                " . implode("\n                ", $value) . "\n                }";

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '    </div>';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $slideshow = implode("\n", $html);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '        ' . $this->get_html();

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '</div>';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '<!--// meta slider-->';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '    ' . $this->get_inline_css();

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$pairs' which will lead to PHP notices.
        Open

                        $pairs[] = "{$key}:{$value}";

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '        ' . $this->get_inline_javascript();

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '<div style="' . $this->get_container_style() . '" class="' . $this->get_container_class() . '">';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$html' which will lead to PHP notices.
        Open

                $html[] = '    </script>';

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$pairs' which will lead to PHP notices.
        Open

                return implode(",\n                ", $pairs);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Missing class import via use statement (line '183', column '22').
        Open

                $query = new WP_Query($args);

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid using static access to class '\Xmf\Request' in method 'save'.
        Open

                if (\Xmf\Request::hasVar('deleteSlide', 'GET')) {

        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 '\Xmf\Request' in method 'save'.
        Open

                if (\Xmf\Request::hasVar('settings', 'POST')) {

        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 '\Xmf\Request' in method 'save'.
        Open

                if (\Xmf\Request::hasVar('attachment', 'POST')) {

        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

        The method get_javascript_parameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $pairs[] = "{$key}:{$value}";
                    }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class '\Xmf\Request' in method 'save'.
        Open

                if (\Xmf\Request::hasVar('title', 'POST')) {

        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

        The method get_javascript_parameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                        } else {
                            $options[$param] = '"' . $val . '"';
                        }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        The method get_setting uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    if (mb_strlen($this->settings[$name]) > 0) {
                        return $this->settings[$name];
                    }
                }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        The method populate_slides uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                        } else {
                            $slides[] = $return;
                        }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        The method update_settings uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $new_settings[$checkbox] = 'false';
                    }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Each class must be in a namespace of at least one level (a top-level vendor name)
        Open

        class MetaSlider

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

            public $id         = 0; // slider ID

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

            public function __construct($id, $shortcode_settings)

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        The parameter $new_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        The parameter $shortcode_settings is not named in camelCase.
        Open

            public function __construct($id, $shortcode_settings)
            {
                $this->id         = $id;
                $this->settings   = array_merge($shortcode_settings, $this->get_settings());
                $this->identifier = 'metaslider_' . $this->id;

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

                $id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        The parameter $slide_id is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        Method name "MetaSlider::enqueue_scripts" is not in camel caps format
        Open

            public function enqueue_scripts()

        Method name "MetaSlider::update_slides" is not in camel caps format
        Open

            private function update_slides($data)

        Method name "MetaSlider::get_html_after" is not in camel caps format
        Open

            private function get_html_after()

        Method name "MetaSlider::get_custom_javascript_after" is not in camel caps format
        Open

            private function get_custom_javascript_after()

        Method name "MetaSlider::get_container_id" is not in camel caps format
        Open

            private function get_container_id()

        Method name "MetaSlider::delete_slide" is not in camel caps format
        Open

            private function delete_slide($slide_id)

        Method name "MetaSlider::get_settings" is not in camel caps format
        Open

            private function get_settings()

        Method name "MetaSlider::get_slides" is not in camel caps format
        Open

            public function get_slides()

        Method name "MetaSlider::get_javascript_parameters" is not in camel caps format
        Open

            private function get_javascript_parameters()

        Method name "MetaSlider::get_default_parameters" is not in camel caps format
        Open

            public function get_default_parameters()

        Method name "MetaSlider::get_inline_css" is not in camel caps format
        Open

            private function get_inline_css()

        Method name "MetaSlider::update_settings" is not in camel caps format
        Open

            public function update_settings($new_settings)

        Method name "MetaSlider::get_inline_javascript" is not in camel caps format
        Open

            private function get_inline_javascript()

        Method name "MetaSlider::get_custom_javascript_before" is not in camel caps format
        Open

            private function get_custom_javascript_before()

        Method name "MetaSlider::get_container_class" is not in camel caps format
        Open

            private function get_container_class()

        Method name "MetaSlider::get_setting" is not in camel caps format
        Open

            public function get_setting($name)

        Method name "MetaSlider::update_title" is not in camel caps format
        Open

            private function update_title($title)

        Method name "MetaSlider::render_public_slides" is not in camel caps format
        Open

            public function render_public_slides()

        Method name "MetaSlider::populate_slides" is not in camel caps format
        Open

            private function populate_slides()

        Method name "MetaSlider::get_container_style" is not in camel caps format
        Open

            private function get_container_style()

        Method name "MetaSlider::get_identifier" is not in camel caps format
        Open

            protected function get_identifier()

        Method name "MetaSlider::render_admin_slides" is not in camel caps format
        Open

            public function render_admin_slides()

        Line exceeds 120 characters; contains 184 characters
        Open

                $checkboxes = ['noConflict', 'fullWidth', 'hoverPause', 'links', 'reverse', 'random', 'printCss', 'printJs', 'smoothHeight', 'center', 'smartCrop', 'carouselMode', 'autoPlay'];

        Line exceeds 120 characters; contains 223 characters
        Open

                $script .= "\n            var slider = !window.jQuery ? window.setTimeout(timer_{$this->identifier}, 100) : !jQuery.isReady ? window.setTimeout(timer_{$this->identifier}, 100) : {$this->identifier}(window.jQuery);";

        Line exceeds 120 characters; contains 133 characters
        Open

                if (is_array($settings) && isset($settings['type']) && in_array($settings['type'], ['flex', 'coin', 'nivo', 'responsive'])) {

        Line exceeds 120 characters; contains 151 characters
        Open

                if (('true' === $this->get_setting('carouselMode') || 'true' === $this->get_setting('fullWidth')) && ('coin' !== $this->get_setting('type'))) {

        Line exceeds 120 characters; contains 158 characters
        Open

                    wp_enqueue_script('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->js_path, ['jquery'], METASLIDER_VERSION);

        Line exceeds 120 characters; contains 153 characters
        Open

                    wp_enqueue_style('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->css_path, false, METASLIDER_VERSION);

        Line exceeds 120 characters; contains 136 characters
        Open

                        $pairs[] = "{$key}: function($arg) {\n                " . implode("\n                ", $value) . "\n                }";

        Line exceeds 120 characters; contains 126 characters
        Open

                    wp_enqueue_style('metaslider-public', METASLIDER_ASSETS_URL . 'metaslider/public.css', false, METASLIDER_VERSION);

        The variable $custom_js is not named in camelCase.
        Open

            private function get_custom_javascript_after()
            {
                $type = $this->get_setting('type');
        
                $custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $old_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js is not named in camelCase.
        Open

            private function get_custom_javascript_after()
            {
                $type = $this->get_setting('type');
        
                $custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $old_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $slide_id is not named in camelCase.
        Open

            private function update_slides($data)
            {
                foreach ($data as $slide_id => $fields) {
                    do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js_before is not named in camelCase.
        Open

            private function get_inline_javascript()
            {
                $custom_js_before = $this->get_custom_javascript_before();
                $custom_js_after  = $this->get_custom_javascript_after();
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js is not named in camelCase.
        Open

            private function get_custom_javascript_before()
            {
                $type = $this->get_setting('type');
        
                $javascript = '';

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $current_terms is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $current_terms is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $current_term is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $container_id is not named in camelCase.
        Open

            private function get_container_id()
            {
                $container_id = 'metaslider_container_' . $this->id;
        
                $id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $shortcode_settings is not named in camelCase.
        Open

            public function __construct($id, $shortcode_settings)
            {
                $this->id         = $id;
                $this->settings   = array_merge($shortcode_settings, $this->get_settings());
                $this->identifier = 'metaslider_' . $this->id;

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_terms is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $current_term is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js is not named in camelCase.
        Open

            private function get_custom_javascript_before()
            {
                $type = $this->get_setting('type');
        
                $javascript = '';

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $current_term is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js_before is not named in camelCase.
        Open

            private function get_inline_javascript()
            {
                $custom_js_before = $this->get_custom_javascript_before();
                $custom_js_after  = $this->get_custom_javascript_after();
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js_after is not named in camelCase.
        Open

            private function get_inline_javascript()
            {
                $custom_js_before = $this->get_custom_javascript_before();
                $custom_js_after  = $this->get_custom_javascript_after();
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $container_id is not named in camelCase.
        Open

            private function get_container_id()
            {
                $container_id = 'metaslider_container_' . $this->id;
        
                $id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js_after is not named in camelCase.
        Open

            private function get_inline_javascript()
            {
                $custom_js_before = $this->get_custom_javascript_before();
                $custom_js_after  = $this->get_custom_javascript_after();
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_terms is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $slide_id is not named in camelCase.
        Open

            private function update_slides($data)
            {
                foreach ($data as $slide_id => $fields) {
                    do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js is not named in camelCase.
        Open

            private function get_custom_javascript_before()
            {
                $type = $this->get_setting('type');
        
                $javascript = '';

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $custom_js is not named in camelCase.
        Open

            private function get_custom_javascript_after()
            {
                $type = $this->get_setting('type');
        
                $custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $slide_id is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_terms is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $slide_id is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The method get_setting is not named in camelCase.
        Open

            public function get_setting($name)
            {
                if (!isset($this->settings[$name])) {
                    $defaults = $this->get_default_parameters();
        
        

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method populate_slides is not named in camelCase.
        Open

            private function populate_slides()
            {
                $slides = [];
        
                $query = $this->get_slides();

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method render_public_slides is not named in camelCase.
        Open

            public function render_public_slides()
            {
                $html[] = '<!-- meta slider -->';
                $html[] = '<div style="' . $this->get_container_style() . '" class="' . $this->get_container_class() . '">';
                $html[] = '    ' . $this->get_inline_css();

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_html_after is not named in camelCase.
        Open

            private function get_html_after()
            {
                $type = $this->get_setting('type');
        
                $html = apply_filters("metaslider_{$type}_slider_html_after", '', $this->id, $this->settings);

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_custom_javascript_after is not named in camelCase.
        Open

            private function get_custom_javascript_after()
            {
                $type = $this->get_setting('type');
        
                $custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method delete_slide is not named in camelCase.
        Open

            private function delete_slide($slide_id)
            {
                // Get the existing terms and only keep the ones we don't want removed
                $new_terms     = [];
                $current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method update_slides is not named in camelCase.
        Open

            private function update_slides($data)
            {
                foreach ($data as $slide_id => $fields) {
                    do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
                }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_settings is not named in camelCase.
        Open

            private function get_settings()
            {
                $settings = get_post_meta($this->id, 'ml-slider_settings', true);
        
                if (is_array($settings) && isset($settings['type']) && in_array($settings['type'], ['flex', 'coin', 'nivo', 'responsive'])) {

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_default_parameters is not named in camelCase.
        Open

            public function get_default_parameters()
            {
                $params = [
                    'type'           => 'flex',
                    'random'         => false,

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_slides is not named in camelCase.
        Open

            public function get_slides()
            {
                $args = [
                    'force_no_custom_order' => true,
                    'orderby'               => 'menu_order',

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_javascript_parameters is not named in camelCase.
        Open

            private function get_javascript_parameters()
            {
                $options = [];
        
                // construct an array of all parameters

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_container_style is not named in camelCase.
        Open

            private function get_container_style()
            {
                // default
                $style = "max-width: {$this->get_setting('width')}px;";
        
        

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_inline_javascript is not named in camelCase.
        Open

            private function get_inline_javascript()
            {
                $custom_js_before = $this->get_custom_javascript_before();
                $custom_js_after  = $this->get_custom_javascript_after();
        
        

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_custom_javascript_before is not named in camelCase.
        Open

            private function get_custom_javascript_before()
            {
                $type = $this->get_setting('type');
        
                $javascript = '';

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_container_class is not named in camelCase.
        Open

            private function get_container_class()
            {
                $class = "metaslider metaslider-{$this->get_setting('type')} metaslider-{$this->id} ml-slider";
        
                // apply the css class setting

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_identifier is not named in camelCase.
        Open

            protected function get_identifier()
            {
                return $this->identifier;
            }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method render_admin_slides is not named in camelCase.
        Open

            public function render_admin_slides()
            {
                foreach ($this->slides as $slide) {
                    echo $slide;
                }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method update_settings is not named in camelCase.
        Open

            public function update_settings($new_settings)
            {
                $old_settings = $this->get_settings();
        
                // convert submitted checkbox values from 'on' or 'off' to boolean values

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_inline_css is not named in camelCase.
        Open

            private function get_inline_css()
            {
                $css = apply_filters('metaslider_css', '', $this->settings, $this->id);
        
                // use this to add the scoped attribute for HTML5 validation (if needed)

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method enqueue_scripts is not named in camelCase.
        Open

            public function enqueue_scripts()
            {
                if ('true' === $this->get_setting('printJs')) {
                    wp_enqueue_script('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->js_path, ['jquery'], METASLIDER_VERSION);
                }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method update_title is not named in camelCase.
        Open

            private function update_title($title)
            {
                $slide = [
                    'ID'         => $this->id,
                    'post_title' => $title,

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method get_container_id is not named in camelCase.
        Open

            private function get_container_id()
            {
                $container_id = 'metaslider_container_' . $this->id;
        
                $id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        There are no issues that match your filters.

        Category
        Status