| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Core\Base; |
| 4 | 4 | |
| 5 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | - exit; // Exit if accessed directly. | |
| 6 | + exit; // Exit if accessed directly | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Base Object |
| @@ -66,9 +66,8 @@ | ||
| 66 | 66 | /** |
| 67 | 67 | * Delete setting. |
| 68 | 68 | * |
| 69 | 69 | * Deletes the settings array or a specific key of the settings array if `$key` is specified. |
| 70 | - * | |
| 71 | 70 | * @since 2.3.0 |
| 72 | 71 | * @access public |
| 73 | 72 | * |
| 74 | 73 | * @param string $key Optional. Default is null. |
| @@ -80,18 +79,8 @@ | ||
| 80 | 79 | $this->settings = []; |
| 81 | 80 | } |
| 82 | 81 | } |
| 83 | 82 | |
| 84 | - final public function merge_properties( array $default_props, array $custom_props, array $allowed_props_keys = [] ) { | |
| 85 | - $props = array_replace_recursive( $default_props, $custom_props ); | |
| 86 | - | |
| 87 | - if ( $allowed_props_keys ) { | |
| 88 | - $props = array_intersect_key( $props, array_flip( $allowed_props_keys ) ); | |
| 89 | - } | |
| 90 | - | |
| 91 | - return $props; | |
| 92 | - } | |
| 93 | - | |
| 94 | 83 | /** |
| 95 | 84 | * Get items. |
| 96 | 85 | * |
| 97 | 86 | * Utility method that receives an array with a needle and returns all the |
| @@ -141,54 +130,6 @@ | ||
| 141 | 130 | private function ensure_settings() { |
| 142 | 131 | if ( null === $this->settings ) { |
| 143 | 132 | $this->settings = $this->get_init_settings(); |
| 144 | 133 | } |
| 145 | - } | |
| 146 | - | |
| 147 | - /** | |
| 148 | - * Has Own Method | |
| 149 | - * | |
| 150 | - * Used for check whether the method passed as a parameter was declared in the current instance or inherited. | |
| 151 | - * If a base_class_name is passed, it checks whether the method was declared in that class. If the method's | |
| 152 | - * declaring class is the class passed as $base_class_name, it returns false. Otherwise (method was NOT declared | |
| 153 | - * in $base_class_name), it returns true. | |
| 154 | - * | |
| 155 | - * Example #1 - only $method_name is passed: | |
| 156 | - * The initial declaration of `register_controls()` happens in the `Controls_Stack` class. However, all | |
| 157 | - * widgets which have their own controls declare this function as well, overriding the original | |
| 158 | - * declaration. If `has_own_method()` would be called by a Widget's class which implements `register_controls()`, | |
| 159 | - * with 'register_controls' passed as the first parameter - `has_own_method()` will return true. If the Widget | |
| 160 | - * does not declare `register_controls()`, `has_own_method()` will return false. | |
| 161 | - * | |
| 162 | - * Example #2 - both $method_name and $base_class_name are passed | |
| 163 | - * In this example, the widget class inherits from a base class `Widget_Base`, and the base implements | |
| 164 | - * `register_controls()` to add certain controls to all widgets inheriting from it. `has_own_method()` is called by | |
| 165 | - * the widget, with the string 'register_controls' passed as the first parameter, and 'Elementor\Widget_Base' (its full name | |
| 166 | - * including the namespace) passed as the second parameter. If the widget class implements `register_controls()`, | |
| 167 | - * `has_own_method` will return true. If the widget class DOESN'T implement `register_controls()`, it will return | |
| 168 | - * false (because `Widget_Base` is the declaring class for `register_controls()`, and not the class that called | |
| 169 | - * `has_own_method()`). | |
| 170 | - * | |
| 171 | - * @since 3.1.0 | |
| 172 | - * | |
| 173 | - * @param string $method_name | |
| 174 | - * @param string $base_class_name | |
| 175 | - * | |
| 176 | - * @return bool True if the method was declared by the current instance, False if it was inherited. | |
| 177 | - */ | |
| 178 | - public function has_own_method( $method_name, $base_class_name = null ) { | |
| 179 | - try { | |
| 180 | - $reflection_method = new \ReflectionMethod( $this, $method_name ); | |
| 181 | - | |
| 182 | - // If a ReflectionMethod is successfully created, get its declaring class. | |
| 183 | - $declaring_class = $reflection_method->getDeclaringClass(); | |
| 184 | - } catch ( \Exception $e ) { | |
| 185 | - return false; | |
| 186 | - } | |
| 187 | - | |
| 188 | - if ( $base_class_name ) { | |
| 189 | - return $base_class_name !== $declaring_class->name; | |
| 190 | - } | |
| 191 | - | |
| 192 | - return get_called_class() === $declaring_class->name; | |
| 193 | 134 | } |
| 194 | 135 | } |