Skip to content

Commit

Permalink
Update to 5.4 (#3769)
Browse files Browse the repository at this point in the history
* Linting fixes

* Fix incorrect CSV headers

* Fix save of x-content-type-options: sniff

* Don't encode negative lookaheads

* Remove port from server name

* Bump all packages

* Add PHPStan

* Bulk failed should return a 403

* Improve styling of form textarea

* Add custom IP option

Allow user to select where the IP is taken from

* Remove donation form

* Fix unit tests

* Bump version to 5.4
  • Loading branch information
johngodley authored Jan 1, 2024
1 parent 8c334dd commit 2dca15c
Show file tree
Hide file tree
Showing 72 changed files with 3,774 additions and 3,006 deletions.
6 changes: 3 additions & 3 deletions actions/pass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Pass_Action extends Url_Action {
/**
* Process an external passthrough - a URL that lives external to this server.
*
* @param String $url Target URL.
* @param string $url Target URL.
* @return void
*/
public function process_external( $url ) {
Expand All @@ -21,7 +21,7 @@ public function process_external( $url ) {
/**
* Process an internal passthrough - a URL that lives on the same server. Here we change the request URI and continue without making a remote request.
*
* @param String $target Target URL.
* @param string $target Target URL.
* @return void
*/
public function process_internal( $target ) {
Expand All @@ -42,7 +42,7 @@ public function process_internal( $target ) {
/**
* Is a URL external?
*
* @param String $target URL to test.
* @param string $target URL to test.
* @return boolean
*/
public function is_external( $target ) {
Expand Down
2 changes: 1 addition & 1 deletion api/api-404.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Redirection_Api_404 extends Redirection_Api_Filter_Route {
/**
* 404 API endpoint constructor
*
* @param String $namespace Namespace.
* @param string $namespace Namespace.
*/
public function __construct( $namespace ) {
$orders = [ 'url', 'ip', 'total', 'count', '' ];
Expand Down
2 changes: 1 addition & 1 deletion api/api-group.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class Redirection_Api_Group extends Redirection_Api_Filter_Route {
/**
* 404 API endpoint constructor
*
* @param String $namespace Namespace.
* @param string $namespace Namespace.
*/
public function __construct( $namespace ) {
$orders = [ 'name', 'id', '' ];
Expand Down
2 changes: 1 addition & 1 deletion api/api-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Redirection_Api_Log extends Redirection_Api_Filter_Route {
/**
* Log API endpoint constructor
*
* @param String $namespace Namespace.
* @param string $namespace Namespace.
*/
public function __construct( $namespace ) {
$orders = [ 'url', 'ip', 'total', 'count', '' ];
Expand Down
2 changes: 1 addition & 1 deletion api/api-redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class Redirection_Api_Redirect extends Redirection_Api_Filter_Route {
/**
* Redirect API endpoint constructor
*
* @param String $namespace Namespace.
* @param string $namespace Namespace.
*/
public function __construct( $namespace ) {
$orders = [ 'source', 'last_count', 'last_access', 'position', 'id', '' ];
Expand Down
4 changes: 2 additions & 2 deletions api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ protected function get_filter_args( $order_fields, $filters = [] ) {
/**
* Register a bulk action route
*
* @param String $namespace Namespace.
* @param String $route Route.
* @param string $namespace Namespace.
* @param string $route Route.
* @param Array $orders
* @param Array $filters
* @param Object $callback
Expand Down
10 changes: 10 additions & 0 deletions client/component/form-table/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@
margin-bottom: 0;
line-height: 1.6;
}

textarea {
width: 300px;
height: 100px;
}

.inline-notice {
margin-top: 10px;
margin-bottom: 0;
}
}
150 changes: 0 additions & 150 deletions client/page/options/donation.js

This file was deleted.

57 changes: 0 additions & 57 deletions client/page/options/donation.scss

This file was deleted.

2 changes: 0 additions & 2 deletions client/page/options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { STATUS_IN_PROGRESS, STATUS_COMPLETE } from 'state/settings/type';
import OptionsForm from './options-form';
import DeletePlugin from 'page/options/delete-plugin';
import Placeholder from 'wp-plugin-components/placeholder';
import Donation from './donation';
import Newsletter from './newsletter';

class Options extends React.Component {
Expand All @@ -31,7 +30,6 @@ class Options extends React.Component {

return (
<div>
{ loadStatus === STATUS_COMPLETE && <Donation support={ values.support } /> }
{ loadStatus === STATUS_COMPLETE && <OptionsForm /> }

<Newsletter newsletter={ newsletter } />
Expand Down
18 changes: 5 additions & 13 deletions client/page/options/options-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/

import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { __ } from '@wordpress/i18n';
import { connect } from 'react-redux';

Expand All @@ -11,11 +11,12 @@ import { connect } from 'react-redux';
*/
import { saveSettings } from 'state/settings/action';
import { STATUS_IN_PROGRESS } from 'state/settings/type';
import { FormTable, TableRow } from 'component/form-table';
import { FormTable } from 'component/form-table';
import { Button } from 'wp-plugin-components';
import LogOptions from './log-options';
import OtherOptions from './other-options';
import UrlOptions from './url-options';
import './style.scss';

function supportLink( rel, anchor ) {
return 'https://redirection.me/support/' + rel + ( anchor ? '/#' + anchor : '' );
Expand Down Expand Up @@ -43,22 +44,13 @@ function OptionsForm( props ) {
}

// Update local settings if values change
useEffect(() => {
useEffect( () => {
setSettings( values );
}, [ values ]);
}, [ values ] );

return (
<form onSubmit={ onSubmit }>
<FormTable>
<TableRow title="">
<label>
<input type="checkbox" checked={ support } name="support" onChange={ onChange } />
<span className="sub">
{ __( "I'm a nice person and I have helped support the author of this plugin", 'redirection' ) }
</span>
</label>
</TableRow>

<LogOptions settings={ settings } onChange={ onChange } getLink={ supportLink } />
<UrlOptions settings={ settings } onChange={ onChange } getLink={ supportLink } groups={ groups } postTypes={ postTypes } />

Expand Down
Loading

0 comments on commit 2dca15c

Please sign in to comment.