/**
* External dependencies
*/
import { map } from 'lodash';
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import {
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalInputControl as InputControl,
BaseControl,
Flex,
FlexBlock,
FlexItem,
VisuallyHidden,
} from '@wordpress/components';
import { useInstanceId, useViewportMatch } from '@wordpress/compose';
import { closeSmall as removeIcon } from '@wordpress/icons';
/**
* Solid dependencies
*/
import { Heading, TextWeight } from '@ithemes/ui';
/**
* Internal dependencies
*/
import { Select, CreatableSelect } from '@ithemes/security-ui';
import { StyledRuleAction, halfFlexBasis } from './styles';
const DEFAULT = {
inclusive: true,
};
export default function RuleForm( { value, onChange, className } ) {
const id = useInstanceId( RuleForm, 'solid-rule-form' );
const { config = { rules: [ DEFAULT ] } } = value;
const onAndRule = ( after ) => () => {
onChange( {
...value,
config: {
...config,
rules: config.rules.toSpliced( after + 1, 0, DEFAULT ),
},
} );
};
return (
onChange( { ...value, name: next } ) }
label={ __( 'Rule Name', 'better-wp-security' ) }
required
__next36pxDefaultSize
/>
{ config.rules.map( ( rule, i ) => (
onChange( {
...value,
config: {
...config,
rules: config.rules.map( ( oldRule, j ) => j === i ? newRule : oldRule ),
},
} ) }
onDelete={ config.rules.length === 1 ? null : () => onChange( {
...value,
config: {
...config,
rules: config.rules.toSpliced( i, 1 ),
},
} ) }
/>
) ) }
action.value === config.type ) }
onChange={ ( next ) => onChange( {
...value,
config: {
...config,
type: next.value,
type_params: '',
},
} ) }
/>
{ config.type === 'REDIRECT' && (
onChange( {
...value,
config: {
...config,
type_params: next,
},
} ) }
type="url"
label={ __( 'Redirect Location', 'better-wp-security' ) }
__next36pxDefaultSize
/>
) }
);
}
function Rule( { idx, value, onChange, onDelete, onAndRule } ) {
const isLarge = useViewportMatch( 'large' );
const id = useInstanceId( Rule, 'solid-rule-form-rule' );
const selectedField = value.parameter &&
FIELDS.find( ( field ) => isField( value.parameter, field ) );
const allowedOperators = OPERATORS
.filter( ( operator ) => selectedField?.operators === true || selectedField?.operators.includes( operator.value ) );
const selectedOperator = value.match?.type &&
allowedOperators.find( ( operator ) => operator.value === value.match?.type );
return (
{ sprintf(
/* translators: Which number rule is this in the list. */
__( 'Rule %d', 'better-wp-security' ), idx + 1
) }
{ selectedField?.allowSubFields && (
) }
{ onDelete && (
) }
);
}
function FieldControl( { id, field, value, onChange } ) {
return (
onChange( {
...value,
parameter: next.value,
match: {
type: 'equals',
},
} ) }
isOptionSelected={ ( maybeOption, selected ) => selected.some( ( selectedOption ) => isField( maybeOption.value, selectedOption ) ) }
required
/>
);
}
function SubFieldControl( { field, value, onChange } ) {
const { example, sanitize, display } = field.allowSubFields;
return (
onChange( {
...value,
parameter: field.value + sanitize( next ),
} ) }
required
__next36pxDefaultSize
/>
);
}
function OperatorControl( { id, operator, allowedOperators, value, onChange } ) {
return (
onChange( {
...value,
match: {
...( value.match || {} ),
type: next.value,
value: ( () => {
const current = value.match?.value;
if ( ! current ) {
return next.isList ? [] : '';
}
if ( next.isList ) {
return Array.isArray( current ) ? current : [ current ];
}
return Array.isArray( current ) ? current[ 0 ] : current;
} )(),
},
} ) }
isDisabled={ ! allowedOperators.length }
required
/>
);
}
function ValueControl( { id, field, operator, value, onChange } ) {
if ( operator?.isList ) {
return (
( {
value: option,
label: option,
} ) ) }
value={ value.match?.value?.map( ( option ) => ( {
value: option,
label: option,
} ) ) }
onChange={ ( next ) => onChange( {
...value,
match: {
...( value.match || {} ),
value: map( next, 'value' ),
},
} ) }
isMulti
isClearable
required
/>
);
}
if ( field?.listOptions ) {
return (
( {
value: option,
label: option,
} ) ) }
value={ { value: value.match?.value ?? '', label: value.match?.value ?? '' } }
onChange={ ( next ) => onChange( {
...value,
match: {
...( value.match || {} ),
value: next.value,
},
} ) }
isClearable
required
/>
);
}
return (
onChange( {
...value,
match: {
...( value.match || {} ),
value: next,
},
} ) }
disabled={ ! field }
required
__next36pxDefaultSize
/>
);
}
function isField( value, maybeField ) {
if ( maybeField.value === value ) {
return true;
}
if ( maybeField.allowSubFields && value.startsWith( maybeField.value ) ) {
return true;
}
return false;
}
const FIELDS = [
{
value: 'server.REQUEST_URI',
label: __( 'URI', 'better-wp-security' ),
operators: [ 'equals', 'contains', 'not_contains' ],
example: '/test?param=value',
},
{
value: 'server.REQUEST_METHOD',
label: __( 'Request Method', 'better-wp-security' ),
operators: true,
listOptions: [
'GET',
'HEAD',
'POST',
'PUT',
'PATCH',
'DELETE',
'OPTIONS',
],
},
{
value: 'server.CONTENT_TYPE',
label: __( 'Content Type', 'better-wp-security' ),
operators: true,
},
{
value: 'server.HTTP_',
label: __( 'Header', 'better-wp-security' ),
operators: true,
allowSubFields: {
example: 'user-agent',
sanitize( value ) {
return value.toUpperCase().replace( '-', '_' );
},
display( value ) {
return value.toLowerCase().replace( '_', '-' );
},
},
},
{
value: 'cookie.',
label: __( 'Cookie', 'better-wp-security' ),
operators: true,
allowSubFields: {
example: 'my-cookie',
sanitize( value ) {
return value.replace( '.', '_' );
},
display( value ) {
return value;
},
},
},
{
value: 'server.ip',
label: __( 'IP Address' ),
operators: [ 'equals', 'in_array', 'not_in_array' ],
example: '127.0.0.1',
},
];
const OPERATORS = [
{
value: 'equals',
label: __( 'equals', 'better-wp-security' ),
},
{
value: 'contains',
label: __( 'contains', 'better-wp-security' ),
},
{
value: 'not_contains',
label: __( 'does not contain', 'better-wp-security' ),
},
{
value: 'in_array',
label: __( 'is in', 'better-wp-security' ),
isList: true,
},
{
value: 'not_in_array',
label: __( 'is not in', 'better-wp-security' ),
isList: true,
},
];
const ACTIONS = [
{
value: 'BLOCK',
label: __( 'Block', 'better-wp-security' ),
},
{
value: 'REDIRECT',
label: __( 'Redirect', 'better-wp-security' ),
},
{
value: 'LOG',
label: __( 'Log only', 'better-wp-security' ),
},
{
value: 'WHITELIST',
label: __( 'Allow', 'better-wp-security' ),
},
];
T5 Duplex de Luxo no centro – Marcio Imoveis
T5 Duplex de Luxo no centro
500,000 €
Centro da cidade, Braga
Adicionar favoritos
Imprimir
Resultados da pesquisa
Apartamento T5 Duplex, 5º e último andar todo pertencente a esta fração.
Com áreas e vistas fascinantes, 2 quartos suite, garagem muito grande e claro que todo um caderno de encargos de alta qualidade tornam este apartamento em algo único disponível para venda actualmente na nossa cidade.
Para todos os detalhes entre em contato comigo!
Morada: Centro da cidade
país: Portugal
ID: 19736
Price: 500,000 €
Property Size: 262 m2
quartos: 5
C. banho: 4
Gás natural
Lavandaria
Ar condicionado
Varanda
Aspiração central
Estores elétricos
Tetos falsos
Soalho em madeira
Terraço
Elevador
Cozinha equipada
Recuperador de calor
Garagem Box (2 carros)
Suite
Aquecimento central completo
Veja mais
Centro de Braga 12,345,567,890 €
geralmarcioimoveis-pt
Outubro 7, 2021
sdr
dav
mde
dav
dav
dav
dav
dav
dav
dav
dav
dav
dav
dav
dav
dav
dav
dav
mde
dav
dav
dav
dav
dav
mde