'; if ( !isset( $_REQUEST['action'] ) ) { $url = add_query_arg( array( 'section' => 'general' ), admin_url( 'admin.php?page=affiliates-admin-settings' ) ); } else { $url = add_query_arg( array( 'section' => 'general', 'subsection' => 'robot-cleaner' ), admin_url( 'admin.php?page=affiliates-admin-settings' ) ); } printf( '%s', esc_url( $url ), esc_html__( 'Back', 'affiliates' ) ); echo '
'; return; } if ( isset( $_REQUEST['subsection'] ) && $_REQUEST['subsection'] === 'data-cleaner' ) { Affiliates_Data_Cleaner::admin(); echo ''; if ( !isset( $_REQUEST['action'] ) ) { $url = add_query_arg( array( 'section' => 'general' ), admin_url( 'admin.php?page=affiliates-admin-settings' ) ); } else { $url = add_query_arg( array( 'section' => 'general', 'subsection' => 'data-cleaner' ), admin_url( 'admin.php?page=affiliates-admin-settings' ) ); } printf( '%s', esc_url( $url ), esc_html__( 'Back', 'affiliates' ) ); echo '
'; return; } $robots_table = _affiliates_get_tablename( 'robots' ); if ( isset( $_POST['submit'] ) ) { if ( affiliates_verify_post_nonce( AFFILIATES_ADMIN_SETTINGS_NONCE, 'admin' ) ) { // robots $robots = sanitize_textarea_field( wp_unslash( $_POST['robots'] ?? '' ) ); // preserve newlines $wpdb->query( "DELETE FROM $robots_table" ); if ( !empty( $robots ) ) { $robots = str_replace( ",", "\n", $robots ); $robots = str_replace( "\r", "", $robots ); $robots = explode( "\n", $robots ); $robots = array_unique( $robots ); foreach ( $robots as $robot ) { $robot = trim( $robot ); if ( !empty( $robot ) ) { $query = $wpdb->prepare( "INSERT INTO $robots_table (name) VALUES (%s);", $robot ); $wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } } } $pname = !empty( $_POST['pname'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['pname'] ) ) ) : get_option( 'aff_pname', AFFILIATES_PNAME ); $forbidden_names = array(); if ( !empty( $wp->public_query_vars ) ) { $forbidden_names += $wp->public_query_vars; } if ( !empty( $wp->private_query_vars ) ) { $forbidden_names += $wp->private_query_vars; } if ( !empty( $wp->extra_query_vars ) ) { $forbidden_names += $wp->extra_query_vars; } if ( !preg_match( '/[a-z_]+/', $pname, $matches ) || !isset( $matches[0] ) || $pname !== $matches[0] ) { $pname = get_option( 'aff_pname', AFFILIATES_PNAME ); echo '' .
sprintf(
esc_html__( 'The Affiliate URL parameter name has been changed from %1$s to %2$s.', 'affiliates' ),
'' . esc_html( $old_pname ) . '',
'' . esc_html( $pname ) . ''
) .
'
' . esc_html__( 'If your affiliates are using affiliate links based on the previous Affiliate URL parameter name, they NEED to update their affiliate links.', 'affiliates' ) . '
' . '' . esc_html__( 'Unless the incoming affiliate links reflect the current Affiliate URL parameter name, no affiliate hits, visits or referrals will be recorded.', 'affiliates' ) . '
' . '| '; $caps_table .= esc_html__( 'Role', 'affiliates' ); $caps_table .= ' | '; foreach ( $caps as $cap ) { $caps_table .= ''; $caps_table .= $cap; $caps_table .= ' | '; } $caps_table .= '
| '; $caps_table .= translate_user_role( $rolename ); $caps_table .= ' | '; foreach ( $caps as $capkey => $capname ) { if ( $role->has_cap( $capkey ) ) { $checked = ' checked="checked" '; } else { $checked = ''; } $caps_table .= ''; $role_cap_id = $rolekey.'-'.$capkey; $caps_table .= ''; $caps_table .= ' | '; } $caps_table .= '