Tasks
2 weeks ago
DeprecatedExtendedTask.php
2 weeks ago
DeprecatedOptions.php
5 months ago
Init.php
3 years ago
Task.php
2 weeks ago
TaskList.php
2 months ago
TaskListSection.php
3 years ago
TaskLists.php
2 weeks ago
TaskTraits.php
4 years ago
DeprecatedExtendedTask.php
244 lines
| 1 | <?php |
| 2 | /** |
| 3 | * A temporary class for creating tasks on the fly from deprecated tasks. |
| 4 | */ |
| 5 | |
| 6 | namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks; |
| 7 | |
| 8 | /** |
| 9 | * DeprecatedExtendedTask class. |
| 10 | */ |
| 11 | class DeprecatedExtendedTask extends Task { |
| 12 | /** |
| 13 | * ID. |
| 14 | * |
| 15 | * @var string |
| 16 | */ |
| 17 | public $id = ''; |
| 18 | |
| 19 | /** |
| 20 | * Additional info. |
| 21 | * |
| 22 | * @var string|null |
| 23 | */ |
| 24 | public $additional_info = ''; |
| 25 | |
| 26 | /** |
| 27 | * Content. |
| 28 | * |
| 29 | * @var string |
| 30 | */ |
| 31 | public $content = ''; |
| 32 | |
| 33 | /** |
| 34 | * Whether the task is complete or not. |
| 35 | * |
| 36 | * @var boolean |
| 37 | */ |
| 38 | public $is_complete = false; |
| 39 | |
| 40 | /** |
| 41 | * Snoozeable. |
| 42 | * |
| 43 | * @var boolean |
| 44 | */ |
| 45 | public $is_snoozeable = false; |
| 46 | |
| 47 | /** |
| 48 | * Dismissable. |
| 49 | * |
| 50 | * @var boolean |
| 51 | */ |
| 52 | public $is_dismissable = false; |
| 53 | |
| 54 | /** |
| 55 | * Whether the store is capable of viewing the task. |
| 56 | * |
| 57 | * @var bool |
| 58 | */ |
| 59 | public $can_view = true; |
| 60 | |
| 61 | /** |
| 62 | * Level. |
| 63 | * |
| 64 | * @var int |
| 65 | */ |
| 66 | public $level = 3; |
| 67 | |
| 68 | /** |
| 69 | * Time. |
| 70 | * |
| 71 | * @var string|null |
| 72 | */ |
| 73 | public $time; |
| 74 | |
| 75 | /** |
| 76 | * Title. |
| 77 | * |
| 78 | * @var string |
| 79 | */ |
| 80 | public $title = ''; |
| 81 | |
| 82 | /** |
| 83 | * Contextual image URL. |
| 84 | * |
| 85 | * @var string |
| 86 | */ |
| 87 | public $image_url = ''; |
| 88 | |
| 89 | /** |
| 90 | * Alt text for the contextual image. |
| 91 | * |
| 92 | * @var string |
| 93 | */ |
| 94 | public $image_alt = ''; |
| 95 | |
| 96 | /** |
| 97 | * Constructor. |
| 98 | * |
| 99 | * @param TaskList $task_list Parent task list. |
| 100 | * @param array $args Array of task args. |
| 101 | */ |
| 102 | public function __construct( $task_list, $args ) { |
| 103 | parent::__construct( $task_list ); |
| 104 | $task_args = wp_parse_args( |
| 105 | $args, |
| 106 | array( |
| 107 | 'id' => null, |
| 108 | 'is_dismissable' => false, |
| 109 | 'is_snoozeable' => false, |
| 110 | 'can_view' => true, |
| 111 | 'level' => 3, |
| 112 | 'additional_info' => null, |
| 113 | 'content' => '', |
| 114 | 'title' => '', |
| 115 | 'is_complete' => false, |
| 116 | 'time' => null, |
| 117 | 'image_url' => '', |
| 118 | 'image_alt' => '', |
| 119 | ) |
| 120 | ); |
| 121 | |
| 122 | $this->id = $task_args['id']; |
| 123 | $this->additional_info = $task_args['additional_info']; |
| 124 | $this->content = $task_args['content']; |
| 125 | $this->is_complete = $task_args['is_complete']; |
| 126 | $this->is_dismissable = $task_args['is_dismissable']; |
| 127 | $this->is_snoozeable = $task_args['is_snoozeable']; |
| 128 | $this->can_view = $task_args['can_view']; |
| 129 | $this->level = $task_args['level']; |
| 130 | $this->time = $task_args['time']; |
| 131 | $this->title = $task_args['title']; |
| 132 | $this->image_url = $task_args['image_url']; |
| 133 | $this->image_alt = $task_args['image_alt']; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * ID. |
| 138 | * |
| 139 | * @return string |
| 140 | */ |
| 141 | public function get_id() { |
| 142 | return $this->id; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Additional info. |
| 147 | * |
| 148 | * @return string |
| 149 | */ |
| 150 | public function get_additional_info() { |
| 151 | return $this->additional_info; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Content. |
| 156 | * |
| 157 | * @return string |
| 158 | */ |
| 159 | public function get_content() { |
| 160 | return $this->content; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Level. |
| 165 | * |
| 166 | * @return int |
| 167 | */ |
| 168 | public function get_level() { |
| 169 | return $this->level; |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Title |
| 174 | * |
| 175 | * @return string |
| 176 | */ |
| 177 | public function get_title() { |
| 178 | return $this->title; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * Time |
| 183 | * |
| 184 | * @return string|null |
| 185 | */ |
| 186 | public function get_time() { |
| 187 | return $this->time; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Contextual image URL. |
| 192 | * |
| 193 | * @return string |
| 194 | */ |
| 195 | public function get_image_url() { |
| 196 | return $this->image_url; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Alt text for the contextual image. |
| 201 | * |
| 202 | * @return string |
| 203 | */ |
| 204 | public function get_image_alt() { |
| 205 | return $this->image_alt; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Check if a task is snoozeable. |
| 210 | * |
| 211 | * @return bool |
| 212 | */ |
| 213 | public function is_snoozeable() { |
| 214 | return $this->is_snoozeable; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Check if a task is dismissable. |
| 219 | * |
| 220 | * @return bool |
| 221 | */ |
| 222 | public function is_dismissable() { |
| 223 | return $this->is_dismissable; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Check if a task is dismissable. |
| 228 | * |
| 229 | * @return bool |
| 230 | */ |
| 231 | public function is_complete() { |
| 232 | return $this->is_complete; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Check if a task is dismissable. |
| 237 | * |
| 238 | * @return bool |
| 239 | */ |
| 240 | public function can_view() { |
| 241 | return $this->can_view; |
| 242 | } |
| 243 | } |
| 244 |