Skip to content

Commit

Permalink
Merge pull request #12 from WPDevelopers/64396-dev
Browse files Browse the repository at this point in the history
WordPress 6.6 Compatibility
  • Loading branch information
priyomukul authored Jul 16, 2024
2 parents 7ceab1a + 53855f4 commit 4e0518d
Show file tree
Hide file tree
Showing 17 changed files with 10,253 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
],
"@babel/preset-react"
]
}
}
2 changes: 1 addition & 1 deletion assets/js/simple-301-redirects.core.min.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-i18n', 'wp-polyfill'), 'version' => 'd587d386c8c9a1032e7d0ce98fb63c9d');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-i18n'), 'version' => '373b223831b627d8700c');
2 changes: 1 addition & 1 deletion assets/js/simple-301-redirects.core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion includes/Admin/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function () {
wp_enqueue_script(
'simple-301-redirects-admin-core',
SIMPLE301REDIRECTS_ASSETS_URI . 'js/simple-301-redirects.core.min.js',
$dependencies['dependencies'],
array_merge( $dependencies['dependencies'], ['regenerator-runtime'] ),
$dependencies['version'],
true
);
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"prop-types": "^15.7.2"
},
"devDependencies": {
"@wordpress/dependency-extraction-webpack-plugin": "^4.0.0",
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@wordpress/i18n": "^4.16.0",
"@wordpress/scripts": "^24.0.0"
"@wordpress/scripts": "^27.0.0"
}
}
12 changes: 8 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Simple 301 Redirects By BetterLinks - Easy WordPress Redirect Manager for Redirects, 404 Error Log & More ===
Contributors: wpdevteam, asif2bd, re_enter_rupok, scottnelle
Tags: 301 redirect, 404 error log, redirect url, link shortener, url redirects, 301, shortlinks, links, permalink, redirects, seo redirects, url redirect, url, pretty links, short links, link tracking, affiliate links, urls
Requires at least: 5.0
Tested up to: 6.3
Requires PHP: 5.4
Stable tag: 2.0.9
Requires at least: 5.3
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 2.0.10
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -126,6 +126,10 @@ Visit [WPDeveloper](https://wpdeveloper.net/) to learn more about how to do bett

== Changelog ==

= 2.0.10 - 16/07/2024 =
* Added: WordPress 6.6 Compatibility
* Few minor bug fix and improvements

= 2.0.9 - 27/09/2023 =
* Fixed: Import Related Issue.
* Few minor bug fix and improvements
Expand Down
20 changes: 12 additions & 8 deletions src/components/BetterLinks/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React, { useState } from 'react';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import axios from 'axios';
import InstallPlugin from './../../components/InstallPlugin';
const propTypes = {};
const defaultProps = {};

import { plugin_root_url, s3r_nonce, is_betterlinks_activated, hide_btl_notice } from './../../utils/helper';
export default function BetterLinks(props) {
const [isHideNotice, setHideNotice] = useState(hide_btl_notice);
Expand All @@ -19,7 +17,7 @@ export default function BetterLinks(props) {
},
(error) => {
console.log(error);
}
},
);
};
return (
Expand All @@ -32,8 +30,16 @@ export default function BetterLinks(props) {
<div className="simple301redirects__betterlinks__content">
<h3>{__('BetterLinks – Shorten, Track and Manage any URL', 'simple-301-redirects')}</h3>
<h4>
{__('Install BetterLinks to get the best out of Simple 301 Redirects and get access to more advanced features. Check out the features below', 'simple-301-redirects')}
<img width="18" style={{ transform: 'translateY(6px) scale(1.5)', marginLeft: 8 }} src={plugin_root_url + 'assets/images/pointing-down.svg'} alt="logo" />
{__(
'Install BetterLinks to get the best out of Simple 301 Redirects and get access to more advanced features. Check out the features below',
'simple-301-redirects',
)}
<img
width="18"
style={{ transform: 'translateY(6px) scale(1.5)', marginLeft: 8 }}
src={plugin_root_url + 'assets/images/pointing-down.svg'}
alt="logo"
/>
</h4>
<ul>
<li>{__('Easy-to-use & Simple Link Shortener', 'simple-301-redirects')}</li>
Expand All @@ -53,5 +59,3 @@ export default function BetterLinks(props) {
</React.Fragment>
);
}
BetterLinks.propTypes = propTypes;
BetterLinks.defaultProps = defaultProps;
8 changes: 0 additions & 8 deletions src/components/Documentation/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import React, { useState } from 'react';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import { plugin_root_url } from './../../utils/helper';

const propTypes = {};

const defaultProps = {};

export default function Documentation(props) {
const [isOpen, setOpen] = useState(false);
return (
Expand Down Expand Up @@ -97,6 +92,3 @@ export default function Documentation(props) {
</React.Fragment>
);
}

Documentation.propTypes = propTypes;
Documentation.defaultProps = defaultProps;
6 changes: 1 addition & 5 deletions src/components/InstallPlugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ const propTypes = {
label: PropTypes.string,
};

const defaultProps = {
label: '',
};

export default function InstallPlugin({ label }) {
export default function InstallPlugin({ label = '' }) {
const [installButtonMessage, setInstallButtonMessage] = useState(label);
const installHandler = async () => {
setInstallButtonMessage('Installing...');
Expand All @@ -36,4 +33,3 @@ export default function InstallPlugin({ label }) {
}

InstallPlugin.propTypes = propTypes;
InstallPlugin.defaultProps = defaultProps;
8 changes: 1 addition & 7 deletions src/components/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ const propTypes = {
isNewLink: PropTypes.bool,
clickHandler: PropTypes.func,
};
const defaultProps = {
request: '',
destination: '',
isNewLink: false,
};
export default function Link({ request, destination, isNewLink, clickHandler }) {
export default function Link({ request = '', destination = '', isNewLink = false, clickHandler }) {
const [localRequest, setLocalRequest] = useState('');
const [localDestination, setDestination] = useState('');
useEffect(() => {
Expand Down Expand Up @@ -121,4 +116,3 @@ export default function Link({ request, destination, isNewLink, clickHandler })
);
}
Link.propTypes = propTypes;
Link.defaultProps = defaultProps;
11 changes: 1 addition & 10 deletions src/components/Tools/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import axios from 'axios';
import { s3r_nonce } from './../../utils/helper';

const propTypes = {};

const defaultProps = {};

export default function Tools(props) {
const [isOpen, setOpen] = useState(false);
const [importResponse, setImportResponse] = useState(false);
useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
Expand Down Expand Up @@ -72,7 +66,4 @@ export default function Tools(props) {
</div>
</React.Fragment>
);
}

Tools.propTypes = propTypes;
Tools.defaultProps = defaultProps;
}
10 changes: 1 addition & 9 deletions src/components/TopBar/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import React from 'react';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import { plugin_root_url } from './../../utils/helper';

const propTypes = {};

const defaultProps = {};

export default function TopBar(props) {
return (
<React.Fragment>
Expand All @@ -18,7 +13,4 @@ export default function TopBar(props) {
</div>
</React.Fragment>
);
}

TopBar.propTypes = propTypes;
TopBar.defaultProps = defaultProps;
}
9 changes: 1 addition & 8 deletions src/components/WildCards/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import axios from 'axios';
import PropTypes from 'prop-types';
import { s3r_nonce } from './../../utils/helper';
const propTypes = {};

const defaultProps = {};

export default function WildCards(props) {
const [savedText, setSavedText] = useState('');
Expand Down Expand Up @@ -60,7 +56,4 @@ export default function WildCards(props) {
)}
</React.Fragment>
);
}

WildCards.propTypes = propTypes;
WildCards.defaultProps = defaultProps;
}
9 changes: 1 addition & 8 deletions src/containers/Simple301Redirects.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import TopBar from './../components/TopBar';
import ManageLinks from './group/ManageLinks';
import BetterLinks from './../components/BetterLinks';
import Documentation from './../components/Documentation';
import Tools from './../components/Tools';
const propTypes = {};

const defaultProps = {};

export default function Simple301Redirects(props) {
return (
Expand All @@ -25,7 +21,4 @@ export default function Simple301Redirects(props) {
</div>
</React.Fragment>
);
}

Simple301Redirects.propTypes = propTypes;
Simple301Redirects.defaultProps = defaultProps;
}
10 changes: 1 addition & 9 deletions src/containers/group/ManageLinks.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import { site_url, s3r_nonce, is_betterlinks_activated } from './../../utils/helper';
import WildCards from './../../components/WildCards';
import Link from './../../components/Link';

const propTypes = {};

const defaultProps = {};

export default function ManageLinks(props) {
const [links, setLinks] = useState({});
useEffect(() => {
Expand Down Expand Up @@ -125,7 +120,4 @@ export default function ManageLinks(props) {
</div>
</React.Fragment>
);
}

ManageLinks.propTypes = propTypes;
ManageLinks.defaultProps = defaultProps;
}
6 changes: 3 additions & 3 deletions wp-simple-301-redirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://wpdeveloper.net/
* Text Domain: simple-301-redirects
* Domain Path: /languages
* Version: 2.0.9
* Version: 2.0.10
*/

/* Copyright 2009-2021 WPDeveloper
Expand Down Expand Up @@ -69,7 +69,7 @@ public function on_plugins_loaded()

public function define_constants()
{
define('SIMPLE301REDIRECTS_VERSION', '2.0.9');
define('SIMPLE301REDIRECTS_VERSION', '2.0.10');
define('SIMPLE301REDIRECTS_SETTINGS_NAME', '301_redirects');
define('SIMPLE301REDIRECTS_PLUGIN_FILE', __FILE__);
define('SIMPLE301REDIRECTS_PLUGIN_BASENAME', plugin_basename(__FILE__));
Expand Down Expand Up @@ -169,7 +169,7 @@ public function redirect() {
* @return void
*/
public function get_address() {
if( !( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ) ) return;
if( ! isset( $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'] ) ) return;

// return the full address
return $this->get_protocol().'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
Expand Down
Loading

0 comments on commit 4e0518d

Please sign in to comment.