From 1a5dc8af74d56f43f455581505df04e85d7553e1 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 1 Apr 2020 17:25:46 -1000 Subject: [PATCH 01/16] Meta: Confirm WordPress 5.4 compatibility. --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 7bfcb92..55515f7 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate: https://gum.co/cnr-donate Tags: cornerstone, cms, content, management, system, structure, organization, sections Plugin Link: http://archetyped.com/tools/cornerstone/ Requires at least: 5.3 -Tested up to: 5.3 +Tested up to: 5.4 Stable tag: trunk Enhanced content management for WordPress From 0bad346977bbc663b29cf2cebba16b2931d795af Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 28 May 2020 16:15:13 -1000 Subject: [PATCH 02/16] fix(Utilities): `count()` used on non-Countable value. Method: `utilities::get_action()` Reported by: @nikelaos - https://wordpress.org/support/topic/get-some-warnings/ --- includes/class.utilities.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/includes/class.utilities.php b/includes/class.utilities.php index a8a05ff..d1a02c3 100644 --- a/includes/class.utilities.php +++ b/includes/class.utilities.php @@ -847,34 +847,36 @@ function get_plugin_textdomain() { * @param mixed $default (optional) Default action if no action exists * @return string Current action */ - function get_action($default = null) { + function get_action( $default = null ) { $action = ''; - - //Check if action is set in URL - if ( isset($_GET['action']) ) + + // Check if action is set in URL + if ( isset( $_GET['action'] ) ) { $action = $_GET['action']; - //Otherwise, Determine action based on plugin plugin admin page suffix - elseif ( isset($_GET['page']) && ($pos = strrpos($_GET['page'], '-')) && $pos !== false && ( $pos != count($_GET['page']) - 1 ) ) - $action = trim(substr($_GET['page'], $pos + 1), '-_'); + } elseif ( isset( $_GET['page'] ) && ( $pos = strrpos( $_GET['page'], '-' ) ) && $pos !== false && ( $pos != strlen( $_GET['page'] ) - 1 ) ) { + // Otherwise, Determine action based on plugin admin page suffix + $action = trim( substr( $_GET['page'], $pos + 1 ), '-_' ); + } - //Determine action for core admin pages - if ( ! isset($_GET['page']) || empty($action) ) { + // Determine action for core admin pages + if ( ( ! isset( $_GET['page'] ) || empty( $action ) ) && isset( $_SERVER['SCRIPT_NAME'] ) ) { $actions = array( - 'add' => array('page-new', 'post-new'), - 'edit-item' => array('page', 'post'), - 'edit' => array('edit', 'edit-pages') + 'add' => array( 'page-new', 'post-new' ), + 'edit-item' => array( 'page', 'post' ), + 'edit' => array( 'edit', 'edit-pages' ), ); - $page = basename($_SERVER['SCRIPT_NAME'], '.php'); - + $page = basename( $_SERVER['SCRIPT_NAME'], '.php' ); + foreach ( $actions as $act => $pages ) { - if ( in_array($page, $pages) ) { + if ( in_array( $page, $pages ) ) { $action = $act; break; } } } - if ( empty($action) ) + if ( empty( $action ) ) { $action = $default; + } return $action; } From 8fe4ff3c9d33d21a0301c7856a91f323627daf1c Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 28 May 2020 16:17:09 -1000 Subject: [PATCH 03/16] doc: Update readme (0.7.8) --- readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.txt b/readme.txt index 55515f7..b61b6de 100644 --- a/readme.txt +++ b/readme.txt @@ -60,6 +60,10 @@ Post your questions/comments at [Cornerstone's official issue tracker](https://g == Changelog == += 0.7.8 = + +* Fix: Utilities: `count()` used on non-Countable value. (props @nikelaos) + = 0.7.7 = * Fix: Spelling. From 45ca8d0fb8410b7f1883dab2a0ab39f0872d8e3c Mon Sep 17 00:00:00 2001 From: SM Date: Thu, 3 Sep 2020 15:39:42 -1000 Subject: [PATCH 04/16] meta: confirm WordPress 5.5 compatibility --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index b61b6de..6f4dfde 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate: https://gum.co/cnr-donate Tags: cornerstone, cms, content, management, system, structure, organization, sections Plugin Link: http://archetyped.com/tools/cornerstone/ Requires at least: 5.3 -Tested up to: 5.4 +Tested up to: 5.5 Stable tag: trunk Enhanced content management for WordPress From 7ca3cd3b093093a6c91450eff9db89fb7a3ff5af Mon Sep 17 00:00:00 2001 From: SM Date: Thu, 10 Dec 2020 17:45:28 -1000 Subject: [PATCH 05/16] meta: confirm WordPress 5.6 compatibility --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 6f4dfde..0bbf9f0 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate: https://gum.co/cnr-donate Tags: cornerstone, cms, content, management, system, structure, organization, sections Plugin Link: http://archetyped.com/tools/cornerstone/ Requires at least: 5.3 -Tested up to: 5.5 +Tested up to: 5.6 Stable tag: trunk Enhanced content management for WordPress From 325a26dae9467366d18cb515dafa19a7c2888938 Mon Sep 17 00:00:00 2001 From: SM Date: Thu, 30 Sep 2021 11:57:42 -1000 Subject: [PATCH 06/16] meta: confirm WordPress 5.8 compatibility --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 0bbf9f0..586a90b 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate: https://gum.co/cnr-donate Tags: cornerstone, cms, content, management, system, structure, organization, sections Plugin Link: http://archetyped.com/tools/cornerstone/ Requires at least: 5.3 -Tested up to: 5.6 +Tested up to: 5.8 Stable tag: trunk Enhanced content management for WordPress From 0800e9a3e063cf91f63c58863a7e3f5a0b6927e7 Mon Sep 17 00:00:00 2001 From: SM Date: Thu, 30 Sep 2021 15:59:01 -1000 Subject: [PATCH 07/16] chore(github): add Issue templates --- .github/ISSUE_TEMPLATE/0_support-ticket.md | 19 +++++++++++++++++ .github/ISSUE_TEMPLATE/1_feature-request.md | 23 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 +++++ .github/ISSUE_TEMPLATE/feedback.md | 10 +++++++++ 4 files changed, 57 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/0_support-ticket.md create mode 100644 .github/ISSUE_TEMPLATE/1_feature-request.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feedback.md diff --git a/.github/ISSUE_TEMPLATE/0_support-ticket.md b/.github/ISSUE_TEMPLATE/0_support-ticket.md new file mode 100644 index 0000000..1c002f0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0_support-ticket.md @@ -0,0 +1,19 @@ +--- +name: Support Ticket +about: Get support for an issue you are experiencing +title: "" +labels: support +assignees: '' + +--- + +## Description of Problem + +(Clearly describe the issue you are experiencing here, and fill in the necessary details below) + +## Details + +* URL of Page exhibiting problem: +* Browser(s) exhibiting problem (Firefox, Chrome, etc.): +* Version of CNR Installed: +* Other plugins installed: diff --git a/.github/ISSUE_TEMPLATE/1_feature-request.md b/.github/ISSUE_TEMPLATE/1_feature-request.md new file mode 100644 index 0000000..bd2c569 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_feature-request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Enhance! Suggest a new feature for CNR. +title: "[Request]: " +labels: enhancement +assignees: '' + +--- + +## Description of feature + +(Describe your feature or idea here) + +## This feature would be used to + +(Describe usage here) + +## If you added this feature, I would: + +a) Eat my hat +b) Jump for joy +c) Shave my cat +d) All of the above diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..fa7f0cb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Feedback & Support + url: https://github.com/archetyped/cornerstone/wiki/Support-&-Feedback + about: How to get support and share feedback for Cornerstone \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feedback.md b/.github/ISSUE_TEMPLATE/feedback.md new file mode 100644 index 0000000..6606437 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feedback.md @@ -0,0 +1,10 @@ +--- +name: Feedback +about: Share your feedback +title: "[Feedback]: " +labels: feedback +assignees: '' + +--- + + From c880d9cb79046348fa6873d40744300ea86bbfd7 Mon Sep 17 00:00:00 2001 From: SM Date: Thu, 30 Sep 2021 16:12:46 -1000 Subject: [PATCH 08/16] fix(github/issue templates): update support page title --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index fa7f0cb..07673d3 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - - name: Feedback & Support + - name: Support & Feedback url: https://github.com/archetyped/cornerstone/wiki/Support-&-Feedback about: How to get support and share feedback for Cornerstone \ No newline at end of file From ccf4bb21406ff0a2ab55347ee3f411d857b20884 Mon Sep 17 00:00:00 2001 From: SM Date: Thu, 30 Sep 2021 16:19:26 -1000 Subject: [PATCH 09/16] docs: update support URLs --- README.md | 2 +- main.php | 2 +- readme.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 305be50..41d2646 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,5 @@ Cornerstone transforms WordPress into a full-fledged Content Management System. ## Support Found a bug or otherwise experiencing an issue with Cornerstone? [Report the issue here][issue-report] -[issue-report]: https://github.com/archetyped/cornerstone/wiki/Reporting-Issues "Report an issue" +[issue-report]: https://github.com/archetyped/cornerstone/wiki/Support-&-Feedback "Report an issue" [home]: http://archetyped.com/tools/cornerstone/ "Cornerstone home page" diff --git a/main.php b/main.php index c067172..df01eca 100644 --- a/main.php +++ b/main.php @@ -14,7 +14,7 @@ * Text Domain: cornerstone * Author: Archetyped * Author URI: http://archetyped.com - * Support URI: https://github.com/archetyped/cornerstone/wiki/Reporting-Issues + * Support URI: https://github.com/archetyped/cornerstone/wiki/Support-&-Feedback */ $cnr = null; diff --git a/readme.txt b/readme.txt index 586a90b..d832f31 100644 --- a/readme.txt +++ b/readme.txt @@ -50,7 +50,7 @@ No upgrade notices == Frequently Asked Questions == -Post your questions/comments at [Cornerstone's official issue tracker](https://github.com/archetyped/cornerstone/wiki/Reporting-Issues). +Post your questions/comments at [Cornerstone's official issue tracker](https://github.com/archetyped/cornerstone/wiki/Support-&-Feedback). == Screenshots == From 9fd40306027203869a206205f651a808e69ac74b Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 26 Jan 2022 08:28:27 -1000 Subject: [PATCH 10/16] meta: confirm WordPress 5.9 compatibility --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index d832f31..d2e423d 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate: https://gum.co/cnr-donate Tags: cornerstone, cms, content, management, system, structure, organization, sections Plugin Link: http://archetyped.com/tools/cornerstone/ Requires at least: 5.3 -Tested up to: 5.8 +Tested up to: 5.9 Stable tag: trunk Enhanced content management for WordPress From 407237a0d74da2633ffac362ff0b48c66119ce3a Mon Sep 17 00:00:00 2001 From: Archetyped Date: Tue, 31 May 2022 15:07:53 -1000 Subject: [PATCH 11/16] meta: confirm WordPress 6.0 compatibility --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index d2e423d..273c479 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate: https://gum.co/cnr-donate Tags: cornerstone, cms, content, management, system, structure, organization, sections Plugin Link: http://archetyped.com/tools/cornerstone/ Requires at least: 5.3 -Tested up to: 5.9 +Tested up to: 6.0 Stable tag: trunk Enhanced content management for WordPress From aca5f8c79f8b0a982b2384c3f70a6b6d7cb0d6b0 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 2 Nov 2022 14:50:52 -1000 Subject: [PATCH 12/16] chore: add .gitignore file --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67257d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.ds_store +.vscode +.sass-cache +node_modules/ +vendor/ \ No newline at end of file From 16c1346c37ab14bd23303d99276e6352203d107d Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 2 Nov 2022 14:47:54 -1000 Subject: [PATCH 13/16] refactor (admin/js): custom permalink structure option integration * Handle HTML structure for both legacy and WordPress 6.1+. --- js/lib.structure.admin.js | 122 ++++++++++++++++++++++++++++++-------- 1 file changed, 98 insertions(+), 24 deletions(-) diff --git a/js/lib.structure.admin.js b/js/lib.structure.admin.js index 7053ebf..7eacac0 100644 --- a/js/lib.structure.admin.js +++ b/js/lib.structure.admin.js @@ -1,7 +1,7 @@ /** * Structure Administration * @package Cornerstone - * @subpackage Structure + * @subpackage Structure */ (function($) { @@ -9,38 +9,112 @@ if ( CNR && CNR.structure && CNR.structure.extend ) CNR.structure.extend('admin', { parent: CNR.structure, options: {}, - + manage_option: function() { //Continue processing if permalink option has been defined if ( this.options && this.options.label && this.options.example && this.parent.options.permalink_structure ) { + const opts = this.options; + opts.parent = this.parent.options; var o = this.options; var po = this.parent.options; - //Get options table - var opts_list = $('.wrap .form-table tbody:first'); - var rows = $(opts_list).find('tr'); - //Insert custom option - if (rows.length) { - var last = $(rows).get(rows.length - 1); - var option = $(opts_list).find('tr:first').clone(); - var input = $(option).find('input'); - //Input - $(input).val(po.permalink_structure); - if (po.permalink_structure == $('#permalink_structure').val()) { - $(input).attr('checked', 'checked'); + // Options handling (WP 6.1+) + const cfg = { + selectors: { + match: '.structure-selection', + template: '.structure-selection > .row', + input: 'input[type="radio"]', + label: 'label', + example: 'p > code', + }, + elements: { + template: null, + base: null, + input: null, + label: null, + example: null, + custom: document.getElementById( 'permalink_structure' ), + }, + values: { + id_base: 'cnr-structured', + }, + legacy: { + selectors: { + template: '.permalink-structure tr', + input: 'input[type="radio"]', + label: 'label', + example: 'td > code', + }, + }, + }; + // Set up values + cfg.values.input_id = 'permalink-input-' + cfg.values.id_base; + cfg.values.example_id = 'permalink-' + cfg.values.id_base; + // Determine if legacy configuration should be used. + if ( !document.querySelector(cfg.selectors.match) ) { + let prop; + for ( prop in cfg.legacy ) { + cfg[ prop ] = cfg.legacy[ prop ]; + } + } + // Reference elements object. + const els = cfg.elements; + // Retrieve single structure option to use as template for custom option. + els.template = document.querySelector( cfg.selectors.template ); + // Stop if option not found. + if ( !els.template ) { + return false; + } + // Clone option element. + els.base = els.template.cloneNode( true ); + // Input element. + els.input = els.base.querySelector( cfg.selectors.input ); + if ( !els.input ) { + return false; + } + els.input.setAttribute( 'id', cfg.values.input_id ); + els.input.setAttribute( 'value', opts.parent.permalink_structure ); + if ( els.custom ) { + if ( els.custom.value === opts.parent.permalink_structure ) { + els.input.setAttribute( 'checked', 'checked' ); } else { - $(input).removeAttr('checked'); + els.input.removeAttribute( 'checked' ); + } + // Event handler (option selected). + els.input.addEventListener('change', function() { + if ( els.custom.value === this.value ) { + return false; + } + els.custom.value = this.value; + }); + } + // Label element. + els.label = els.base.querySelector( cfg.selectors.label ); + if ( els.label ) { + // Attributes. + els.label.setAttribute( 'for', els.input.getAttribute( 'id' ) ); + // Text. + // Fallback: Set text for label element directly. + let labelNode = els.label; + // Update text node within label element. + if ( els.label.childNodes.length > 1 ) { + // Get first text node. + let childNode = Array.from( els.label.childNodes ).find( cnode => cnode.nodeType === Node.TEXT_NODE ); + if ( childNode ) { + labelNode = childNode; + } } - //Label - var label = $(option).find('label'); - //Move input element out of label element - $(label).text(o.label).prepend(input); - //Example text - $(option).find('td code').text(o.example); - //Insert element before last option in table - $(last).before($(option)); + labelNode.textContent = labelNode.textContent.replace(/^(\s*)(\S.+?)(\s*)$/i, `\$1${opts.label}\$3`); + } + // Example permalink element. + els.example = els.base.querySelector( cfg.selectors.example ); + if ( els.example ) { + els.example.setAttribute( 'id', cfg.values.example_id ); + els.example.textContent = opts.example; } + // Insert option into list. + els.template.parentNode.insertBefore( els.base, els.template ); } - } + } }); if ( CNR.structure.admin.manage_option ) From ee5260dcab0c068d8913b8a961bd1e7b308dd514 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 3 Nov 2022 15:11:02 -1000 Subject: [PATCH 14/16] meta: add release notes (v0.8.0) --- readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.txt b/readme.txt index 273c479..6e70353 100644 --- a/readme.txt +++ b/readme.txt @@ -60,6 +60,10 @@ Post your questions/comments at [Cornerstone's official issue tracker](https://g == Changelog == += 0.8.0 = + +* Update: Custom permalink structure option integration for WordPress 6.1+. + = 0.7.8 = * Fix: Utilities: `count()` used on non-Countable value. (props @nikelaos) From 59654404dee799d576050d34e7ec458e67bd4680 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 3 Nov 2022 15:21:01 -1000 Subject: [PATCH 15/16] meta: update copyright year --- main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.php b/main.php index df01eca..db498b1 100644 --- a/main.php +++ b/main.php @@ -4,7 +4,7 @@ * * @package Cornerstone * @author Archetyped - * @copyright 2020 Archetyped + * @copyright 2022 Archetyped * * Plugin Name: Cornerstone * Plugin URI: http://archetyped.com/tools/cornerstone/ From a76e856918c2763f1186da15e0388d84792f8eaa Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 3 Nov 2022 15:23:29 -1000 Subject: [PATCH 16/16] build: prep release (0.8.0) --- main.php | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.php b/main.php index db498b1..44095e3 100644 --- a/main.php +++ b/main.php @@ -9,7 +9,7 @@ * Plugin Name: Cornerstone * Plugin URI: http://archetyped.com/tools/cornerstone/ * Description: Enhanced content management for WordPress - * Version: 0.0.0-dev + * Version: 0.8.0 * Requires at least: 5.3 * Text Domain: cornerstone * Author: Archetyped diff --git a/package.json b/package.json index cf745eb..c8d53d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cornerstone", - "version": "0.0.0-dev", + "version": "0.8.0", "title": "Cornerstone", "description": "Enhanced content management for WordPress", "author": "Archetyped ",