58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
/*
|
|
Plugin Name: 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.
|
|
Version: 1.0.0
|
|
Author: CleverOgre
|
|
Author URI: http://cleverogre.com/
|
|
Text Domain: ogre-sort
|
|
License: GPLv3 or later
|
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
|
Copyright: CleverOgre, Inc.
|
|
*/
|
|
|
|
namespace Ogre;
|
|
|
|
use Ogre\Sort\Settings;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
require_once 'vendor/autoload.php';
|
|
|
|
final class Sort extends Plugin {
|
|
|
|
protected function __construct() {
|
|
parent::__construct();
|
|
|
|
$this->add_files([
|
|
'inc/class-settings.php',
|
|
'inc/class-sort.php',
|
|
]);
|
|
}
|
|
|
|
protected function enable():void {
|
|
parent::enable();
|
|
add_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
|
|
}
|
|
|
|
protected function disable():void {
|
|
parent::disable();
|
|
remove_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
|
|
}
|
|
|
|
public function action_links($links) {
|
|
if (current_user_can('manage_options')) {
|
|
array_unshift($links, sprintf(
|
|
'<a href="%s">%s</a>',
|
|
esc_url(Settings::get_url()),
|
|
esc_html(self::__('Settings'))
|
|
));
|
|
}
|
|
return $links;
|
|
}
|
|
|
|
}
|
|
|
|
Sort::instance();
|