Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
063c4a6ed6 | ||
| b3233a13b9 | |||
|
|
fe1ff96dbc | ||
|
|
d1ae5f021a | ||
|
|
7b4aa346c6 | ||
|
|
a9333e38f1 | ||
| 2c6d4a0c0c | |||
|
|
604911be84 | ||
|
|
ed82ea7ad9 |
25
.vscode/sftp.json
vendored
Normal file
25
.vscode/sftp.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "acornfinehomes.com",
|
||||||
|
"host": "og6.cleverogre.com",
|
||||||
|
"protocol": "sftp",
|
||||||
|
"port": 22,
|
||||||
|
"username": "acornfinehomes",
|
||||||
|
"password": "kwSSrK7nkV3J54nV2E7XcjHH",
|
||||||
|
"privateKeyPath": "~/.ssh/id_rsa",
|
||||||
|
"remotePath": "/home/acornfinehomes/htdocs/acornfinehomes.com/wp-content/plugins/ogre-sort/",
|
||||||
|
"uploadOnSave": true,
|
||||||
|
"useTempFile": false,
|
||||||
|
"openSsh": false,
|
||||||
|
"ignore": [
|
||||||
|
".vscode",
|
||||||
|
".git",
|
||||||
|
".DS_Store",
|
||||||
|
".gitignore",
|
||||||
|
"composer.json",
|
||||||
|
"composer.lock",
|
||||||
|
"gulpfile.js",
|
||||||
|
"Makefile",
|
||||||
|
"package-lock.json",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://getcomposer.org/schema.json",
|
"$schema": "https://getcomposer.org/schema.json",
|
||||||
"name": "cleverogre/ogre-sort",
|
"name": "cleverogre/ogre-sort",
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"title": "Ogre Sort",
|
"title": "Ogre Sort",
|
||||||
"description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.",
|
"description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.",
|
||||||
"author": "CleverOgre",
|
"author": "CleverOgre",
|
||||||
|
|||||||
2
composer.lock
generated
2
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "fe877c0f300b012a3667fb458d1768b3",
|
"content-hash": "0e7b2523bace7acb04e7c97d1e711d62",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "cleverogre/plugin-framework",
|
"name": "cleverogre/plugin-framework",
|
||||||
|
|||||||
69
inc/class-refresh.php
Normal file
69
inc/class-refresh.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package ogre-sort
|
||||||
|
* @author cleverogre
|
||||||
|
* @copyright 2026 CleverOgre
|
||||||
|
* @license GLP-3.0-or-later
|
||||||
|
* @version 1.1.0
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Ogre\Sort;
|
||||||
|
|
||||||
|
use Ogre\Singleton;
|
||||||
|
use Ogre\Sort as Plugin;
|
||||||
|
|
||||||
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
|
final class Refresh {
|
||||||
|
use Singleton;
|
||||||
|
|
||||||
|
const CAPABILITY = 'manage_options';
|
||||||
|
const ACTION = 'ogre-sort-refresh';
|
||||||
|
|
||||||
|
protected function __construct() {
|
||||||
|
add_filter('plugin_action_links_' . Plugin::get_basename(), [$this, 'action_links'], 5);
|
||||||
|
add_action('admin_post_' . self::ACTION, [$this, 'handle_action']);
|
||||||
|
add_action('admin_notices', [$this, 'handle_notices']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function action_links($links) {
|
||||||
|
if (current_user_can(self::CAPABILITY)) {
|
||||||
|
array_unshift($links, sprintf(
|
||||||
|
'<a href="%s">%s</a>',
|
||||||
|
esc_url(add_query_arg([
|
||||||
|
'_wpnonce' => wp_create_nonce(self::ACTION),
|
||||||
|
], self::get_url())),
|
||||||
|
esc_html(Plugin::__('Refresh'))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle_action():void {
|
||||||
|
if (!current_user_can(self::CAPABILITY)) wp_die(Plugin::__('Invalid request.'));
|
||||||
|
check_admin_referer(self::ACTION);
|
||||||
|
|
||||||
|
Sort::instance()->refresh_all();
|
||||||
|
|
||||||
|
wp_redirect(add_query_arg([
|
||||||
|
self::ACTION => '1',
|
||||||
|
], Settings::get_url()));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle_notices():void {
|
||||||
|
if (!current_user_can(self::CAPABILITY) || !isset($_GET['page']) || $_GET['page'] != Plugin::get_id() || !isset($_GET[self::ACTION])) return;
|
||||||
|
printf(
|
||||||
|
'<div class="notice notice-success is-dismissable"><p>%s</p></div>',
|
||||||
|
Plugin::esc_html__('All sort relationships successfully refreshed!')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get_url():string {
|
||||||
|
return admin_url('admin-post.php?action=' . self::ACTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh::instance();
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
/**
|
/**
|
||||||
* @package ogre-sort
|
* @package ogre-sort
|
||||||
* @author cleverogre
|
* @author cleverogre
|
||||||
* @copyright 2025 CleverOgre
|
* @copyright 2026 CleverOgre
|
||||||
* @license GLP-3.0-or-later
|
* @license GLP-3.0-or-later
|
||||||
* @version 1.0.0
|
* @version 1.1.1
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -196,12 +196,13 @@ final class Settings {
|
|||||||
|
|
||||||
echo implode('<br>', array_map(
|
echo implode('<br>', array_map(
|
||||||
fn (object $option):string => sprintf(
|
fn (object $option):string => sprintf(
|
||||||
'<label><input type="checkbox" name="%s[%s][]" value="%s" %s> %s</label>',
|
'<label><input type="checkbox" name="%s[%s][]" value="%s" %s> %s (%s)</label>',
|
||||||
esc_attr(Plugin::get_id()),
|
esc_attr(Plugin::get_id()),
|
||||||
esc_attr($name),
|
esc_attr($name),
|
||||||
esc_attr($option->name),
|
esc_attr($option->name),
|
||||||
checked($this->is_checked($name, $option->name), display: false),
|
checked($this->is_checked($name, $option->name), display: false),
|
||||||
esc_html($option->label)
|
esc_html($option->label),
|
||||||
|
esc_html($option->name)
|
||||||
),
|
),
|
||||||
$options
|
$options
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* @author cleverogre
|
* @author cleverogre
|
||||||
* @copyright 2025 CleverOgre
|
* @copyright 2025 CleverOgre
|
||||||
* @license GLP-3.0-or-later
|
* @license GLP-3.0-or-later
|
||||||
* @version 1.0.0
|
* @version 1.1.0
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -88,6 +88,15 @@ final class Sort {
|
|||||||
// Post Updating
|
// Post Updating
|
||||||
add_action('save_post', [$this, 'save_post'], 10, 3);
|
add_action('save_post', [$this, 'save_post'], 10, 3);
|
||||||
|
|
||||||
|
// Ajax
|
||||||
|
add_action('wp_ajax_ogre_sort', [$this, 'sort']);
|
||||||
|
|
||||||
|
$this->enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function enable():void {
|
||||||
|
if (empty($this->relationships)) return;
|
||||||
|
|
||||||
// Post Types
|
// Post Types
|
||||||
add_action('pre_get_posts', [$this, 'pre_get_posts'], 10, 1);
|
add_action('pre_get_posts', [$this, 'pre_get_posts'], 10, 1);
|
||||||
add_filter('get_previous_post_where', [$this, 'previous_post_where']);
|
add_filter('get_previous_post_where', [$this, 'previous_post_where']);
|
||||||
@@ -101,9 +110,24 @@ final class Sort {
|
|||||||
add_filter('wp_get_object_terms', [$this, 'wp_get_object_terms'], 10, 4);
|
add_filter('wp_get_object_terms', [$this, 'wp_get_object_terms'], 10, 4);
|
||||||
add_filter('get_terms', [$this, 'get_terms'], 10, 4);
|
add_filter('get_terms', [$this, 'get_terms'], 10, 4);
|
||||||
add_action('create_term', [$this, 'add_term_relationship'], 10, 3);
|
add_action('create_term', [$this, 'add_term_relationship'], 10, 3);
|
||||||
|
}
|
||||||
|
|
||||||
// Ajax
|
protected function disable():void {
|
||||||
add_action('wp_ajax_ogre_sort', [$this, 'sort']);
|
if (empty($this->relationships)) return;
|
||||||
|
|
||||||
|
// Post Types
|
||||||
|
remove_action('pre_get_posts', [$this, 'pre_get_posts'], 10, 1);
|
||||||
|
remove_filter('get_previous_post_where', [$this, 'previous_post_where']);
|
||||||
|
remove_filter('get_previous_post_sort', [$this, 'previous_post_sort']);
|
||||||
|
remove_filter('get_next_post_where', [$this, 'next_post_where']);
|
||||||
|
remove_filter('get_next_post_sort', [$this, 'next_post_sort']);
|
||||||
|
|
||||||
|
// Taxonomy
|
||||||
|
remove_filter('terms_clauses', [$this, 'terms_clauses'], 10, 3);
|
||||||
|
remove_filter('get_terms_orderby', [$this, 'get_terms_orderby'], 10, 3);
|
||||||
|
remove_filter('wp_get_object_terms', [$this, 'wp_get_object_terms'], 10, 4);
|
||||||
|
remove_filter('get_terms', [$this, 'get_terms'], 10, 4);
|
||||||
|
remove_action('create_term', [$this, 'add_term_relationship'], 10, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function current_screen() {
|
public function current_screen() {
|
||||||
@@ -705,6 +729,8 @@ final class Sort {
|
|||||||
public function refresh($relationship) {
|
public function refresh($relationship) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
$this->disable();
|
||||||
|
|
||||||
switch ($relationship['type']) {
|
switch ($relationship['type']) {
|
||||||
|
|
||||||
case 'term':
|
case 'term':
|
||||||
@@ -841,6 +867,8 @@ final class Sort {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->enable();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
*
|
*
|
||||||
* @package ogre-sort
|
* @package ogre-sort
|
||||||
* @author cleverogre
|
* @author cleverogre
|
||||||
* @copyright 2025 CleverOgre
|
* @copyright 2026 CleverOgre
|
||||||
* @license GLP-3.0-or-later
|
* @license GLP-3.0-or-later
|
||||||
* @version 1.0.0
|
* @version 1.1.1
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
* Plugin Name: Ogre Sort
|
* Plugin Name: Ogre Sort
|
||||||
* Plugin URI: https://plugins.cleverogre.com/plugin/ogre-sort/
|
* Plugin URI: https://plugins.cleverogre.com/plugin/ogre-sort/
|
||||||
* Description: WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.
|
* Description: WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.
|
||||||
* Version: 1.0.0
|
* Version: 1.1.1
|
||||||
* Requires at least: 5.0
|
* Requires at least: 5.0
|
||||||
* Requires PHP: 8.0
|
* Requires PHP: 8.0
|
||||||
* Author: CleverOgre
|
* Author: CleverOgre
|
||||||
@@ -41,6 +41,7 @@ final class Sort extends Plugin {
|
|||||||
$this->add_files([
|
$this->add_files([
|
||||||
'inc/class-settings.php',
|
'inc/class-settings.php',
|
||||||
'inc/class-sort.php',
|
'inc/class-sort.php',
|
||||||
|
'inc/class-refresh.php',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "cleverogre/ogre-sort",
|
"name": "cleverogre/ogre-sort",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cleverogre/ogre-sort",
|
"name": "cleverogre/ogre-sort",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"license": "GPL-3.0+",
|
"license": "GPL-3.0+",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^5.0.0",
|
"gulp": "^5.0.0",
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.10.1",
|
"version": "25.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.10.tgz",
|
||||||
"integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==",
|
"integrity": "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1400,9 +1400,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fastq": {
|
"node_modules/fastq": {
|
||||||
"version": "1.19.1",
|
"version": "1.20.1",
|
||||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
|
||||||
"integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==",
|
"integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://www.schemastore.org/package.json",
|
"$schema": "https://www.schemastore.org/package.json",
|
||||||
"name": "cleverogre/ogre-sort",
|
"name": "cleverogre/ogre-sort",
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"title": "Ogre Sort",
|
"title": "Ogre Sort",
|
||||||
"description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.",
|
"description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.",
|
||||||
"author": "CleverOgre",
|
"author": "CleverOgre",
|
||||||
|
|||||||
10
readme.txt
10
readme.txt
@@ -3,7 +3,7 @@ Contributors: ogrecooper, cleverogre
|
|||||||
Tested up to: 6.8
|
Tested up to: 6.8
|
||||||
Requires at least: 5.0
|
Requires at least: 5.0
|
||||||
Requires PHP: 8.0
|
Requires PHP: 8.0
|
||||||
Version: 1.0.0
|
Version: 1.1.1
|
||||||
License: GPLv3 or later
|
License: GPLv3 or later
|
||||||
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
Copyright: CleverOgre
|
Copyright: CleverOgre
|
||||||
@@ -28,5 +28,13 @@ If you don't know what plugin you have downloaded, please contact [CleverOgre](t
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.1.1 - 2026-02-03 =
|
||||||
|
* Add name slugs to admin UI
|
||||||
|
* Fix undefined array key notice
|
||||||
|
|
||||||
|
= 1.1.0 - 2026-01-21 =
|
||||||
|
* Add manual refresh action
|
||||||
|
* Fix filtering issue during refresh
|
||||||
|
|
||||||
= 1.0.0 - 2025-11-18 =
|
= 1.0.0 - 2025-11-18 =
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|||||||
Reference in New Issue
Block a user