|
1 | 1 | <?php |
2 | 2 |
|
3 | | -class WC_Checkoutcom_Admin |
4 | | -{ |
5 | | - public static function generate_links($key, $value) |
6 | | - { |
7 | | - ?> |
8 | | - <div class="test" style="padding-bottom: 20px; padding-top: 10px;"> |
9 | | - <tr valign="top"> |
10 | | - <td colspan="2" class="forminp forminp-screen_button"> |
11 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards' ); ?>" |
12 | | - style="text-decoration: none"> <h2><?php _e( 'Core Settings', 'wc_checkout_com' ); ?></a> |
13 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
14 | | - </td> |
15 | | - </tr> |
16 | | - <tr valign="top"> |
17 | | - <td colspan="2" class="forminp forminp-screen_button"> |
18 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=card_settings' ); ?>" |
19 | | - style="text-decoration: none"><?php _e( 'Card Settings', 'wc_checkout_com' ); ?></a> |
20 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
21 | | - </td> |
22 | | - </tr> |
23 | | - <tr valign="top"> |
24 | | - <td colspan="2" class="forminp forminp-screen_button"> |
25 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=orders_settings' ); ?>" |
26 | | - style="text-decoration: none"><?php _e( 'Order Settings', 'wc_checkout_com' ); ?></a> |
27 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
28 | | - </td> |
29 | | - </tr> |
30 | | - <tr valign="top"> |
31 | | - <td colspan="2" class="forminp forminp-screen_button"> |
32 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_google_pay' ); ?>" |
33 | | - style="text-decoration: none"><?php _e( 'Google Pay', 'wc_checkout_com' ); ?></a> |
34 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
35 | | - </td> |
36 | | - </tr> |
37 | | - <tr valign="top"> |
38 | | - <td colspan="2" class="forminp forminp-screen_button"> |
39 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_apple_pay' ); ?>" |
40 | | - style="text-decoration: none"><?php _e( 'Apple Pay', 'wc_checkout_com' ); ?></a> |
41 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
42 | | - </td> |
43 | | - </tr> |
44 | | - <tr valign="top"> |
45 | | - <td colspan="2" class="forminp forminp-screen_button"> |
46 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_alternative_payments' ); ?>" |
47 | | - style="text-decoration: none"><?php _e( 'Alternative Payments', 'wc_checkout_com' ); ?></a> |
48 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
49 | | - </td> |
50 | | - </tr> |
51 | | - <tr valign="top"> |
52 | | - <td colspan="2" class="forminp forminp-screen_button"> |
53 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=debug_settings' ); ?>" |
54 | | - style="text-decoration: none"><?php _e( 'Debug Settings', 'wc_checkout_com' ); ?></a> |
55 | | - <p style="display: unset;opacity: 0.5;"><?php echo '|'; ?></p> |
56 | | - </td> |
57 | | - </tr> |
58 | | - <tr valign="top"> |
59 | | - <td colspan="2" class="forminp forminp-screen_button"> |
60 | | - <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=webhook' ); ?>" |
61 | | - style="text-decoration: none"><?php _e( 'Webhook', 'wc_checkout_com' ); ?></a> |
62 | | - </td> |
63 | | - </tr> |
64 | | - </div> |
65 | | - <?php |
66 | | - } |
| 3 | +/** |
| 4 | + * The admin-specific functionality of the plugin. |
| 5 | + */ |
| 6 | +class WC_Checkoutcom_Admin { |
| 7 | + |
| 8 | + /** |
| 9 | + * Generate HTML links for the settings page. |
| 10 | + * |
| 11 | + * @param string $key Key. |
| 12 | + * @param array $value Value. |
| 13 | + * |
| 14 | + * @return void |
| 15 | + */ |
| 16 | + public static function generate_links( $key, $value ) { |
| 17 | + |
| 18 | + $screen = ! empty( $_GET['screen'] ) ? sanitize_text_field( wp_unslash( $_GET['screen'] ) ) : ''; |
| 19 | + if ( empty( $screen ) ) { |
| 20 | + $screen = ! empty( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : ''; |
| 21 | + } |
| 22 | + |
| 23 | + ?> |
| 24 | + <style> |
| 25 | + .cko-admin-settings__links { |
| 26 | + padding-bottom: 20px; |
| 27 | + padding-top: 10px; |
| 28 | + } |
| 29 | + .cko-admin-settings__links li { |
| 30 | + color: #646970; |
| 31 | + font-size: 17px; |
| 32 | + font-weight: 600; |
| 33 | + display: inline-block; |
| 34 | + margin: 0; |
| 35 | + padding: 0; |
| 36 | + white-space: nowrap; |
| 37 | + } |
| 38 | + .cko-admin-settings__links a { |
| 39 | + text-decoration: none; |
| 40 | + } |
| 41 | + .cko-admin-settings__links .current { |
| 42 | + color: #000; |
| 43 | + } |
| 44 | + </style> |
| 45 | + <div class="cko-admin-settings__links"> |
| 46 | + <ul> |
| 47 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards' ) ); ?>" |
| 48 | + class="<?php echo 'wc_checkout_com_cards' === $screen ? 'current' : null; ?>"> |
| 49 | + <?php esc_html_e( 'Core Settings', 'wc_checkout_com' ); ?></a> | </li> |
| 50 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=card_settings' ) ); ?>" |
| 51 | + class="<?php echo 'card_settings' === $screen ? 'current' : null; ?>"> |
| 52 | + <?php esc_html_e( 'Card Settings', 'wc_checkout_com' ); ?></a> | </li> |
| 53 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=orders_settings' ) ); ?>" |
| 54 | + class="<?php echo 'orders_settings' === $screen ? 'current' : null; ?>"> |
| 55 | + <?php esc_html_e( 'Order Settings', 'wc_checkout_com' ); ?></a> | </li> |
| 56 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_google_pay' ) ); ?>" |
| 57 | + class="<?php echo 'wc_checkout_com_google_pay' === $screen ? 'current' : null; ?>"> |
| 58 | + <?php esc_html_e( 'Google Pay', 'wc_checkout_com' ); ?></a> | </li> |
| 59 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_apple_pay' ) ); ?>" |
| 60 | + class="<?php echo 'wc_checkout_com_apple_pay' === $screen ? 'current' : null; ?>"> |
| 61 | + <?php esc_html_e( 'Apple Pay', 'wc_checkout_com' ); ?></a> | </li> |
| 62 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_alternative_payments' ) ); ?>" |
| 63 | + class="<?php echo 'wc_checkout_com_alternative_payments' === $screen ? 'current' : null; ?>"> |
| 64 | + <?php esc_html_e( 'Alternative Payments', 'wc_checkout_com' ); ?></a> | </li> |
| 65 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=debug_settings' ) ); ?>" |
| 66 | + class="<?php echo 'debug_settings' === $screen ? 'current' : null; ?>"> |
| 67 | + <?php esc_html_e( 'Debug Settings', 'wc_checkout_com' ); ?></a> | </li> |
| 68 | + <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wc_checkout_com_cards&screen=webhook' ) ); ?>" |
| 69 | + class="<?php echo 'webhook' === $screen ? 'current' : null; ?>"> |
| 70 | + <?php esc_html_e( 'Webhook', 'wc_checkout_com' ); ?></a></li> |
| 71 | + </ul> |
| 72 | + </div> |
| 73 | + <?php |
| 74 | + } |
67 | 75 | } |
0 commit comments