From 0333a6f8c1c7163c76848af5c947f7fb875772c1 Mon Sep 17 00:00:00 2001 From: Chris Van Patten Date: Tue, 25 Sep 2018 20:01:48 -0400 Subject: [PATCH] Rename plugin, fix a few typos, etc --- src/Admin.php | 13 ++++++++----- src/Framework.php | 2 +- views/page.php | 5 +++-- wp-repeating-task-runner.php | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Admin.php b/src/Admin.php index 61ba1d0..2d8da62 100644 --- a/src/Admin.php +++ b/src/Admin.php @@ -58,18 +58,21 @@ public function page() $continue = ($_GET['repeating-task-runner-continue'] ?? false) ? ' checked' : ''; // Grab the available tasks - $tasks = $this->getTasks(); + $tasks = $this->container['framework']->getTasks(); // Simplify the tasks into an array - $tasks = array_map(function ($task) { + $tasks = array_map(function ($task) use ($slug){ return [ - 'slug' => sanitize_title($task->slug), - 'name' => esc_html($task->name), + 'slug' => sanitize_title($task->slug), + 'name' => esc_html($task->name), + 'selected' => $task->slug === $slug, ]; }, $tasks); + $selectDefaultOption = empty($slug) ? 'selected' : ''; + // Load the template - require dirname(__DIR__) . '../views/page.php'; + require trailingslashit(dirname(__DIR__)) . 'views/page.php'; return; } diff --git a/src/Framework.php b/src/Framework.php index 0fccb20..083a573 100644 --- a/src/Framework.php +++ b/src/Framework.php @@ -7,7 +7,7 @@ class Framework extends Base /** * @var array */ - public $tasks; + public $tasks = []; /** * Register a task diff --git a/views/page.php b/views/page.php index 53d90c9..4920f76 100644 --- a/views/page.php +++ b/views/page.php @@ -1,8 +1,7 @@
-

Bulk Tasks

+

Repeating Task Runner

-

Execute a bulk task

Executes a given task with a starting offset and iteration count

@@ -12,6 +11,8 @@