Plugin Directory

Changeset 2795749


Ignore:
Timestamp:
10/07/2022 05:08:18 PM (3 years ago)
Author:
rockcontentplatform
Message:

Add sanitization

Location:
rock-convert
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • rock-convert/tags/3.0.0/inc/admin/announcements/class-announcement.php

    r2795270 r2795749  
    9494            $activate       = sanitize_key( Utils::getArrayValue( $_POST, 'rconvert_activate_announcement' ) );
    9595            $link           = esc_url_raw( Utils::getArrayValue( $_POST, 'rconvert_announcement_link' ) );
    96             $urls           = Utils::getArrayValue( $_POST, 'rconvert_announcement_excluded_pages' );
     96            $urls           = Utils::sanitize_array( $_POST['rconvert_announcement_excluded_pages'] );
    9797            $position       = sanitize_text_field( Utils::getArrayValue( $_POST, 'rconvert_announcement_position' ) );
    9898            $text           = sanitize_text_field( Utils::getArrayValue( $_POST, 'rconvert_announcement_text' ) );
     
    121121
    122122            wp_safe_redirect( admin_url( '/edit.php?post_type=cta&page=rock-convert-announcements&success=true' ), 301 );
     123            exit;
    123124        }
    124125    }
  • rock-convert/tags/3.0.0/inc/admin/announcements/views/announcements-settings-page.php

    r2795270 r2795749  
    3131$position       = Utils::getArrayValue( $settings, 'position', null, $default['position'] );
    3232$visibility     = Utils::getArrayValue( $settings, 'visibility', null, $default['visibility'] );
    33 $excluded_urls  = Utils::getArrayValue( $settings, 'urls' );
     33$excluded_urls  = Utils::sanitize_array( $settings['urls'] );
    3434$bg_color       = Utils::getArrayValue( $settings, 'bg_color', null, $default['bg_color'] );
    3535$text_color     = Utils::getArrayValue( $settings, 'text_color', null, $default['text_color'] );
  • rock-convert/tags/3.0.0/inc/admin/class-admin.php

    r2795270 r2795749  
    254254    public function add_support_submenu_link() {
    255255        global $submenu;
    256         $submenu['edit.php?post_type=cta'][] = array( 'Ajuda', 'manage_options', ROCK_CONVERT_HELP_CENTER_URL ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
     256        $submenu['edit.php?post_type=cta'][] = array(
     257             'Ajuda', 'manage_options', ROCK_CONVERT_HELP_CENTER_URL ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
    257258    }
    258259}
  • rock-convert/tags/3.0.0/inc/admin/class-page-settings.php

    r2795270 r2795749  
    143143            update_option(
    144144                '_rock_convert_popup_color',
    145                 $popup_color
     145                sanitize_hex_color( $popup_color )
    146146            );
    147147
    148148            update_option(
    149149                '_rock_convert_popup_activate',
    150                 $popup_activate
     150                sanitize_text_field( $popup_activate )
    151151            );
    152152
    153153            update_option(
    154154                '_rock_convert_popup_image_activate',
    155                 $popup_image_activate
     155                sanitize_text_field( $popup_image_activate )
    156156            );
    157157
    158158            update_option(
    159159                '_rock_convert_popup_image',
    160                 $popup_image
     160                sanitize_text_field( $popup_image )
    161161            );
    162162
    163163            update_option(
    164164                '_rock_convert_popup_button_color',
    165                 $popup_button_color
     165                sanitize_hex_color( $popup_button_color )
    166166            );
    167167
    168168            update_option(
    169169                '_rock_convert_popup_title_color',
    170                 $popup_title_color
     170                sanitize_hex_color( $popup_title_color )
    171171            );
    172172
    173173            update_option(
    174174                '_rock_convert_popup_description_color',
    175                 $popup_description_color
     175                sanitize_hex_color( $popup_description_color )
    176176            );
    177177
    178178            update_option(
    179179                '_rock_convert_popup_button_text_color',
    180                 $popup_button_text_color
     180                sanitize_hex_color( $popup_button_text_color )
    181181            );
    182182
    183183            update_option(
    184184                '_rock_convert_popup_button_close_color',
    185                 $popup_button_close_color
     185                sanitize_hex_color( $popup_button_close_color )
    186186            );
    187187        }
     
    205205            $custom_field_label  = Utils::getArrayValue( $_POST, 'rock_convert_custom_field_label' );
    206206
    207             update_option( '_rock_convert_name_field', $enable_name_field );
    208             update_option( '_rock_convert_custom_field', $enable_custom_field );
    209             update_option( '_rock_convert_custom_field_label', $custom_field_label );
    210             update_option( '_rock_convert_enable_analytics', $enable_analytics );
     207            update_option( '_rock_convert_name_field', sanitize_text_field( $enable_name_field ) );
     208            update_option( '_rock_convert_custom_field', sanitize_text_field( $enable_custom_field ) );
     209            update_option( '_rock_convert_custom_field_label', sanitize_text_field( $custom_field_label ) );
     210            update_option( '_rock_convert_enable_analytics', sanitize_text_field( $enable_analytics ) );
    211211        }
    212212    }
     
    271271            update_option(
    272272                '_rock_convert_mailchimp_token',
    273                 $mailchimp_token
     273                sanitize_text_field( $mailchimp_token )
    274274            );
    275275
     
    279279                update_option(
    280280                    '_rock_convert_mailchimp_list',
    281                     $mailchimp_list
     281                    sanitize_text_field( $mailchimp_list )
    282282                );
    283283            }
  • rock-convert/tags/3.0.0/inc/admin/class-utils.php

    r2795270 r2795749  
    6161        }
    6262
    63         return isset( $array[ $index ] ) ? $array[ $index ] : $default;
     63        return isset( $array[ $index ] ) ? sanitize_text_field( wp_unslash( $array[ $index ] ) ) : $default;
    6464    }
    6565
  • rock-convert/tags/3.0.0/inc/admin/cta/class-custom-meta-box.php

    r2795270 r2795749  
    332332                                style="width: 65%;margin-right: 10px;"
    333333                                value="<?php echo esc_url( $url ); ?>"
    334                                 placeholder="<?php esc_html_e( 'Exemplo', 'rock-convert' ); ?>:
    335                                 <?php echo esc_url( get_bloginfo( 'url' ) ); ?>/meu-post">
     334                                placeholder="<?php echo esc_html( 'Exemplo', 'rock-convert' ) . ': '
     335                                 . esc_url( get_bloginfo( 'url' ) . '/meu-post' ); ?>">
    336336                            <input type="button"
    337337                                class="preview button rock-convert-exclude-pages-remove"
     
    345345                        <input type="text" name="rock_convert_exclude_pages[]"
    346346                            style="width: 95%;margin-right: 10px;"
    347                             placeholder="<?php esc_html_e( 'Exemplo', 'rock-convert' ); ?>:
    348                             <?php echo esc_url( get_bloginfo( 'url' ) ); ?>/meu-post">
     347                            placeholder="<?php echo esc_html( 'Exemplo', 'rock-convert' ) . ': '
     348                             . esc_url( get_bloginfo( 'url' ) . '/meu-post' ); ?>">
    349349                        <input type="button"
    350350                            class="preview button rock-convert-exclude-pages-remove"
     
    543543
    544544            $exclude_pages = isset( $_POST['rock_convert_exclude_pages'] ) ?
    545                 sanitize_text_field( wp_unslash( $_POST['rock_convert_exclude_pages'] ) ) : null;
     545                $_POST['rock_convert_exclude_pages'] : null;
    546546            $urls          = $exclude_pages ? Utils::sanitize_array( $exclude_pages ) : null;
    547547
     
    554554
    555555            if ( ! empty( $urls ) ) {
    556                 update_post_meta( $post_id, '_rock_convert_excluded_urls', $urls );
     556                    update_post_meta( $post_id, '_rock_convert_excluded_urls', $urls );
    557557            }
    558558
    559             // Update image field.
    560             $image = array_map( 'intval', Utils::getArrayValue( $_POST, 'rock-convert-media' ) );
    561             if ( $image ) {
    562                 foreach ( $image as $key => $value ) {
    563                     update_post_meta( $post_id, $key, $value );
     559            $images =  isset( $_POST['rock-convert-media'] ) ? Utils::sanitize_array( $_POST['rock-convert-media'] ) : null;
     560
     561            if( $images ){
     562            $image = array_map( 'intval', $images );
     563                foreach ( $image as $value ) {
     564                    update_post_meta( $post_id, '_rock_convert_image_media', $value );
    564565                }
    565566            }
     
    589590                <input type='hidden' id='<?php echo esc_attr( $name ); ?>-value'
    590591                        class='small-text'
    591                         name='rock-convert-media[<?php echo esc_attr( $name ); ?>]'
     592                        name='rock-convert-media[]'
    592593                        value='<?php echo esc_attr( $value ); ?>' />
    593594                <input type='button' id='<?php echo esc_attr( $name ); ?>'
  • rock-convert/trunk/inc/admin/announcements/class-announcement.php

    r2795270 r2795749  
    9494            $activate       = sanitize_key( Utils::getArrayValue( $_POST, 'rconvert_activate_announcement' ) );
    9595            $link           = esc_url_raw( Utils::getArrayValue( $_POST, 'rconvert_announcement_link' ) );
    96             $urls           = Utils::getArrayValue( $_POST, 'rconvert_announcement_excluded_pages' );
     96            $urls           = Utils::sanitize_array( $_POST['rconvert_announcement_excluded_pages'] );
    9797            $position       = sanitize_text_field( Utils::getArrayValue( $_POST, 'rconvert_announcement_position' ) );
    9898            $text           = sanitize_text_field( Utils::getArrayValue( $_POST, 'rconvert_announcement_text' ) );
     
    121121
    122122            wp_safe_redirect( admin_url( '/edit.php?post_type=cta&page=rock-convert-announcements&success=true' ), 301 );
     123            exit;
    123124        }
    124125    }
  • rock-convert/trunk/inc/admin/announcements/views/announcements-settings-page.php

    r2795270 r2795749  
    3131$position       = Utils::getArrayValue( $settings, 'position', null, $default['position'] );
    3232$visibility     = Utils::getArrayValue( $settings, 'visibility', null, $default['visibility'] );
    33 $excluded_urls  = Utils::getArrayValue( $settings, 'urls' );
     33$excluded_urls  = Utils::sanitize_array( $settings['urls'] );
    3434$bg_color       = Utils::getArrayValue( $settings, 'bg_color', null, $default['bg_color'] );
    3535$text_color     = Utils::getArrayValue( $settings, 'text_color', null, $default['text_color'] );
  • rock-convert/trunk/inc/admin/class-admin.php

    r2795270 r2795749  
    254254    public function add_support_submenu_link() {
    255255        global $submenu;
    256         $submenu['edit.php?post_type=cta'][] = array( 'Ajuda', 'manage_options', ROCK_CONVERT_HELP_CENTER_URL ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
     256        $submenu['edit.php?post_type=cta'][] = array(
     257             'Ajuda', 'manage_options', ROCK_CONVERT_HELP_CENTER_URL ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
    257258    }
    258259}
  • rock-convert/trunk/inc/admin/class-page-settings.php

    r2795270 r2795749  
    143143            update_option(
    144144                '_rock_convert_popup_color',
    145                 $popup_color
     145                sanitize_hex_color( $popup_color )
    146146            );
    147147
    148148            update_option(
    149149                '_rock_convert_popup_activate',
    150                 $popup_activate
     150                sanitize_text_field( $popup_activate )
    151151            );
    152152
    153153            update_option(
    154154                '_rock_convert_popup_image_activate',
    155                 $popup_image_activate
     155                sanitize_text_field( $popup_image_activate )
    156156            );
    157157
    158158            update_option(
    159159                '_rock_convert_popup_image',
    160                 $popup_image
     160                sanitize_text_field( $popup_image )
    161161            );
    162162
    163163            update_option(
    164164                '_rock_convert_popup_button_color',
    165                 $popup_button_color
     165                sanitize_hex_color( $popup_button_color )
    166166            );
    167167
    168168            update_option(
    169169                '_rock_convert_popup_title_color',
    170                 $popup_title_color
     170                sanitize_hex_color( $popup_title_color )
    171171            );
    172172
    173173            update_option(
    174174                '_rock_convert_popup_description_color',
    175                 $popup_description_color
     175                sanitize_hex_color( $popup_description_color )
    176176            );
    177177
    178178            update_option(
    179179                '_rock_convert_popup_button_text_color',
    180                 $popup_button_text_color
     180                sanitize_hex_color( $popup_button_text_color )
    181181            );
    182182
    183183            update_option(
    184184                '_rock_convert_popup_button_close_color',
    185                 $popup_button_close_color
     185                sanitize_hex_color( $popup_button_close_color )
    186186            );
    187187        }
     
    205205            $custom_field_label  = Utils::getArrayValue( $_POST, 'rock_convert_custom_field_label' );
    206206
    207             update_option( '_rock_convert_name_field', $enable_name_field );
    208             update_option( '_rock_convert_custom_field', $enable_custom_field );
    209             update_option( '_rock_convert_custom_field_label', $custom_field_label );
    210             update_option( '_rock_convert_enable_analytics', $enable_analytics );
     207            update_option( '_rock_convert_name_field', sanitize_text_field( $enable_name_field ) );
     208            update_option( '_rock_convert_custom_field', sanitize_text_field( $enable_custom_field ) );
     209            update_option( '_rock_convert_custom_field_label', sanitize_text_field( $custom_field_label ) );
     210            update_option( '_rock_convert_enable_analytics', sanitize_text_field( $enable_analytics ) );
    211211        }
    212212    }
     
    271271            update_option(
    272272                '_rock_convert_mailchimp_token',
    273                 $mailchimp_token
     273                sanitize_text_field( $mailchimp_token )
    274274            );
    275275
     
    279279                update_option(
    280280                    '_rock_convert_mailchimp_list',
    281                     $mailchimp_list
     281                    sanitize_text_field( $mailchimp_list )
    282282                );
    283283            }
  • rock-convert/trunk/inc/admin/class-utils.php

    r2795270 r2795749  
    6161        }
    6262
    63         return isset( $array[ $index ] ) ? $array[ $index ] : $default;
     63        return isset( $array[ $index ] ) ? sanitize_text_field( wp_unslash( $array[ $index ] ) ) : $default;
    6464    }
    6565
  • rock-convert/trunk/inc/admin/cta/class-custom-meta-box.php

    r2795270 r2795749  
    332332                                style="width: 65%;margin-right: 10px;"
    333333                                value="<?php echo esc_url( $url ); ?>"
    334                                 placeholder="<?php esc_html_e( 'Exemplo', 'rock-convert' ); ?>:
    335                                 <?php echo esc_url( get_bloginfo( 'url' ) ); ?>/meu-post">
     334                                placeholder="<?php echo esc_html( 'Exemplo', 'rock-convert' ) . ': '
     335                                 . esc_url( get_bloginfo( 'url' ) . '/meu-post' ); ?>">
    336336                            <input type="button"
    337337                                class="preview button rock-convert-exclude-pages-remove"
     
    345345                        <input type="text" name="rock_convert_exclude_pages[]"
    346346                            style="width: 95%;margin-right: 10px;"
    347                             placeholder="<?php esc_html_e( 'Exemplo', 'rock-convert' ); ?>:
    348                             <?php echo esc_url( get_bloginfo( 'url' ) ); ?>/meu-post">
     347                            placeholder="<?php echo esc_html( 'Exemplo', 'rock-convert' ) . ': '
     348                             . esc_url( get_bloginfo( 'url' ) . '/meu-post' ); ?>">
    349349                        <input type="button"
    350350                            class="preview button rock-convert-exclude-pages-remove"
     
    543543
    544544            $exclude_pages = isset( $_POST['rock_convert_exclude_pages'] ) ?
    545                 sanitize_text_field( wp_unslash( $_POST['rock_convert_exclude_pages'] ) ) : null;
     545                $_POST['rock_convert_exclude_pages'] : null;
    546546            $urls          = $exclude_pages ? Utils::sanitize_array( $exclude_pages ) : null;
    547547
     
    554554
    555555            if ( ! empty( $urls ) ) {
    556                 update_post_meta( $post_id, '_rock_convert_excluded_urls', $urls );
     556                    update_post_meta( $post_id, '_rock_convert_excluded_urls', $urls );
    557557            }
    558558
    559             // Update image field.
    560             $image = array_map( 'intval', Utils::getArrayValue( $_POST, 'rock-convert-media' ) );
    561             if ( $image ) {
    562                 foreach ( $image as $key => $value ) {
    563                     update_post_meta( $post_id, $key, $value );
     559            $images =  isset( $_POST['rock-convert-media'] ) ? Utils::sanitize_array( $_POST['rock-convert-media'] ) : null;
     560
     561            if( $images ){
     562            $image = array_map( 'intval', $images );
     563                foreach ( $image as $value ) {
     564                    update_post_meta( $post_id, '_rock_convert_image_media', $value );
    564565                }
    565566            }
     
    589590                <input type='hidden' id='<?php echo esc_attr( $name ); ?>-value'
    590591                        class='small-text'
    591                         name='rock-convert-media[<?php echo esc_attr( $name ); ?>]'
     592                        name='rock-convert-media[]'
    592593                        value='<?php echo esc_attr( $value ); ?>' />
    593594                <input type='button' id='<?php echo esc_attr( $name ); ?>'
Note: See TracChangeset for help on using the changeset viewer.