| 1 |
<?php |
| 2 |
|
| 3 |
namespace SpringDevs\Subscription\Admin; |
| 4 |
|
| 5 |
use function Avifinfo\read; |
| 6 |
|
| 7 |
/** |
| 8 |
* Menu class |
| 9 |
* |
| 10 |
* @package SpringDevs\Subscription\Admin |
| 11 |
*/ |
| 12 |
class Menu { |
| 13 |
|
| 14 |
/** |
| 15 |
* Initialize the class |
| 16 |
*/ |
| 17 |
public function __construct() { |
| 18 |
add_action( 'admin_menu', array( $this, 'create_admin_menu' ) ); |
| 19 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) ); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Enqueue admin assets |
| 24 |
*/ |
| 25 |
public function enqueue_admin_assets() { |
| 26 |
wp_enqueue_style( |
| 27 |
'wp-subscription-admin', |
| 28 |
WP_SUBSCRIPTION_ASSETS . '/css/admin.css', |
| 29 |
array(), |
| 30 |
WP_SUBSCRIPTION_VERSION |
| 31 |
); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Create Subscriptions Menu. |
| 36 |
*/ |
| 37 |
public function create_admin_menu() { |
| 38 |
$parent_slug = 'wp-subscription'; |
| 39 |
// Determine if the menu is active |
| 40 |
$is_active = isset($_GET['page']) && strpos($_GET['page'], 'wp-subscription') === 0; |
| 41 |
$icon_url = $is_active |
| 42 |
? WP_SUBSCRIPTION_ASSETS . '/images/icons/subscription-20.png' |
| 43 |
: WP_SUBSCRIPTION_ASSETS . '/images/icons/subscription-20-gray.png'; |
| 44 |
// Main menu |
| 45 |
add_menu_page( |
| 46 |
__( 'WP Subscription', 'wp_subscription' ), |
| 47 |
__( 'WP Subscription', 'wp_subscription' ), |
| 48 |
'manage_woocommerce', |
| 49 |
$parent_slug, |
| 50 |
array( $this, 'render_subscriptions_page' ), |
| 51 |
$icon_url, |
| 52 |
40 |
| 53 |
); |
| 54 |
|
| 55 |
// Subscriptions List |
| 56 |
add_submenu_page( |
| 57 |
$parent_slug, |
| 58 |
__( 'Subscriptions', 'wp_subscription' ), |
| 59 |
__( 'Subscriptions', 'wp_subscription' ), |
| 60 |
'manage_woocommerce', |
| 61 |
$parent_slug, |
| 62 |
array( $this, 'render_subscriptions_page' ) |
| 63 |
); |
| 64 |
|
| 65 |
// Stats Overview |
| 66 |
add_submenu_page( |
| 67 |
$parent_slug, |
| 68 |
__( 'Reports', 'wp_subscription' ), |
| 69 |
__( 'Reports', 'wp_subscription' ), |
| 70 |
'manage_woocommerce', |
| 71 |
'wp-subscription-stats', |
| 72 |
array( $this, 'render_stats_page' ) |
| 73 |
); |
| 74 |
|
| 75 |
// Settings |
| 76 |
add_submenu_page( |
| 77 |
$parent_slug, |
| 78 |
__( 'Settings', 'wp_subscription' ), |
| 79 |
__( 'Settings', 'wp_subscription' ), |
| 80 |
'manage_woocommerce', |
| 81 |
'wp-subscription-settings', |
| 82 |
array( $this, 'render_settings_page' ) |
| 83 |
); |
| 84 |
|
| 85 |
// Support |
| 86 |
add_submenu_page( |
| 87 |
$parent_slug, |
| 88 |
__( 'Support', 'wp_subscription' ), |
| 89 |
__( 'Support', 'wp_subscription' ), |
| 90 |
'manage_woocommerce', |
| 91 |
'wp-subscription-support', |
| 92 |
array( $this, 'render_support_page' ) |
| 93 |
); |
| 94 |
|
| 95 |
// Add WP Subscription link under WooCommerce menu |
| 96 |
add_submenu_page( |
| 97 |
'woocommerce', |
| 98 |
__( 'WP Subscription', 'wp_subscription' ), |
| 99 |
__( 'WP Subscription', 'wp_subscription' ), |
| 100 |
'manage_woocommerce', |
| 101 |
'wp-subscription', |
| 102 |
array( $this, 'render_subscriptions_page' ) |
| 103 |
); |
| 104 |
} |
| 105 |
/** |
| 106 |
* Render the admin header |
| 107 |
*/ |
| 108 |
private function render_admin_footer() { |
| 109 |
?> |
| 110 |
<div style="text-align:center;margin:38px 0 0 0;font-size:14px;color:#888;"> |
| 111 |
Made with <span style="color:#e25555;font-size:1.1em;">♥</span> by the WP Subscription Team |
| 112 |
<div style="margin-top:6px;"> |
| 113 |
<a href="https://wpsubscription.co/support" target="_blank" style="color:#2563eb;text-decoration:none;">Support</a> |
| 114 |
/ |
| 115 |
<a href="https://wpsubscription.co/docs" target="_blank" style="color:#2563eb;text-decoration:none;">Docs</a> |
| 116 |
</div> |
| 117 |
</div> |
| 118 |
<?php |
| 119 |
} |
| 120 |
/** |
| 121 |
* Render the admin header |
| 122 |
*/ |
| 123 |
private function render_admin_header() { |
| 124 |
// Get current page slug |
| 125 |
$current = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'wp-subscription'; |
| 126 |
$menu_items = [ |
| 127 |
[ |
| 128 |
'slug' => 'wp-subscription', |
| 129 |
'label' => __('Subscriptions', 'wp_subscription'), |
| 130 |
'url' => admin_url('admin.php?page=wp-subscription'), |
| 131 |
], |
| 132 |
[ |
| 133 |
'slug' => 'wp-subscription-stats', |
| 134 |
'label' => __('Reports', 'wp_subscription'), |
| 135 |
'url' => admin_url('admin.php?page=wp-subscription-stats'), |
| 136 |
], |
| 137 |
[ |
| 138 |
'slug' => 'wp-subscription-settings', |
| 139 |
'label' => __('Settings', 'wp_subscription'), |
| 140 |
'url' => admin_url('admin.php?page=wp-subscription-settings'), |
| 141 |
], |
| 142 |
[ |
| 143 |
'slug' => 'wp-subscription-support', |
| 144 |
'label' => __('Support', 'wp_subscription'), |
| 145 |
'url' => admin_url('admin.php?page=wp-subscription-support'), |
| 146 |
], |
| 147 |
]; |
| 148 |
// Allow pro plugin to inject menu items |
| 149 |
$menu_items = apply_filters('wp_subscription_admin_header_menu_items', $menu_items, $current); |
| 150 |
?> |
| 151 |
<div class="wp-subscription-admin-header"> |
| 152 |
<div style="width:1240px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;"> |
| 153 |
<div class="wp-subscription-admin-header-left" style="display:flex;align-items:center;gap:14px;"> |
| 154 |
<img style="height:30px;" src="<?php echo esc_url( WP_SUBSCRIPTION_ASSETS . '/images/logo-title.svg' ); ?>" alt="WP Subscription" class="wp-subscription-logo"> |
| 155 |
<nav class="wp-subscription-admin-header-menu"> |
| 156 |
<?php foreach ($menu_items as $item): ?> |
| 157 |
<a href="<?php echo esc_url($item['url']); ?>" class="<?php echo ($current === $item['slug']) ? 'current' : ''; ?>"> |
| 158 |
<?php echo esc_html($item['label']); ?> |
| 159 |
</a> |
| 160 |
<?php endforeach; ?> |
| 161 |
</nav> |
| 162 |
</div> |
| 163 |
<div class="wp-subscription-admin-header-right"> |
| 164 |
<?php if ( ! class_exists('Sdevs_Wc_Subscription_Pro') ) : ?> |
| 165 |
<a target="_blank" href="https://wpsubscription.co/?utm_source=plugin&utm_medium=admin&utm_campaign=upgrade_pro" class="wp-subscription-upgrade-btn"><?php _e( 'Upgrade to Pro', 'wp_subscription' ); ?></a> |
| 166 |
<?php endif; ?> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
<?php |
| 171 |
} |
| 172 |
|
| 173 |
/** |
| 174 |
* Render Subscriptions page |
| 175 |
*/ |
| 176 |
public function render_subscriptions_page() { |
| 177 |
$this->render_admin_header(); |
| 178 |
|
| 179 |
// Handle filters |
| 180 |
$status = isset($_GET['subscrpt_status']) ? sanitize_text_field($_GET['subscrpt_status']) : ''; |
| 181 |
$search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
| 182 |
$date_filter = isset($_GET['date_filter']) ? sanitize_text_field($_GET['date_filter']) : ''; |
| 183 |
$per_page = isset($_GET['per_page']) ? max(1, intval($_GET['per_page'])) : 20; |
| 184 |
$paged = isset($_GET['paged']) ? max(1, intval($_GET['paged'])) : 1; |
| 185 |
|
| 186 |
// Handle duplicate action |
| 187 |
if (isset($_GET['action']) && $_GET['action'] === 'duplicate' && !empty($_GET['sub_id'])) { |
| 188 |
$sub_id = intval($_GET['sub_id']); |
| 189 |
$post = get_post($sub_id); |
| 190 |
if ($post && $post->post_type === 'subscrpt_order') { |
| 191 |
$new_post = [ |
| 192 |
'post_title' => $post->post_title . ' (Copy)', |
| 193 |
'post_content' => $post->post_content, |
| 194 |
'post_status' => 'draft', |
| 195 |
'post_type' => 'subscrpt_order', |
| 196 |
]; |
| 197 |
$new_id = wp_insert_post($new_post); |
| 198 |
if ($new_id) { |
| 199 |
$meta = get_post_meta($sub_id); |
| 200 |
foreach ($meta as $key => $values) { |
| 201 |
foreach ($values as $value) { |
| 202 |
add_post_meta($new_id, $key, maybe_unserialize($value)); |
| 203 |
} |
| 204 |
} |
| 205 |
} |
| 206 |
} |
| 207 |
wp_safe_redirect(admin_url('admin.php?page=wp-subscription')); |
| 208 |
exit; |
| 209 |
} |
| 210 |
|
| 211 |
$args = [ |
| 212 |
'post_type' => 'subscrpt_order', |
| 213 |
'post_status' => 'any', |
| 214 |
'posts_per_page' => $per_page, |
| 215 |
'paged' => $paged, |
| 216 |
'orderby' => 'date', |
| 217 |
'order' => 'DESC', |
| 218 |
]; |
| 219 |
|
| 220 |
if ($status) { |
| 221 |
$args['post_status'] = $status; |
| 222 |
} |
| 223 |
// Search only by subscription ID |
| 224 |
if ($search !== '') { |
| 225 |
if (is_numeric($search)) { |
| 226 |
$args['p'] = intval($search); |
| 227 |
} else { |
| 228 |
// If not numeric, return no results |
| 229 |
$args['post__in'] = array(0); |
| 230 |
} |
| 231 |
} |
| 232 |
// Dynamic date filter (YYYY-MM) |
| 233 |
if ($date_filter && preg_match('/^\d{4}-\d{2}$/', $date_filter)) { |
| 234 |
$year = substr($date_filter, 0, 4); |
| 235 |
$month = substr($date_filter, 5, 2); |
| 236 |
$args['date_query'][] = [ |
| 237 |
'year' => intval($year), |
| 238 |
'month' => intval($month), |
| 239 |
]; |
| 240 |
} |
| 241 |
|
| 242 |
$query = new \WP_Query($args); |
| 243 |
$subscriptions = $query->posts; |
| 244 |
$total = $query->found_posts; |
| 245 |
$max_num_pages = $query->max_num_pages; |
| 246 |
|
| 247 |
// Get all possible statuses for filter dropdown |
| 248 |
$all_statuses = get_post_stati(['show_in_admin_all_list' => true], 'objects'); |
| 249 |
|
| 250 |
include dirname(__FILE__) . '/views/subscription-list.php'; |
| 251 |
?> |
| 252 |
<div style="text-align:center;margin:38px 0 0 0;font-size:14px;color:#888;"> |
| 253 |
Made with <span style="color:#e25555;font-size:1.1em;">♥</span> by the WP Subscription Team |
| 254 |
<div style="margin-top:6px;"> |
| 255 |
<a href="https://wpsubscription.co/support" target="_blank" style="color:#2563eb;text-decoration:none;">Support</a> |
| 256 |
/ |
| 257 |
<a href="https://wpsubscription.co/docs" target="_blank" style="color:#2563eb;text-decoration:none;">Docs</a> |
| 258 |
</div> |
| 259 |
</div> |
| 260 |
<?php |
| 261 |
} |
| 262 |
|
| 263 |
/** |
| 264 |
* Render Stats page |
| 265 |
*/ |
| 266 |
public function render_stats_page() { |
| 267 |
$this->render_admin_header(); |
| 268 |
// if ( ! class_exists('Sdevs_Wc_Subscription_Pro') ){ |
| 269 |
// $this->render_admin_footer(); |
| 270 |
// return; |
| 271 |
// } |
| 272 |
|
| 273 |
if ( ! class_exists('Sdevs_Wc_Subscription_Pro') ) { ?> |
| 274 |
<div class="wp-subscription-admin-content" style="max-width:1240px;margin:32px auto 0 auto"> |
| 275 |
<div class="wp-subscription-hero-upgrade" style="margin-bottom:18px;"> |
| 276 |
<div class="wp-subscription-hero-content"> |
| 277 |
<span class="wp-subscription-hero-icon">✨</span> |
| 278 |
<span class="wp-subscription-hero-title"> |
| 279 |
Unlock advanced features, priority support,<br> |
| 280 |
and more subscription control and reporting. |
| 281 |
</span> |
| 282 |
</div> |
| 283 |
<a href="https://wpsubscription.co/?utm_source=plugin&utm_medium=admin&utm_campaign=upgrade_pro" |
| 284 |
target="_blank" |
| 285 |
class="wp-subscription-hero-btn"> |
| 286 |
UPGRADE TO PRO |
| 287 |
</a> |
| 288 |
</div> |
| 289 |
</div> |
| 290 |
<?php |
| 291 |
$this->render_admin_footer(); |
| 292 |
return; |
| 293 |
} |
| 294 |
|
| 295 |
global $wpdb; |
| 296 |
$months = []; |
| 297 |
$now = current_time('timestamp'); |
| 298 |
for ($i = 11; $i >= 0; $i--) { |
| 299 |
$month = strtotime("-{$i} month", $now); |
| 300 |
$key = date('Y-m', $month); |
| 301 |
$months[$key] = [ |
| 302 |
'label' => date('M Y', $month), |
| 303 |
'total' => 0, |
| 304 |
'active' => 0, |
| 305 |
'cancelled' => 0, |
| 306 |
'revenue' => 0.0, |
| 307 |
]; |
| 308 |
} |
| 309 |
$start = strtotime('-11 months', $now); |
| 310 |
$start = strtotime(date('Y-m-01 00:00:00', $start)); |
| 311 |
$end = strtotime(date('Y-m-t 23:59:59', $now)); |
| 312 |
$subs = $wpdb->get_results($wpdb->prepare( |
| 313 |
"SELECT ID, post_status, post_date_gmt FROM {$wpdb->posts} WHERE post_type='subscrpt_order' AND post_status != 'trash' AND post_date_gmt >= %s AND post_date_gmt <= %s", |
| 314 |
gmdate('Y-m-d H:i:s', $start), |
| 315 |
gmdate('Y-m-d H:i:s', $end) |
| 316 |
)); |
| 317 |
// dd($subs); |
| 318 |
foreach ($subs as $sub) { |
| 319 |
$month = date('Y-m', strtotime($sub->post_date_gmt)); |
| 320 |
if (!isset($months[$month])) continue; |
| 321 |
$months[$month]['total']++; |
| 322 |
if ($sub->post_status === 'active') $months[$month]['active']++; |
| 323 |
if ($sub->post_status === 'cancelled') $months[$month]['cancelled']++; |
| 324 |
// Revenue: get price meta |
| 325 |
$price = get_post_meta($sub->ID, '_subscrpt_price', true); |
| 326 |
$months[$month]['revenue'] += floatval($price); |
| 327 |
} |
| 328 |
// Next month projection: current active * avg revenue per active |
| 329 |
$active_now = $months[array_key_last($months)]['active']; |
| 330 |
$revenue_now = $months[array_key_last($months)]['revenue']; |
| 331 |
$avg_per_active = $active_now ? ($revenue_now / $active_now) : 0; |
| 332 |
$projection = round($active_now * $avg_per_active, 2); |
| 333 |
// Previous month |
| 334 |
$month_keys = array_keys($months); |
| 335 |
$prev_month_key = $month_keys[count($month_keys)-2] ?? null; |
| 336 |
$prev_month_label = $prev_month_key ? $months[$prev_month_key]['label'] : ''; |
| 337 |
$prev_month_revenue = $prev_month_key ? $months[$prev_month_key]['revenue'] : 0; |
| 338 |
// Next month name |
| 339 |
$next_month_label = date('M Y', strtotime('+1 month', $now)); |
| 340 |
?> |
| 341 |
<div class="wp-subscription-admin-content" style="max-width:1240px;margin:32px auto 0 auto;"> |
| 342 |
<div class="wp-subscription-admin-box" style="margin-bottom:32px;"> |
| 343 |
<h1 class="wp-subscription-admin-title" style="margin-bottom:18px;">Monthly Subscription Report</h1> |
| 344 |
<div style="display:flex;gap:24px;flex-wrap:wrap;margin-bottom:50px;"> |
| 345 |
<div style="flex:1;min-width:180px;background:#f7fafd;border-radius:8px;padding:18px 22px;text-align:center;"> |
| 346 |
<div style="margin-bottom:10px;font-size:2em;font-weight:700;color:#2563eb;"><?php echo intval($months[array_key_last($months)]['total']); ?></div> |
| 347 |
<div style="color:#888;font-size:13px;">Subscriptions This Month</div> |
| 348 |
</div> |
| 349 |
<div style="flex:1;min-width:180px;background:#f7fafd;border-radius:8px;padding:18px 22px;text-align:center;"> |
| 350 |
<div style="margin-bottom:10px;font-size:2em;font-weight:700;color:#27c775;"><?php echo intval($months[array_key_last($months)]['active']); ?></div> |
| 351 |
<div style="color:#888;font-size:13px;">Active Subscriptions</div> |
| 352 |
</div> |
| 353 |
<div style="flex:1;min-width:180px;background:#f7fafd;border-radius:8px;padding:18px 22px;text-align:center;"> |
| 354 |
<div style="margin-bottom:10px;font-size:2em;font-weight:700;color:#d93025;"><?php echo intval($months[array_key_last($months)]['cancelled']); ?></div> |
| 355 |
<div style="color:#888;font-size:13px;">Cancelled This Month</div> |
| 356 |
</div> |
| 357 |
<div style="flex:1;min-width:180px;background:#f7fafd;border-radius:8px;padding:18px 22px;text-align:center;"> |
| 358 |
<div style="margin-bottom:10px;font-size:2em;font-weight:700;color:#7f54b3;">$<?php echo number_format($months[array_key_last($months)]['revenue'], 2); ?></div> |
| 359 |
<div style="color:#888;font-size:13px;">Revenue This Month</div> |
| 360 |
</div> |
| 361 |
<div style="flex:1;min-width:180px;background:#f4f7fa;border-radius:8px;padding:18px 22px;text-align:center;"> |
| 362 |
<div style="margin-bottom:10px;font-size:1.5em;font-weight:700;color:#7f54b3;">$<?php echo number_format($prev_month_revenue, 2); ?></div> |
| 363 |
<div style="font-size:1.1em;font-weight:600;color:#888;margin-bottom:2px;">Previous Month (<?php echo esc_html($prev_month_label); ?>)</div> |
| 364 |
</div> |
| 365 |
<div style="flex:1;min-width:180px;background:#e6f0fa;border-radius:8px;padding:18px 22px;text-align:center;"> |
| 366 |
<div style="margin-bottom:10px;font-size:1.5em;font-weight:700;color:#2196f3;">$<?php echo number_format($projection, 2); ?></div> |
| 367 |
<div style="font-size:1.1em;font-weight:600;color:#888;margin-bottom:2px;">Next Month Projection (<?php echo esc_html($next_month_label); ?>)</div> |
| 368 |
</div> |
| 369 |
</div> |
| 370 |
<canvas id="wpsubscription-report-chart" height="110"></canvas> |
| 371 |
</div> |
| 372 |
</div> |
| 373 |
|
| 374 |
<?php $this->render_admin_footer(); ?> |
| 375 |
|
| 376 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
| 377 |
<script> |
| 378 |
const ctx = document.getElementById('wpsubscription-report-chart').getContext('2d'); |
| 379 |
const chart = new Chart(ctx, { |
| 380 |
type: 'bar', |
| 381 |
data: { |
| 382 |
labels: <?php echo json_encode(array_column($months, 'label')); ?>, |
| 383 |
datasets: [ |
| 384 |
{ |
| 385 |
label: 'Total', |
| 386 |
data: <?php echo json_encode(array_column($months, 'total')); ?>, |
| 387 |
backgroundColor: '#2563eb', |
| 388 |
}, |
| 389 |
{ |
| 390 |
label: 'Active', |
| 391 |
data: <?php echo json_encode(array_column($months, 'active')); ?>, |
| 392 |
backgroundColor: '#27c775', |
| 393 |
}, |
| 394 |
{ |
| 395 |
label: 'Cancelled', |
| 396 |
data: <?php echo json_encode(array_column($months, 'cancelled')); ?>, |
| 397 |
backgroundColor: '#d93025', |
| 398 |
}, |
| 399 |
{ |
| 400 |
label: 'Revenue', |
| 401 |
data: <?php echo json_encode(array_map('floatval', array_column($months, 'revenue'))); ?>, |
| 402 |
backgroundColor: '#7f54b3', |
| 403 |
type: 'line', |
| 404 |
yAxisID: 'y1', |
| 405 |
borderColor: '#7f54b3', |
| 406 |
fill: false, |
| 407 |
tension: 0.3, |
| 408 |
pointRadius: 3, |
| 409 |
pointBackgroundColor: '#7f54b3', |
| 410 |
} |
| 411 |
] |
| 412 |
}, |
| 413 |
options: { |
| 414 |
responsive: true, |
| 415 |
interaction: { mode: 'index', intersect: false }, |
| 416 |
plugins: { |
| 417 |
legend: { position: 'top' }, |
| 418 |
title: { display: false }, |
| 419 |
tooltip: { enabled: true } |
| 420 |
}, |
| 421 |
scales: { |
| 422 |
y: { beginAtZero: true, title: { display: true, text: 'Count' } }, |
| 423 |
y1: { |
| 424 |
beginAtZero: true, |
| 425 |
position: 'right', |
| 426 |
grid: { drawOnChartArea: false }, |
| 427 |
title: { display: true, text: 'Revenue ($)' } |
| 428 |
} |
| 429 |
} |
| 430 |
} |
| 431 |
}); |
| 432 |
</script> |
| 433 |
<?php |
| 434 |
} |
| 435 |
|
| 436 |
/** |
| 437 |
* Render Settings page |
| 438 |
*/ |
| 439 |
public function render_settings_page() { |
| 440 |
$this->render_admin_header(); |
| 441 |
?> |
| 442 |
<div class="wp-subscription-admin-content" style="max-width:1240px;margin:32px auto 0 auto"> |
| 443 |
<div class="wp-subscription-admin-box"> |
| 444 |
<?php include_once dirname(__FILE__) . '/views/settings.php'; ?> |
| 445 |
</div> |
| 446 |
</div> |
| 447 |
<div style="text-align:center;margin:38px 0 0 0;font-size:14px;color:#888;"> |
| 448 |
Made with <span style="color:#e25555;font-size:1.1em;">♥</span> by the WP Subscription Team |
| 449 |
<div style="margin-top:6px;"> |
| 450 |
<a href="https://wpsubscription.co/support" target="_blank" style="color:#2563eb;text-decoration:none;">Support</a> |
| 451 |
/ |
| 452 |
<a href="https://wpsubscription.co/docs" target="_blank" style="color:#2563eb;text-decoration:none;">Docs</a> |
| 453 |
</div> |
| 454 |
</div> |
| 455 |
<?php |
| 456 |
} |
| 457 |
|
| 458 |
/** |
| 459 |
* Render Support page |
| 460 |
*/ |
| 461 |
public function render_support_page() { |
| 462 |
$this->render_admin_header(); |
| 463 |
?> |
| 464 |
<div class="wp-subscription-admin-content" style="max-width:1240px;margin:32px auto 0 auto"> |
| 465 |
<?php if ( ! class_exists('Sdevs_Wc_Subscription_Pro') ) : ?> |
| 466 |
<!-- HERO VARIANT 1: Emoji --> |
| 467 |
<div class="wp-subscription-hero-upgrade" style="margin-bottom:18px;"> |
| 468 |
<div class="wp-subscription-hero-content"> |
| 469 |
<span class="wp-subscription-hero-icon">✨</span> |
| 470 |
<span class="wp-subscription-hero-title"> |
| 471 |
Unlock advanced features, priority support,<br> |
| 472 |
and more subscription control and reporting. |
| 473 |
</span> |
| 474 |
</div> |
| 475 |
<a href="https://wpsubscription.co/?utm_source=plugin&utm_medium=admin&utm_campaign=upgrade_pro" |
| 476 |
target="_blank" |
| 477 |
class="wp-subscription-hero-btn"> |
| 478 |
UPGRADE TO PRO |
| 479 |
</a> |
| 480 |
</div> |
| 481 |
<?php endif; ?> |
| 482 |
|
| 483 |
<!-- Product Overview & Video --> |
| 484 |
<div class="wp-subscription-admin-box" style="margin-bottom:24px;display:flex;gap:32px;align-items:flex-start;flex-wrap:wrap;"> |
| 485 |
<div style="flex:2;min-width:260px;"> |
| 486 |
<h3>Product Overview</h3> |
| 487 |
<p style="font-size:14px;line-height:1.7;margin:0 0 10px 0;">WP Subscription helps you manage WooCommerce subscriptions with ease. Enjoy a modern admin UI, powerful filters, detailed history, and seamless customer management. Designed for speed, clarity, and growth.</p> |
| 488 |
<ul style="font-size:14px;line-height:1.6;margin:0 0 0 18px;padding:0;list-style:disc;"> |
| 489 |
<li>Modern, compact admin interface</li> |
| 490 |
<li>Advanced filtering & search</li> |
| 491 |
<li>Subscription history & activities</li> |
| 492 |
<li>Easy migration from other plugins</li> |
| 493 |
<li>Pro: Analytics, automation, integrations, and more!</li> |
| 494 |
</ul> |
| 495 |
</div> |
| 496 |
<div style="flex:1;min-width:220px;max-width:320px;"> |
| 497 |
<div style="background:#f4f7fa;border-radius:8px;padding:10px 10px 6px 10px;box-shadow:0 2px 8px #e0e7ef;"> |
| 498 |
<div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;border-radius:6px;"> |
| 499 |
<iframe src="https://www.youtube.com/embed/XXXXXXXX" title="WP Subscription Overview" frameborder="0" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;border-radius:6px;"></iframe> |
| 500 |
</div> |
| 501 |
<div style="text-align:center;font-size:13px;color:#888;margin-top:4px;">Watch: Quick Product Tour</div> |
| 502 |
</div> |
| 503 |
</div> |
| 504 |
</div> |
| 505 |
|
| 506 |
<!-- PRO Features List --> |
| 507 |
<div class="wp-subscription-admin-box wp-subscription-pro-features" style="margin-bottom:32px;"> |
| 508 |
<div style="font-size:1.3em;font-weight:600;margin-bottom:12px;display:flex;align-items:center;gap:10px;"> |
| 509 |
<svg width="28" height="28" fill="none" viewBox="0 0 28 28"><circle cx="14" cy="14" r="14" fill="#2196f3"/><path d="M9 14.5l3 3 7-7" stroke="#fff" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| 510 |
<span>WP Subscription PRO Features</span> |
| 511 |
</div> |
| 512 |
<ul class="wp-subscription-pro-feature-list" style="list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:18px;"> |
| 513 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 514 |
<span style="font-size:1.5em;color:#2196f3;">🔀</span> |
| 515 |
<span><b>Variable Product</b><br><span style="color:#555;font-size:0.98em;">Offer flexible subscription options for variable products.</span></span> |
| 516 |
</li> |
| 517 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 518 |
<span style="font-size:1.5em;color:#2196f3;">🚚</span> |
| 519 |
<span><b>Delivery Schedule</b><br><span style="color:#555;font-size:0.98em;">Set custom delivery intervals for each subscription.</span></span> |
| 520 |
</li> |
| 521 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 522 |
<span style="font-size:1.5em;color:#2196f3;">📜</span> |
| 523 |
<span><b>Subscription History</b><br><span style="color:#555;font-size:0.98em;">Track all changes and events for every subscription.</span></span> |
| 524 |
</li> |
| 525 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 526 |
<span style="font-size:1.5em;color:#2196f3;">⏳</span> |
| 527 |
<span><b>More Subscription Durations</b><br><span style="color:#555;font-size:0.98em;">Offer more flexible and custom subscription periods.</span></span> |
| 528 |
</li> |
| 529 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 530 |
<span style="font-size:1.5em;color:#2196f3;">💶</span> |
| 531 |
<span><b>Sign Up Fee</b><br><span style="color:#555;font-size:0.98em;">Charge a one-time sign up fee for new subscribers.</span></span> |
| 532 |
</li> |
| 533 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 534 |
<span style="font-size:1.5em;color:#2196f3;">⏩</span> |
| 535 |
<span><b>Early Renewal</b><br><span style="color:#555;font-size:0.98em;">Allow customers to renew their subscription before expiry.</span></span> |
| 536 |
</li> |
| 537 |
<li style="background:#f4f7fa;border-radius:8px;padding:18px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 2px 8px #e0e7ef;"> |
| 538 |
<span style="font-size:1.5em;color:#2196f3;">💳</span> |
| 539 |
<span><b>Renewal Price</b><br><span style="color:#555;font-size:0.98em;">Set a different price for subscription renewals.</span></span> |
| 540 |
</li> |
| 541 |
</ul> |
| 542 |
</div> |
| 543 |
|
| 544 |
<!-- Support Resources: 2 rows, 2 columns, each in its own box --> |
| 545 |
<div class="wp-subscription-support-resources" style="display:grid;grid-template-columns:repeat(2,1fr);gap:24px;margin-bottom:24px;"> |
| 546 |
<div class="wp-subscription-admin-box"> |
| 547 |
<h3>Documentation</h3> |
| 548 |
<p style="font-size:14px;margin:0 0 8px 0;">Read our <a href="https://wpsubscription.co/docs\" target=\"_blank\" style=\"color:#2271b1;\">comprehensive docs</a> for setup, migration, and advanced usage.</p> |
| 549 |
<a href="https://wpsubscription.co/docs" target="_blank" class="button button-small" style="font-size:13px;padding:5px 14px;">View Docs</a> |
| 550 |
</div> |
| 551 |
<div class="wp-subscription-admin-box"> |
| 552 |
<h3>Facing An Issue?</h3> |
| 553 |
<p style="font-size:14px;margin:0 0 8px 0;">If you have a problem, <a href="https://wpsubscription.co/support\" target=\"_blank\" style=\"color:#d93025;\">open a support ticket</a> or check our FAQ.</p> |
| 554 |
<a href="https://wpsubscription.co/support" target="_blank" class="button button-small" style="font-size:13px;padding:5px 14px;">Get Support</a> |
| 555 |
</div> |
| 556 |
<div class="wp-subscription-admin-box"> |
| 557 |
<h3>Request a Feature</h3> |
| 558 |
<p style="font-size:14px;margin:0 0 8px 0;">Have an idea? <a href="https://wpsubscription.co/feature-request\" target=\"_blank\" style=\"color:#2271b1;\">Request a feature</a> or vote on others.</p> |
| 559 |
<a href="https://wpsubscription.co/feature-request" target="_blank" class="button button-small" style="font-size:13px;padding:5px 14px;">Request Feature</a> |
| 560 |
</div> |
| 561 |
<div class="wp-subscription-admin-box"> |
| 562 |
<h3>Show Your Love</h3> |
| 563 |
<p style="font-size:14px;margin:0 0 8px 0;">Enjoying WP Subscription? <a href="https://wordpress.org/support/plugin/subscription/reviews/\" target=\"_blank\" style=\"color:#f59e42;\">Leave us a review</a> or share your experience!</p> |
| 564 |
<a href="https://wordpress.org/support/plugin/subscription/reviews/" target="_blank" class="button button-small" style="font-size:13px;padding:5px 14px;">Leave a Review</a> |
| 565 |
</div> |
| 566 |
</div> |
| 567 |
</div> |
| 568 |
<div style="text-align:center;margin:38px 0 0 0;font-size:14px;color:#888;"> |
| 569 |
Made with <span style="color:#e25555;font-size:1.1em;">♥</span> by the WP Subscription Team |
| 570 |
<div style="margin-top:6px;"> |
| 571 |
<a href="https://wpsubscription.co/support" target="_blank" style="color:#2563eb;text-decoration:none;">Support</a> |
| 572 |
/ |
| 573 |
<a href="https://wpsubscription.co/docs" target="_blank" style="color:#2563eb;text-decoration:none;">Docs</a> |
| 574 |
</div> |
| 575 |
</div> |
| 576 |
<?php |
| 577 |
} |
| 578 |
|
| 579 |
/** |
| 580 |
* Render the legacy subscriptions list page (WP_List_Table based) |
| 581 |
*/ |
| 582 |
public function render_legacy_subscriptions_page() { |
| 583 |
// No longer needed, as the menu now links directly to the post type list. |
| 584 |
} |
| 585 |
} |
| 586 |
|