Skip to content

Commit

Permalink
[format] PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
osmansufy committed Nov 15, 2024
1 parent 4365707 commit 8997cf1
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions includes/Vendor/SetupWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function __construct() {
}

// define the woocommerce_registration_redirect callback
public function filter_woocommerce_registration_redirect( $var ) {
$url = $var;
public function filter_woocommerce_registration_redirect( $url ) {

$user = wp_get_current_user();

if ( in_array( 'seller', $user->roles, true ) ) {
Expand Down Expand Up @@ -179,8 +179,9 @@ public function setup_wizard_footer() {
* Introduction step.
*/
public function dokan_setup_introduction() {
$dashboard_url = dokan_get_navigation_url();
$default_message = wp_kses_post( __( '<p>Thank you for choosing The Marketplace to power your online store! This quick setup wizard will help you configure the basic settings. <strong>It’s completely optional and shouldn’t take longer than two minutes.</strong></p>', 'dokan-lite' ) );
$dashboard_url = dokan_get_navigation_url();
// translators: %1$s and %2$s are HTML tags for bold text
$default_message = wp_kses_post( sprintf( __( 'Thank you for choosing The Marketplace to power your online store! This quick setup wizard will help you configure the basic settings. %1$sIt’s completely optional and shouldn’t take longer than two minutes.%2$s', 'dokan-lite' ), '<strong>', '</strong>' ) );
$setup_wizard_message = dokan_get_option( 'setup_wizard_message', 'dokan_general', $default_message );
?>
<h1><?php esc_attr_e( 'Welcome to the Marketplace!', 'dokan-lite' ); ?></h1>
Expand Down Expand Up @@ -231,7 +232,7 @@ public function dokan_setup_store() {
<input type="text" id="address[street_1]" name="address[street_1]" value="<?php echo esc_attr( $address_street1 ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[street_1]'] ) ) {
if ( ! empty( $_POST['error_address[street_1]'] ) ) { // phpcs:ignore
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -248,7 +249,7 @@ public function dokan_setup_store() {
<input type="text" id="address[street_2]" name="address[street_2]" value="<?php echo esc_attr( $address_street2 ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[street_2]'] ) ) {
if ( ! empty( $_POST['error_address[street_2]'] ) ) { // phpcs:ignore
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -266,7 +267,7 @@ public function dokan_setup_store() {
<input type="text" id="address[city]" name="address[city]" value="<?php echo esc_attr( $address_city ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[city]'] ) ) {
if ( ! empty( $_POST['error_address[city]'] ) ) { // phpcs:ignore
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -283,7 +284,7 @@ public function dokan_setup_store() {
<input type="text" id="address[zip]" name="address[zip]" value="<?php echo esc_attr( $address_zip ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[zip]'] ) ) {
if ( ! empty( $_POST['error_address[zip]'] ) ) { // phpcs:ignore
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -302,7 +303,7 @@ public function dokan_setup_store() {
</select>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[country]'] ) ) {
if ( ! empty( $_POST['error_address[country]'] ) ) { // phpcs:ignore
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -320,7 +321,7 @@ public function dokan_setup_store() {
<input type="text" id="calc_shipping_state" name="address[state]" value="<?php echo esc_attr( $address_state ); ?>" / placeholder="<?php esc_attr_e( 'State Name', 'dokan-lite' ); ?>">
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[state]'] ) ) {
if ( ! empty( $_POST['error_address[state]'] ) ) { // phpcs:ignore
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand Down Expand Up @@ -521,12 +522,9 @@ public function dokan_setup_store_save() {
if ( empty( $dokan_settings['address']['country'] ) ) {
$is_valid_form = false;
$_POST['error_address[country]'] = 'error';
}
else {
if ( ( isset( $states[ $dokan_settings['address']['country'] ] ) && count( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) || ( ! isset( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) ) ) ) {
$is_valid_form = false;
} elseif ( ( ( isset( $states[ $dokan_settings['address']['country'] ] ) && count( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) ) || ( ! isset( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) ) ) ) {
$is_valid_form = false;
$_POST['error_address[state]'] = 'error';
}
}

if ( ! $is_valid_form ) {
Expand Down Expand Up @@ -608,12 +606,16 @@ public function dokan_setup_payment_save() {
'swift' => $bank['swift'],
];

$user_bank_data = array_filter( $dokan_settings['payment']['bank'], function( $item ) { return ! empty( $item ); } );
$user_bank_data = array_filter(
$dokan_settings['payment']['bank'], function ( $item ) {
return ! empty( $item );
}
);
$require_fields = array_keys( dokan_bank_payment_required_fields() );

$has_bank_information = true;
foreach ( $require_fields as $require_field ) {
if( empty( $user_bank_data[ $require_field ] ) ) {
if ( empty( $user_bank_data[ $require_field ] ) ) {
$_POST[ 'error_' . $require_field ] = 'error';
$has_bank_information = false;
}
Expand Down

0 comments on commit 8997cf1

Please sign in to comment.