Skip to content

Commit

Permalink
Merge pull request #14 from rtCamp/develop
Browse files Browse the repository at this point in the history
Version update v1.0.2
  • Loading branch information
vaishaliagola27 authored Dec 17, 2020
2 parents 295d6f8 + 19209ae commit 5aede1a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 26 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ This plugin lets you mention a user or a post (including Custom Post Types) in a

**Author:** rtCamp

**Contributors:** rtcamp, sid177, dharmin
**Contributors:** rtcamp, sid177, dharmin, vaishaliagola27

**Tags:** Mentions, User mentions, Post mentions, Custom post types mentions, CPT mentions

**Requires at least:** 5.0

**Tested up to:** 5.5
**Tested up to:** 5.6

**Requires PHP version:** 7.0

**Stable tag:** 1.0.1
**Stable tag:** 1.0.2

**License:** GPLv2 or later (of course!)

Expand Down
2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"prod": "cross-env NODE_ENV=production webpack --mode production --progress",
"dev": "cross-env NODE_ENV=development webpack --watch --mode development --progress",
"eslint:fix": "eslint --fix",
"language:make-po": "wp i18n make-pot ../ --exclude=\"assets\" ../languages/wp-mention-links.po",
"language:make-po": "wp i18n make-pot ../ --exclude=\"assets\" ../languages/wp-mentions-links.po",
"language": "run-s \"language:*\""
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion inc/classes/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function block_enqueue_scripts() {
if ( ! empty( $supported_cpts ) && is_array( $supported_cpts ) ) {
$localize_data['supportedCPTs'] = $supported_cpts;
}

$selected_field = get_option( MENTION_LINKS_FIELD_SETTING_NAME );
if ( ! empty( $selected_field ) ) {
$localize_data['selectedUserField'] = $selected_field;
Expand Down
26 changes: 22 additions & 4 deletions inc/classes/plugin-configs/class-plugin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,27 @@ protected function __construct() {

add_action( 'admin_init', [ $this, 'admin_init' ] );
add_action( 'admin_menu', [ $this, 'admin_menu' ] );
add_action( 'admin_notices', [ $this, 'admin_notices' ] );

}

/**
* Show notice after Mention Link option are saved.
*/
public function admin_notices() {

global $current_screen;

if ( ! empty( $current_screen ) && 'settings_page_wp-mention-links' === $current_screen->id ) {

$option = get_option( MENTION_LINKS_ENABLED_CPTS_SETTING_NAME );

if ( empty( $option ) && 'true' === filter_input( INPUT_GET, 'settings-updated', FILTER_SANITIZE_STRING ) ) {
add_settings_error( MENTION_LINKS_ENABLED_CPTS_SETTING_NAME, 'blank_settings_updated', __( 'If no options for Custom Post Types support is selected, Posts and Pages will be used for Mention Links.', 'wp-mention-links' ), 'notice' );
}
}
}

/**
* Hooked to admin_menu action.
*
Expand Down Expand Up @@ -89,7 +107,7 @@ public function admin_init() {
[ $this, 'wpml_setting_section_cb' ],
MENTION_LINKS_PLUGIN_SLUG
);

register_setting( MENTION_LINKS_PLUGIN_SLUG, MENTION_LINKS_FIELD_SETTING_NAME );
add_settings_field(
MENTION_LINKS_FIELD_SETTING_NAME,
Expand Down Expand Up @@ -150,7 +168,7 @@ public function field_setting_cb( $args ) {
public function enabled_cpts_setting_cb( $args ) {

$option = get_option( MENTION_LINKS_ENABLED_CPTS_SETTING_NAME );

// Convert options array in key => value to increase performance.
if ( ! empty( $option ) && is_array( $option ) ) {
$array = $option;
Expand All @@ -172,15 +190,15 @@ public function enabled_cpts_setting_cb( $args ) {
if ( 'attachment' === $key ) {
continue;
}

$rest_base = $post_type->name;
// The mentions are going to use rest API eventually, so we won't show CPTs which doesn't have rest_base.
if ( ! empty( $post_type->rest_base ) ) {
$rest_base = $post_type->rest_base;
}

$checked = '';

// Check if option value is already saved and current post type exists in the value array.
// Else check if option value is not already saved and check default supported post types.
if ( ! empty( $option[ $rest_base ] ) || ( ! is_array( $option ) && ! empty( $this->default_supported_post_types[ $post_type->name ] ) ) ) {
Expand Down
32 changes: 18 additions & 14 deletions languages/wp-mentions-links.po
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright (C) 2020 rtCamp
# This file is distributed under the same license as the Mention Links plugin.
# This file is distributed under the GPL2.
msgid ""
msgstr ""
"Project-Id-Version: Mention Links 1.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-mention-links\n"
"Project-Id-Version: Mention Links 1.0.2\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mention-links\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2020-06-24T13:19:33+00:00\n"
"POT-Creation-Date: 2020-12-17T13:27:09+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.4.0\n"
"X-Domain: wp-mention-links\n"
Expand All @@ -23,7 +23,7 @@ msgid "https://github.com/rtCamp/wp-mention-links"
msgstr ""

#. Description of the plugin
msgid "Gutenberg autocomplete for posts and users."
msgid "Gutenberg autocomplete for posts and users. Type <code>@</code> to link to an author or <code>#</code> to link to a post, page, or custom post type."
msgstr ""

#. Author of the plugin
Expand All @@ -34,34 +34,38 @@ msgstr ""
msgid "https://rtcamp.com"
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:68
msgid "Settings Saved"
#: inc/classes/plugin-configs/class-plugin-settings.php:53
msgid "If no options for Custom Post Types support is selected, Posts and Pages will be used for Mention Links."
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:79
#: inc/classes/plugin-configs/class-plugin-settings.php:91
msgid "Save Settings"
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:102
#: inc/classes/plugin-configs/class-plugin-settings.php:114
msgid "Display username or display-name"
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:111
#: inc/classes/plugin-configs/class-plugin-settings.php:124
msgid "Custom Post Types support"
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:138
#: inc/classes/plugin-configs/class-plugin-settings.php:152
msgid "Display Name"
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:139
#: inc/classes/plugin-configs/class-plugin-settings.php:153
msgid "Username"
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:142
#: inc/classes/plugin-configs/class-plugin-settings.php:156
msgid "Whether to show user's display-name or username while mentioning them."
msgstr ""

#: inc/classes/plugin-configs/class-plugin-settings.php:208
#: inc/classes/plugin-configs/class-plugin-settings.php:232
msgid "If a post type doesn't support REST API, then it won't be displayed here."
msgstr ""

#: mention-links.php:36
msgid "Settings"
msgstr ""
2 changes: 1 addition & 1 deletion mention-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://rtcamp.com
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Version: 1.0.1
* Version: 1.0.2
* Text Domain: wp-mention-links
*
* @package wp-mention-links
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: rtcamp, sid177, dharmin
Tags: Mentions, User mentions, Post mentions, Custom post types mentions, CPT mentions
Requires at least: 5.0
Tested up to: 5.5
Tested up to: 5.6
Requires PHP: 7.0
Stable tag: 1.0.1
Stable tag: 1.0.2
License: GPLv2 or later (of course!)
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -75,6 +75,9 @@ Same [GPL](http://www.gnu.org/licenses/gpl-2.0.txt) that WordPress uses!

== Changelog ==

= 1.0.2 =
* Display notice when Custom Post Types support option are not selected.

= 1.0.1 =
* Initial release

Expand Down

0 comments on commit 5aede1a

Please sign in to comment.