| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | use Elementor\Core\Common\Modules\Ajax\Module as Ajax; |
| 9 | 9 | use Elementor\Utils; |
| 10 | 10 | |
| 11 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | - exit; // Exit if accessed directly. | |
| 12 | + exit; // Exit if accessed directly | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | class Module extends \Elementor\Core\Base\Module { |
| 16 | 16 | |
| @@ -63,16 +63,9 @@ | ||
| 63 | 63 | |
| 64 | 64 | return $value; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - /** | |
| 68 | - * @throws \Exception If the safe mode cannot be enabled. | |
| 69 | - */ | |
| 70 | 67 | public function ajax_enable_safe_mode( $data ) { |
| 71 | - if ( ! current_user_can( 'install_plugins' ) ) { | |
| 72 | - throw new \Exception( 'Access denied.' ); | |
| 73 | - } | |
| 74 | - | |
| 75 | 68 | // It will run `$this->>update_safe_mode`. |
| 76 | 69 | update_option( 'elementor_safe_mode', 'yes' ); |
| 77 | 70 | |
| 78 | 71 | $document = Plugin::$instance->documents->get( $data['editor_post_id'] ); |
| @@ -154,15 +147,11 @@ | ||
| 154 | 147 | <style> |
| 155 | 148 | .elementor-safe-mode-toast { |
| 156 | 149 | position: absolute; |
| 157 | 150 | z-index: 10000; /* Over the loading layer */ |
| 158 | - inset-block-end: 10px; | |
| 159 | - inset-inline-end: 10px; | |
| 151 | + bottom: 10px; | |
| 160 | 152 | width: 400px; |
| 161 | 153 | line-height: 30px; |
| 162 | - display: flex; | |
| 163 | - flex-direction: column; | |
| 164 | - gap: 20px; | |
| 165 | 154 | color: var(--e-a-color-txt); |
| 166 | 155 | background: var(--e-a-bg-default); |
| 167 | 156 | padding: 20px 25px 25px; |
| 168 | 157 | box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); |
| @@ -169,8 +158,16 @@ | ||
| 169 | 158 | border-radius: 5px; |
| 170 | 159 | font-family: var(--e-a-font-family); |
| 171 | 160 | } |
| 172 | 161 | |
| 162 | + body.rtl .elementor-safe-mode-toast { | |
| 163 | + left: 10px; | |
| 164 | + } | |
| 165 | + | |
| 166 | + body:not(.rtl) .elementor-safe-mode-toast { | |
| 167 | + right: 10px; | |
| 168 | + } | |
| 169 | + | |
| 173 | 170 | #elementor-try-safe-mode { |
| 174 | 171 | display: none; |
| 175 | 172 | } |
| 176 | 173 | |
| @@ -185,38 +182,58 @@ | ||
| 185 | 182 | |
| 186 | 183 | .elementor-safe-mode-toast .elementor-toast-content hr { |
| 187 | 184 | margin: 15px auto; |
| 188 | 185 | border: 0 none; |
| 189 | - border-block-start: var(--e-a-border); | |
| 186 | + border-top: var(--e-a-border); | |
| 190 | 187 | } |
| 191 | 188 | |
| 192 | 189 | .elementor-safe-mode-toast header { |
| 193 | 190 | display: flex; |
| 194 | 191 | align-items: center; |
| 195 | - gap: 10px; | |
| 192 | + justify-content: space-between; | |
| 193 | + flex-wrap: wrap; | |
| 194 | + margin-bottom: 20px; | |
| 196 | 195 | } |
| 197 | 196 | |
| 197 | + .elementor-safe-mode-toast header > * { | |
| 198 | + margin-top: 10px; | |
| 199 | + } | |
| 200 | + | |
| 198 | 201 | .elementor-safe-mode-toast header i { |
| 199 | 202 | font-size: 25px; |
| 200 | 203 | color: var(--e-a-color-warning); |
| 201 | 204 | } |
| 202 | 205 | |
| 206 | + body:not(.rtl) .elementor-safe-mode-toast header i { | |
| 207 | + margin-right: 10px; | |
| 208 | + } | |
| 209 | + | |
| 210 | + body.rtl .elementor-safe-mode-toast header i { | |
| 211 | + margin-left: 10px; | |
| 212 | + } | |
| 213 | + | |
| 203 | 214 | .elementor-safe-mode-toast header h2 { |
| 204 | 215 | flex-grow: 1; |
| 205 | 216 | font-size: 18px; |
| 206 | 217 | } |
| 207 | 218 | |
| 208 | - .elementor-safe-mode-list { | |
| 209 | - display: flex; | |
| 210 | - flex-direction: column; | |
| 211 | - gap: 10px; | |
| 219 | + .elementor-safe-mode-list-item { | |
| 220 | + margin-top: 10px; | |
| 221 | + list-style: outside; | |
| 212 | 222 | } |
| 213 | 223 | |
| 214 | - .elementor-safe-mode-list-item { | |
| 215 | - margin-inline-start: 15px; | |
| 216 | - list-style: outside; | |
| 224 | + body:not(.rtl) .elementor-safe-mode-list-item { | |
| 225 | + margin-left: 15px; | |
| 217 | 226 | } |
| 218 | 227 | |
| 228 | + body.rtl .elementor-safe-mode-list-item { | |
| 229 | + margin-right: 15px; | |
| 230 | + } | |
| 231 | + | |
| 232 | + .elementor-safe-mode-list-item b { | |
| 233 | + font-size: 14px; | |
| 234 | + } | |
| 235 | + | |
| 219 | 236 | .elementor-safe-mode-list-item-content { |
| 220 | 237 | font-style: italic; |
| 221 | 238 | color: var(--e-a-color-txt); |
| 222 | 239 | } |
| @@ -227,9 +244,9 @@ | ||
| 227 | 244 | |
| 228 | 245 | .elementor-safe-mode-mu-plugins { |
| 229 | 246 | background-color: var(--e-a-bg-hover); |
| 230 | 247 | color: var(--e-a-color-txt-hover); |
| 231 | - margin-block-start: 20px; | |
| 248 | + margin-top: 20px; | |
| 232 | 249 | padding: 10px 15px; |
| 233 | 250 | } |
| 234 | 251 | </style> |
| 235 | 252 | <?php |
| @@ -239,9 +256,9 @@ | ||
| 239 | 256 | $this->print_safe_mode_css() |
| 240 | 257 | ?> |
| 241 | 258 | <div class="elementor-safe-mode-toast" id="elementor-safe-mode-message"> |
| 242 | 259 | <header> |
| 243 | - <i class="eicon-warning" aria-hidden="true"></i> | |
| 260 | + <i class="eicon-warning"></i> | |
| 244 | 261 | <h2><?php echo esc_html__( 'Safe Mode ON', 'elementor' ); ?></h2> |
| 245 | 262 | <a class="elementor-button elementor-safe-mode-button elementor-disable-safe-mode" target="_blank" href="<?php echo esc_url( $this->get_admin_page_url() ); ?>"> |
| 246 | 263 | <?php echo esc_html__( 'Disable Safe Mode', 'elementor' ); ?> |
| 247 | 264 | </a> |
| @@ -317,9 +334,9 @@ | ||
| 317 | 334 | location.replace( location.href.replace( '&elementor-mode=safe', '' ) ); |
| 318 | 335 | } |
| 319 | 336 | }, |
| 320 | 337 | error: function() { |
| 321 | - alert( 'An error occurred.' ); | |
| 338 | + alert( 'An error occurred' ); | |
| 322 | 339 | }, |
| 323 | 340 | }, |
| 324 | 341 | true |
| 325 | 342 | ); |
| @@ -347,9 +364,9 @@ | ||
| 347 | 364 | ?> |
| 348 | 365 | <div class="elementor-safe-mode-toast" id="elementor-try-safe-mode"> |
| 349 | 366 | <?php if ( current_user_can( 'install_plugins' ) ) : ?> |
| 350 | 367 | <header> |
| 351 | - <i class="eicon-warning" aria-hidden="true"></i> | |
| 368 | + <i class="eicon-warning"></i> | |
| 352 | 369 | <h2><?php echo esc_html__( 'Can\'t Edit?', 'elementor' ); ?></h2> |
| 353 | 370 | <a class="elementor-button e-primary elementor-safe-mode-button elementor-enable-safe-mode" target="_blank" href="<?php echo esc_url( $this->get_admin_page_url() ); ?>"> |
| 354 | 371 | <?php echo esc_html__( 'Enable Safe Mode', 'elementor' ); ?> |
| 355 | 372 | </a> |
| @@ -359,9 +376,9 @@ | ||
| 359 | 376 | <a href="<?php Utils::print_unescaped_internal_string( self::DOCS_TRY_SAFE_MODE_URL ); ?>" target="_blank"><?php echo esc_html__( 'Learn More', 'elementor' ); ?></a> |
| 360 | 377 | </div> |
| 361 | 378 | <?php else : ?> |
| 362 | 379 | <header> |
| 363 | - <i class="eicon-warning" aria-hidden="true"></i> | |
| 380 | + <i class="eicon-warning"></i> | |
| 364 | 381 | <h2><?php echo esc_html__( 'Can\'t Edit?', 'elementor' ); ?></h2> |
| 365 | 382 | </header> |
| 366 | 383 | <div class="elementor-toast-content"> |
| 367 | 384 | <?php echo esc_html__( 'If you are experiencing a loading issue, contact your site administrator to troubleshoot the problem using Safe Mode.', 'elementor' ); ?> |
| @@ -391,9 +408,9 @@ | ||
| 391 | 408 | success: function( url ) { |
| 392 | 409 | location.assign( url ); |
| 393 | 410 | }, |
| 394 | 411 | error: function() { |
| 395 | - alert( 'An error occurred.' ); | |
| 412 | + alert( 'An error occurred' ); | |
| 396 | 413 | }, |
| 397 | 414 | }, |
| 398 | 415 | true |
| 399 | 416 | ); |
| @@ -424,9 +441,9 @@ | ||
| 424 | 441 | return; |
| 425 | 442 | } |
| 426 | 443 | |
| 427 | 444 | if ( ! $notice.data( 'visible' ) ) { |
| 428 | - $notice.attr( 'style', 'display: flex;' ); | |
| 445 | + $notice.show().data( 'visible', true ); | |
| 429 | 446 | } |
| 430 | 447 | |
| 431 | 448 | // Re-check after 500ms. |
| 432 | 449 | setTimeout( handleTrySafeModeNotice, 500 ); |