/**
* 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 ),
},
} ) }
/>
) ) }
{ 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 (
);
}
function FieldControl( { id, field, value, onChange } ) {
return (
);
}
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 (
);
}
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' ),
},
];
Venda – Marcio Imoveis
Properties listed in Venda
COMPROJETO APROVADO 74,500 €
geralmarcioimoveis-pt
Março 7, 2022
Centro de Braga 12,345,567,890 €
geralmarcioimoveis-pt
Outubro 7, 2021
Investimento 150,000 € para remodelação
geralmarcioimoveis-pt
Setembro 24, 2021
Moradias Novas 450,000 €
geralmarcioimoveis-pt
Junho 12, 2020
Oportunidade 298,000 €
geralmarcioimoveis-pt
Outubro 16, 2019
Banda - 310,000 €
geralmarcioimoveis-pt
Julho 18, 2019