PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / packages / action-scheduler / classes / ActionScheduler_AdminView.php

ActionScheduler_AdminView.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at packages/action-scheduler/classes/ActionScheduler_AdminView.php

158 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class ActionScheduler_AdminView
5 *
6 * @codeCoverageIgnore
7 */
8 class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated {
9
10 private static $admin_view = NULL;
11
12 private static $screen_id = 'tools_page_action-scheduler';
13
14 /**
15 * @var ActionScheduler_ListTable
16 */
17 protected $list_table;
18
19 /**
20 * @return ActionScheduler_AdminView
21 * @codeCoverageIgnore
22 */
23 public static function instance() {
24
25 if ( empty( self::$admin_view ) ) {
26 $class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');
27 self::$admin_view = new $class();
28 }
29
30 return self::$admin_view;
31 }
32
33 /**
34 * @codeCoverageIgnore
35 */
36 public function init() {
37 if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false == DOING_AJAX ) ) {
38
39 if ( class_exists( 'WooCommerce' ) ) {
40 add_action( 'woocommerce_admin_status_content_action-scheduler', array( $this, 'render_admin_ui' ) );
41 add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
42 add_filter( 'woocommerce_admin_status_tabs', array( $this, 'register_system_status_tab' ) );
43 }
44
45 add_action( 'admin_menu', array( $this, 'register_menu' ) );
46
47 add_action( 'current_screen', array( $this, 'add_help_tabs' ) );
48 }
49 }
50
51 public function system_status_report() {
52 $table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
53 $table->render();
54 }
55
56 /**
57 * Registers action-scheduler into WooCommerce > System status.
58 *
59 * @param array $tabs An associative array of tab key => label.
60 * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs
61 */
62 public function register_system_status_tab( array $tabs ) {
63 $tabs['action-scheduler'] = __( 'Scheduled Actions', 'woocommerce' );
64
65 return $tabs;
66 }
67
68 /**
69 * Include Action Scheduler's administration under the Tools menu.
70 *
71 * A menu under the Tools menu is important for backward compatibility (as that's
72 * where it started), and also provides more convenient access than the WooCommerce
73 * System Status page, and for sites where WooCommerce isn't active.
74 */
75 public function register_menu() {
76 $hook_suffix = add_submenu_page(
77 'tools.php',
78 __( 'Scheduled Actions', 'woocommerce' ),
79 __( 'Scheduled Actions', 'woocommerce' ),
80 'manage_options',
81 'action-scheduler',
82 array( $this, 'render_admin_ui' )
83 );
84 add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );
85 }
86
87 /**
88 * Triggers processing of any pending actions.
89 */
90 public function process_admin_ui() {
91 $this->get_list_table();
92 }
93
94 /**
95 * Renders the Admin UI
96 */
97 public function render_admin_ui() {
98 $table = $this->get_list_table();
99 $table->display_page();
100 }
101
102 /**
103 * Get the admin UI object and process any requested actions.
104 *
105 * @return ActionScheduler_ListTable
106 */
107 protected function get_list_table() {
108 if ( null === $this->list_table ) {
109 $this->list_table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() );
110 $this->list_table->process_actions();
111 }
112
113 return $this->list_table;
114 }
115
116 /**
117 * Provide more information about the screen and its data in the help tab.
118 */
119 public function add_help_tabs() {
120 $screen = get_current_screen();
121
122 if ( ! $screen || self::$screen_id != $screen->id ) {
123 return;
124 }
125
126 $as_version = ActionScheduler_Versions::instance()->latest_version();
127 $screen->add_help_tab(
128 array(
129 'id' => 'action_scheduler_about',
130 'title' => __( 'About', 'woocommerce' ),
131 'content' =>
132 '<h2>' . sprintf( __( 'About Action Scheduler %s', 'woocommerce' ), $as_version ) . '</h2>' .
133 '<p>' .
134 __( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'woocommerce' ) .
135 '</p>',
136 )
137 );
138
139 $screen->add_help_tab(
140 array(
141 'id' => 'action_scheduler_columns',
142 'title' => __( 'Columns', 'woocommerce' ),
143 'content' =>
144 '<h2>' . __( 'Scheduled Action Columns', 'woocommerce' ) . '</h2>' .
145 '<ul>' .
146 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Hook', 'woocommerce' ), __( 'Name of the action hook that will be triggered.', 'woocommerce' ) ) .
147 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Status', 'woocommerce' ), __( 'Action statuses are Pending, Complete, Canceled, Failed', 'woocommerce' ) ) .
148 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Arguments', 'woocommerce' ), __( 'Optional data array passed to the action hook.', 'woocommerce' ) ) .
149 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Group', 'woocommerce' ), __( 'Optional action group.', 'woocommerce' ) ) .
150 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Recurrence', 'woocommerce' ), __( 'The action\'s schedule frequency.', 'woocommerce' ) ) .
151 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Scheduled', 'woocommerce' ), __( 'The date/time the action is/was scheduled to run.', 'woocommerce' ) ) .
152 sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Log', 'woocommerce' ), __( 'Activity log for the action.', 'woocommerce' ) ) .
153 '</ul>',
154 )
155 );
156 }
157 }
158