PluginProbe
Elementor Website Builder – more than just a page builder / 3.3.0
Elementor Website Builder – more than just a page builder v3.3.0
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/settings/settings-page.php +10 -71 4.2.23.3.0 View file →
@@ -1,9 +1,7 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Plugin;
5 -
6 4 if ( ! defined( 'ABSPATH' ) ) {
7 5 exit; // Exit if accessed directly.
8 6 }
9 7
@@ -71,25 +69,8 @@
71 69 return admin_url( 'admin.php?page=' . static::PAGE_ID );
72 70 }
73 71
74 72 /**
75 - * Get settings tab URL.
76 - *
77 - * Retrieve the URL of a specific tab in the settings page.
78 - *
79 - * @since 3.23.0
80 - * @access public
81 - * @static
82 - *
83 - * @param string $tab_id The ID of the settings tab.
84 - *
85 - * @return string Settings tab URL.
86 - */
87 - final public static function get_settings_tab_url( $tab_id ): string {
88 - return admin_url( "admin.php?page=elementor-settings#tab-$tab_id" );
89 - }
90 -
91 - /**
92 73 * Settings page constructor.
93 74 *
94 75 * Initializing Elementor settings page.
95 76 *
@@ -96,10 +77,9 @@
96 77 * @since 1.5.0
97 78 * @access public
98 79 */
99 80 public function __construct() {
100 - // PHPCS - The user data is not used.
101 - if ( ! empty( $_POST['option_page'] ) && static::PAGE_ID === $_POST['option_page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
81 + if ( ! empty( $_POST['option_page'] ) && static::PAGE_ID === $_POST['option_page'] ) {
102 82 add_action( 'admin_init', [ $this, 'register_settings_fields' ] );
103 83 }
104 84 }
105 85
@@ -311,13 +291,13 @@
311 291
312 292 $tabs = $this->get_tabs();
313 293 ?>
314 294 <div class="wrap">
315 - <h1 class="wp-heading-inline"><?php echo esc_html( $this->get_page_title() ); ?></h1>
295 + <h1 class="wp-heading-inline"><?php echo $this->get_page_title(); ?></h1>
316 296 <div id="elementor-settings-tabs-wrapper" class="nav-tab-wrapper">
317 297 <?php
318 298 foreach ( $tabs as $tab_id => $tab ) {
319 - if ( ! $this->should_render_tab( $tab ) ) {
299 + if ( empty( $tab['sections'] ) ) {
320 300 continue;
321 301 }
322 302
323 303 $active_class = '';
@@ -325,13 +305,9 @@
325 305 if ( 'general' === $tab_id ) {
326 306 $active_class = ' nav-tab-active';
327 307 }
328 308
329 - $sanitized_tab_id = esc_attr( $tab_id );
330 - $sanitized_tab_label = esc_html( $tab['label'] );
331 -
332 - // PHPCS - Escaped the relevant strings above.
333 - echo "<a id='elementor-settings-tab-{$sanitized_tab_id}' class='nav-tab{$active_class}' href='#tab-{$sanitized_tab_id}'>{$sanitized_tab_label}</a>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
309 + echo "<a id='elementor-settings-tab-{$tab_id}' class='nav-tab{$active_class}' href='#tab-{$tab_id}'>{$tab['label']}</a>";
334 310 }
335 311 ?>
336 312 </div>
337 313 <form id="elementor-settings-form" method="post" action="options.php">
@@ -338,9 +314,9 @@
338 314 <?php
339 315 settings_fields( static::PAGE_ID );
340 316
341 317 foreach ( $tabs as $tab_id => $tab ) {
342 - if ( ! $this->should_render_tab( $tab ) ) {
318 + if ( empty( $tab['sections'] ) ) {
343 319 continue;
344 320 }
345 321
346 322 $active_class = '';
@@ -348,22 +324,15 @@
348 324 if ( 'general' === $tab_id ) {
349 325 $active_class = ' elementor-active';
350 326 }
351 327
352 - $sanitized_tab_id = esc_attr( $tab_id );
328 + echo "<div id='tab-{$tab_id}' class='elementor-settings-form-page{$active_class}'>";
353 329
354 - // PHPCS - $active_class is a non-dynamic string and $sanitized_tab_id is escaped above.
355 - echo "<div id='tab-{$sanitized_tab_id}' class='elementor-settings-form-page{$active_class}'>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
356 -
357 330 foreach ( $tab['sections'] as $section_id => $section ) {
358 - if ( ! $this->should_render_section( $section ) ) {
359 - continue;
360 - }
361 -
362 331 $full_section_id = 'elementor_' . $section_id . '_section';
363 332
364 333 if ( ! empty( $section['label'] ) ) {
365 - echo '<h2>' . esc_html( $section['label'] ) . '</h2>';
334 + echo "<h2>{$section['label']}</h2>";
366 335 }
367 336
368 337 if ( ! empty( $section['callback'] ) ) {
369 338 $section['callback']();
@@ -378,9 +347,9 @@
378 347
379 348 echo '</div>';
380 349 }
381 350
382 - submit_button( __( 'Save Changes', 'elementor' ), 'primary', 'submit', true, [ 'data-id' => 'elementor-settings-button-save-changes' ] );
351 + submit_button();
383 352 ?>
384 353 </form>
385 354 </div><!-- /.wrap -->
386 355 <?php
@@ -388,18 +357,14 @@
388 357
389 358 public function get_usage_fields() {
390 359 return [
391 360 'allow_tracking' => [
392 - 'label' => esc_html__( 'Data Sharing', 'elementor' ),
361 + 'label' => __( 'Usage Data Sharing', 'elementor' ),
393 362 'field_args' => [
394 363 'type' => 'checkbox',
395 364 'value' => 'yes',
396 365 'default' => '',
397 - 'sub_desc' => sprintf(
398 - '%1$s <a href="https://go.elementor.com/usage-data-tracking/" target="_blank">%2$s</a>',
399 - esc_html__( 'Become a super contributor by helping us understand how you use our service to enhance your experience and improve our product.', 'elementor' ),
400 - esc_html__( 'Learn more', 'elementor' )
401 - ),
366 + 'sub_desc' => __( 'Become a super contributor by opting in to share non-sensitive plugin data and to receive periodic email updates from us.', 'elementor' ) . sprintf( ' <a href="%1$s" target="_blank">%2$s</a>', 'https://go.elementor.com/usage-data-tracking/', __( 'Learn more.', 'elementor' ) ),
402 367 ],
403 368 'setting_args' => [ __NAMESPACE__ . '\Tracker', 'check_for_settings_optin' ],
404 369 ],
405 370 ];
@@ -432,32 +397,6 @@
432 397 * @param Settings_Page $this The settings page.
433 398 */
434 399 do_action( "elementor/admin/after_create_settings/{$page_id}", $this );
435 400 }
436 - }
437 -
438 - /**
439 - * Should it render the settings tab
440 - *
441 - * @param array $tab
442 - *
443 - * @return bool
444 - */
445 - private function should_render_tab( $tab ) {
446 - // BC - When 'show_if' prop is not exists, it actually should render the tab.
447 - return ! empty( $tab['sections'] ) && ( ! isset( $tab['show_if'] ) || $tab['show_if'] );
448 - }
449 -
450 - /**
451 - * Should it render the settings section
452 - *
453 - * @param array $section
454 - *
455 - * Since 3.19.0
456 - *
457 - * @return bool
458 - */
459 - private function should_render_section( $section ) {
460 - // BC - When 'show_if' prop is not exists, it actually should render the section.
461 - return ! isset( $section['show_if'] ) || $section['show_if'];
462 401 }
463 402 }