Skip to content

Commit d43dcb5

Browse files
committed
Merge branch 'develop' into stable
2 parents 6e29b0e + 3cd3fa2 commit d43dcb5

File tree

8 files changed

+137
-35
lines changed

8 files changed

+137
-35
lines changed

Diff for: .github/workflows/wordpress-plugin-deploy.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Deploy to WordPress.org
22
on:
3-
push:
4-
tags:
5-
- "*"
6-
- "!*-*"
3+
release:
4+
types: [published]
5+
76
jobs:
87
tag:
98
name: New tag

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.lock
2+
/vendor/

Diff for: .wordpress-org/blueprints/blueprint.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"preferredVersions": {
3+
"php": "8.3",
4+
"wp": "latest"
5+
},
6+
"phpExtensionBundles": [
7+
"kitchen-sink"
8+
],
9+
"features": {},
10+
"steps": [
11+
{
12+
"step": "login",
13+
"username": "admin",
14+
"password": "password"
15+
}
16+
],
17+
"landingPage": "\/wp-admin\/edit.php?post_type=page"
18+
}

Diff for: README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Unique Title Checker #
22
**Contributors:** Kau-Boy
33
**Tags:** title, seo, duplicate title, unique title
4-
**Tested up to:** 6.3
5-
**Stable tag:** 1.7.0
4+
**Tested up to:** 6.6
5+
**Stable tag:** 1.7.1
6+
>>>>>>> develop
67
**License:** GPLv3
78
**License URI:** http://www.gnu.org/licenses/gpl-3.0
89

@@ -56,9 +57,9 @@ Yes, you can simply use the filter `unique_title_checker_only_unique_error` with
5657

5758
## Changelog ##
5859

59-
### 1.7.0 ###
60-
* Fixing the detection of Classic editor in WordPress 6.2
61-
* Time invested for this release: 60min
60+
### 1.7.1 ###
61+
* Add blueprint.json file for live demo
62+
* Time invested for this release: 30min
6263

6364
### 1.6.0 ###
6465
* Fixing the check for the Block Editor in new WordPress versions.

Diff for: composer.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "2ndkauboy/unique-title-checker",
3+
"description": "Checks if the title of a post, page or custom post type is unique and warn the editor if not.",
4+
"license": "GPL-3.0-or-later",
5+
"authors": [
6+
{
7+
"name": "Bernhard Kau"
8+
}
9+
],
10+
"minimum-stability": "stable",
11+
"require-dev": {
12+
"php": ">=5.6",
13+
"wp-coding-standards/wpcs": "^3.0",
14+
"phpcompatibility/phpcompatibility-wp": "^2.1"
15+
},
16+
"config": {
17+
"allow-plugins": {
18+
"dealerdirect/phpcodesniffer-composer-installer": true
19+
}
20+
}
21+
}

Diff for: js/unique-title-checker-block-editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var closeListener = wp.data.subscribe( function () {
4343
if ( 'error' === data.status || !unique_title_checker.only_unique_error ) {
4444
( function ( wp ) {
4545
// Overwrite status from 'updated' to 'success' in block editor.
46-
status = 'error' === data.status ? 'error' : 'success';
46+
var status = 'error' === data.status ? 'error' : 'success';
4747
wp.data.dispatch( 'core/notices' ).createNotice(
4848
status, // Can be one of: success, info, warning, error.
4949
data.message, // Text string to display.

Diff for: phpcs.xml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
3+
<description>Generally-applicable sniffs for WordPress plugins.</description>
4+
<!--
5+
#############################################################################
6+
COMMAND LINE ARGUMENTS
7+
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
8+
#############################################################################
9+
-->
10+
11+
<!-- Pass some flags to PHPCS:
12+
p flag: Show progress of the run.
13+
s flag: Show sniff codes in all reports.
14+
-->
15+
<arg value="ps"/>
16+
17+
<!-- Strip the filepaths down to the relevant bit. -->
18+
<arg name="basepath" value="./"/>
19+
20+
<!-- Check up to 8 files simultanously. -->
21+
<arg name="parallel" value="8"/>
22+
23+
<!-- Only check the PHP. CSS/SCSS/JS files are checked separately with linters. -->
24+
<arg name="extensions" value="php"/>
25+
26+
<!-- Enable colors in the output -->
27+
<arg name="colors"/>
28+
29+
<!-- Check all files in this directory and the directories below it. -->
30+
<file>.</file>
31+
32+
<!--
33+
#############################################################################
34+
EXCLUDE SOME FILES AND FOLDERS
35+
#############################################################################
36+
-->
37+
38+
<exclude-pattern>/build/</exclude-pattern>
39+
<exclude-pattern>/vendor/</exclude-pattern>
40+
<exclude-pattern>/node_modules/</exclude-pattern>
41+
42+
<!--
43+
#############################################################################
44+
USE THE WordPress RULESET
45+
#############################################################################
46+
-->
47+
48+
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
49+
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
50+
<config name="minimum_supported_wp_version" value="5.7"/>
51+
52+
<rule ref="WordPress">
53+
<!-- As we use PHP 5.4+ now, we can use the short array syntax -->
54+
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
55+
</rule>
56+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
57+
<properties>
58+
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
59+
<property name="prefixes" type="array" value="Unique_Title_Checker"/>
60+
</properties>
61+
</rule>
62+
<rule ref="WordPress.WP.I18n">
63+
<properties>
64+
<!-- Value: replace the text domain used. Separate multiple prefixes with a comma. -->
65+
<property name="text_domain" type="array" value="unique-title-checker"/>
66+
</properties>
67+
</rule>
68+
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
69+
<properties>
70+
<property name="blank_line_check" value="true"/>
71+
</properties>
72+
</rule>
73+
74+
75+
<!--
76+
#############################################################################
77+
USE THE PHPCompatibility RULESET
78+
#############################################################################
79+
-->
80+
81+
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
82+
<config name="testVersion" value="5.6-"/>
83+
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
84+
<rule ref="PHPCompatibilityWP"/>
85+
86+
</ruleset>

Diff for: unique-title-checker.php

-25
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class Unique_Title_Checker {
7878
* @return object of this class
7979
*/
8080
public static function get_instance() {
81-
8281
if ( null === self::$instance ) {
8382
self::$instance = new self();
8483
}
@@ -93,10 +92,8 @@ public static function get_instance() {
9392
* @return void
9493
*/
9594
public function plugin_setup() {
96-
9795
$this->plugin_url = plugins_url( '/', __FILE__ );
9896
$this->plugin_path = plugin_dir_path( __FILE__ );
99-
$this->load_language( 'unique-title-checker' );
10097

10198
// Enqueue the main JavaScript file.
10299
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -120,27 +117,6 @@ public function plugin_setup() {
120117
public function __construct() {
121118
}
122119

123-
124-
/**
125-
* Loads translation file.
126-
*
127-
* Accessible to other classes to load different language files (admin and front-end for example).
128-
*
129-
* @wp-hook init
130-
*
131-
* @param string $domain The text domain for this plugin.
132-
*
133-
* @return void
134-
*/
135-
public function load_language( $domain ) {
136-
137-
load_plugin_textdomain(
138-
$domain,
139-
false,
140-
dirname( plugin_basename( __FILE__ ) ) . '/languages'
141-
);
142-
}
143-
144120
/**
145121
* Add the JavaScript files to the admin pages
146122
*
@@ -258,7 +234,6 @@ public function uniqueness_admin_notice() {
258234
* @return array The status and message for the response
259235
*/
260236
public function check_uniqueness( $args ) {
261-
262237
// Use the posts_where hook to add thr filter for the post_title, as it is not available through WP_Query args.
263238
add_filter( 'posts_where', array( $this, 'post_title_where' ), 10, 1 );
264239

0 commit comments

Comments
 (0)