| @@ -103,13 +103,10 @@ | ||
| 103 | 103 | * |
| 104 | 104 | * @return string Shape file path. |
| 105 | 105 | */ |
| 106 | 106 | public static function get_shape_path( $shape, $is_negative = false ) { |
| 107 | - if ( ! isset( self::$shapes[ $shape ] ) ) { | |
| 108 | - return ''; | |
| 109 | - } | |
| 110 | 107 | |
| 111 | - if ( isset( self::$shapes[ $shape ]['path'] ) ) { | |
| 108 | + if ( isset( self::$shapes[ $shape ] ) && isset( self::$shapes[ $shape ]['path'] ) ) { | |
| 112 | 109 | $path = self::$shapes[ $shape ]['path']; |
| 113 | 110 | return ( $is_negative ) ? str_replace( '.svg', '-negative.svg', $path ) : $path; |
| 114 | 111 | } |
| 115 | 112 | |
| @@ -133,102 +130,84 @@ | ||
| 133 | 130 | */ |
| 134 | 131 | private static function init_shapes() { |
| 135 | 132 | $native_shapes = [ |
| 136 | 133 | 'mountains' => [ |
| 137 | - 'title' => esc_html_x( 'Mountains', 'Shapes', 'elementor' ), | |
| 138 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/mountains.svg', | |
| 134 | + 'title' => _x( 'Mountains', 'Shapes', 'elementor' ), | |
| 139 | 135 | 'has_flip' => true, |
| 140 | 136 | ], |
| 141 | 137 | 'drops' => [ |
| 142 | - 'title' => esc_html_x( 'Drops', 'Shapes', 'elementor' ), | |
| 143 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/drops.svg', | |
| 138 | + 'title' => _x( 'Drops', 'Shapes', 'elementor' ), | |
| 144 | 139 | 'has_negative' => true, |
| 145 | 140 | 'has_flip' => true, |
| 146 | 141 | 'height_only' => true, |
| 147 | 142 | ], |
| 148 | 143 | 'clouds' => [ |
| 149 | - 'title' => esc_html_x( 'Clouds', 'Shapes', 'elementor' ), | |
| 150 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/clouds.svg', | |
| 144 | + 'title' => _x( 'Clouds', 'Shapes', 'elementor' ), | |
| 151 | 145 | 'has_negative' => true, |
| 152 | 146 | 'has_flip' => true, |
| 153 | 147 | 'height_only' => true, |
| 154 | 148 | ], |
| 155 | 149 | 'zigzag' => [ |
| 156 | - 'title' => esc_html_x( 'Zigzag', 'Shapes', 'elementor' ), | |
| 157 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/zigzag.svg', | |
| 150 | + 'title' => _x( 'Zigzag', 'Shapes', 'elementor' ), | |
| 158 | 151 | ], |
| 159 | 152 | 'pyramids' => [ |
| 160 | - 'title' => esc_html_x( 'Pyramids', 'Shapes', 'elementor' ), | |
| 161 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/pyramids.svg', | |
| 153 | + 'title' => _x( 'Pyramids', 'Shapes', 'elementor' ), | |
| 162 | 154 | 'has_negative' => true, |
| 163 | 155 | 'has_flip' => true, |
| 164 | 156 | ], |
| 165 | 157 | 'triangle' => [ |
| 166 | - 'title' => esc_html_x( 'Triangle', 'Shapes', 'elementor' ), | |
| 167 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/triangle.svg', | |
| 158 | + 'title' => _x( 'Triangle', 'Shapes', 'elementor' ), | |
| 168 | 159 | 'has_negative' => true, |
| 169 | 160 | ], |
| 170 | 161 | 'triangle-asymmetrical' => [ |
| 171 | - 'title' => esc_html_x( 'Triangle Asymmetrical', 'Shapes', 'elementor' ), | |
| 172 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/triangle-asymmetrical.svg', | |
| 162 | + 'title' => _x( 'Triangle Asymmetrical', 'Shapes', 'elementor' ), | |
| 173 | 163 | 'has_negative' => true, |
| 174 | 164 | 'has_flip' => true, |
| 175 | 165 | ], |
| 176 | 166 | 'tilt' => [ |
| 177 | - 'title' => esc_html_x( 'Tilt', 'Shapes', 'elementor' ), | |
| 178 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/tilt.svg', | |
| 167 | + 'title' => _x( 'Tilt', 'Shapes', 'elementor' ), | |
| 179 | 168 | 'has_flip' => true, |
| 180 | 169 | 'height_only' => true, |
| 181 | 170 | ], |
| 182 | 171 | 'opacity-tilt' => [ |
| 183 | - 'title' => esc_html_x( 'Tilt Opacity', 'Shapes', 'elementor' ), | |
| 184 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/opacity-tilt.svg', | |
| 172 | + 'title' => _x( 'Tilt Opacity', 'Shapes', 'elementor' ), | |
| 185 | 173 | 'has_flip' => true, |
| 186 | 174 | ], |
| 187 | 175 | 'opacity-fan' => [ |
| 188 | - 'title' => esc_html_x( 'Fan Opacity', 'Shapes', 'elementor' ), | |
| 189 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/opacity-fan.svg', | |
| 176 | + 'title' => _x( 'Fan Opacity', 'Shapes', 'elementor' ), | |
| 190 | 177 | ], |
| 191 | 178 | 'curve' => [ |
| 192 | - 'title' => esc_html_x( 'Curve', 'Shapes', 'elementor' ), | |
| 193 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/curve.svg', | |
| 179 | + 'title' => _x( 'Curve', 'Shapes', 'elementor' ), | |
| 194 | 180 | 'has_negative' => true, |
| 195 | 181 | ], |
| 196 | 182 | 'curve-asymmetrical' => [ |
| 197 | - 'title' => esc_html_x( 'Curve Asymmetrical', 'Shapes', 'elementor' ), | |
| 198 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/curve-asymmetrical.svg', | |
| 183 | + 'title' => _x( 'Curve Asymmetrical', 'Shapes', 'elementor' ), | |
| 199 | 184 | 'has_negative' => true, |
| 200 | 185 | 'has_flip' => true, |
| 201 | 186 | ], |
| 202 | 187 | 'waves' => [ |
| 203 | - 'title' => esc_html_x( 'Waves', 'Shapes', 'elementor' ), | |
| 204 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/waves.svg', | |
| 188 | + 'title' => _x( 'Waves', 'Shapes', 'elementor' ), | |
| 205 | 189 | 'has_negative' => true, |
| 206 | 190 | 'has_flip' => true, |
| 207 | 191 | ], |
| 208 | 192 | 'wave-brush' => [ |
| 209 | - 'title' => esc_html_x( 'Waves Brush', 'Shapes', 'elementor' ), | |
| 210 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/wave-brush.svg', | |
| 193 | + 'title' => _x( 'Waves Brush', 'Shapes', 'elementor' ), | |
| 211 | 194 | 'has_flip' => true, |
| 212 | 195 | ], |
| 213 | 196 | 'waves-pattern' => [ |
| 214 | - 'title' => esc_html_x( 'Waves Pattern', 'Shapes', 'elementor' ), | |
| 215 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/waves-pattern.svg', | |
| 197 | + 'title' => _x( 'Waves Pattern', 'Shapes', 'elementor' ), | |
| 216 | 198 | 'has_flip' => true, |
| 217 | 199 | ], |
| 218 | - 'book' => [ | |
| 219 | - 'title' => esc_html_x( 'Book', 'Shapes', 'elementor' ), | |
| 220 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/book.svg', | |
| 200 | + 'arrow' => [ | |
| 201 | + 'title' => _x( 'Arrow', 'Shapes', 'elementor' ), | |
| 221 | 202 | 'has_negative' => true, |
| 222 | 203 | ], |
| 223 | 204 | 'split' => [ |
| 224 | - 'title' => esc_html_x( 'Split', 'Shapes', 'elementor' ), | |
| 225 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/split.svg', | |
| 205 | + 'title' => _x( 'Split', 'Shapes', 'elementor' ), | |
| 226 | 206 | 'has_negative' => true, |
| 227 | 207 | ], |
| 228 | - 'arrow' => [ | |
| 229 | - 'title' => esc_html_x( 'Arrow', 'Shapes', 'elementor' ), | |
| 230 | - 'image' => ELEMENTOR_ASSETS_URL . 'shapes/arrow.svg', | |
| 208 | + 'book' => [ | |
| 209 | + 'title' => _x( 'Book', 'Shapes', 'elementor' ), | |
| 231 | 210 | 'has_negative' => true, |
| 232 | 211 | ], |
| 233 | 212 | ]; |
| 234 | 213 | |
| @@ -249,11 +228,9 @@ | ||
| 249 | 228 | |
| 250 | 229 | if ( null !== $additional_shapes ) { |
| 251 | 230 | return $additional_shapes; |
| 252 | 231 | } |
| 253 | - | |
| 254 | 232 | $additional_shapes = []; |
| 255 | - | |
| 256 | 233 | /** |
| 257 | 234 | * Additional shapes. |
| 258 | 235 | * |
| 259 | 236 | * Filters the shapes used by Elementor to add additional shapes. |
| @@ -262,16 +239,8 @@ | ||
| 262 | 239 | * |
| 263 | 240 | * @param array $additional_shapes Additional Elementor shapes. |
| 264 | 241 | */ |
| 265 | 242 | $additional_shapes = apply_filters( 'elementor/shapes/additional_shapes', $additional_shapes ); |
| 266 | - | |
| 267 | - // BC for addons that add additional shapes the old way using `url` instead of `image`. | |
| 268 | - foreach ( $additional_shapes as $shape_name => $shape_settings ) { | |
| 269 | - if ( ! isset( $shape_settings['image'] ) && isset( $shape_settings['url'] ) ) { | |
| 270 | - $additional_shapes[ $shape_name ]['image'] = $shape_settings['url']; | |
| 271 | - } | |
| 272 | - } | |
| 273 | - | |
| 274 | 243 | return $additional_shapes; |
| 275 | 244 | } |
| 276 | 245 | |
| 277 | 246 | /** |