Created new Settings API tab and moved the old webhooks tab to API tab
This commit is contained in:
parent
d53f78ed56
commit
0edbfeaa35
|
@ -2,10 +2,10 @@
|
||||||
/**
|
/**
|
||||||
* WooCommerce Admin Settings Class.
|
* WooCommerce Admin Settings Class.
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package WooCommerce/Admin
|
* @package WooCommerce/Admin
|
||||||
* @version 2.2.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -40,7 +40,7 @@ class WC_Admin_Settings {
|
||||||
$settings[] = include( 'settings/class-wc-settings-accounts.php' );
|
$settings[] = include( 'settings/class-wc-settings-accounts.php' );
|
||||||
$settings[] = include( 'settings/class-wc-settings-emails.php' );
|
$settings[] = include( 'settings/class-wc-settings-emails.php' );
|
||||||
$settings[] = include( 'settings/class-wc-settings-integrations.php' );
|
$settings[] = include( 'settings/class-wc-settings-integrations.php' );
|
||||||
$settings[] = include( 'settings/class-wc-settings-webhooks.php' );
|
$settings[] = include( 'settings/class-wc-settings-api.php' );
|
||||||
|
|
||||||
self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings );
|
self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings );
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package WooCommerce/Admin
|
* @package WooCommerce/Admin
|
||||||
* @version 2.3.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -76,7 +76,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||||
*/
|
*/
|
||||||
public function column_title( $webhook ) {
|
public function column_title( $webhook ) {
|
||||||
$the_webhook = $this->get_webbook_object( $webhook );
|
$the_webhook = $this->get_webbook_object( $webhook );
|
||||||
$edit_link = admin_url( 'admin.php?page=wc-settings&tab=webhooks&edit-webhook=' . $the_webhook->id );
|
$edit_link = admin_url( 'admin.php?page=wc-settings&tab=api&section=webhooks&edit-webhook=' . $the_webhook->id );
|
||||||
$title = _draft_or_post_title( $the_webhook->get_post_data() );
|
$title = _draft_or_post_title( $the_webhook->get_post_data() );
|
||||||
$post_type_object = get_post_type_object( $the_webhook->get_post_data()->post_type );
|
$post_type_object = get_post_type_object( $the_webhook->get_post_data()->post_type );
|
||||||
$post_status = $the_webhook->get_post_data()->post_status;
|
$post_status = $the_webhook->get_post_data()->post_status;
|
||||||
|
@ -209,7 +209,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = empty( $class ) && empty( $_REQUEST['status'] ) ? ' class="current"' : '';
|
$class = empty( $class ) && empty( $_REQUEST['status'] ) ? ' class="current"' : '';
|
||||||
$status_links['all'] = "<a href='admin.php?page=wc-settings&tab=webhooks'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'woocommerce' ), number_format_i18n( $total_posts ) ) . '</a>';
|
$status_links['all'] = "<a href='admin.php?page=wc-settings&tab=api&section=webhooks'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'woocommerce' ), number_format_i18n( $total_posts ) ) . '</a>';
|
||||||
|
|
||||||
foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) {
|
foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) {
|
||||||
$class = '';
|
$class = '';
|
||||||
|
@ -229,7 +229,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||||
|
|
||||||
$label = $this->get_status_label( $status_name, $status );
|
$label = $this->get_status_label( $status_name, $status );
|
||||||
|
|
||||||
$status_links[ $status_name ] = "<a href='admin.php?page=wc-settings&tab=webhooks&status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
|
$status_links[ $status_name ] = "<a href='admin.php?page=wc-settings&tab=api&section=webhooks&status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $status_links;
|
return $status_links;
|
||||||
|
@ -260,7 +260,7 @@ class WC_Admin_Webhooks_Table_List extends WP_List_Table {
|
||||||
*/
|
*/
|
||||||
protected function extra_tablenav( $which ) {
|
protected function extra_tablenav( $which ) {
|
||||||
if ( 'top' == $which && isset( $_GET['status'] ) && 'trash' == $_GET['status'] && current_user_can( 'delete_shop_webhooks' ) ) {
|
if ( 'top' == $which && isset( $_GET['status'] ) && 'trash' == $_GET['status'] && current_user_can( 'delete_shop_webhooks' ) ) {
|
||||||
echo '<div class="alignleft actions"><a class="button apply" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=webhooks&status=trash&empty_trash=1' ) ) . '">' . __( 'Empty Trash', 'woocommerce' ) . '</a></div>';
|
echo '<div class="alignleft actions"><a class="button apply" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&status=trash&empty_trash=1' ) ) . '">' . __( 'Empty Trash', 'woocommerce' ) . '</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package WooCommerce/Admin
|
* @package WooCommerce/Admin
|
||||||
* @version 2.3.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -30,7 +30,12 @@ class WC_Admin_Webhooks {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function is_webhook_settings_page() {
|
private function is_webhook_settings_page() {
|
||||||
return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] && isset( $_GET['tab'] ) && 'webhooks' == $_GET['tab'];
|
return isset( $_GET['page'] )
|
||||||
|
&& 'wc-settings' == $_GET['page']
|
||||||
|
&& isset( $_GET['tab'] )
|
||||||
|
&& 'api' == $_GET['tab']
|
||||||
|
&& isset( $_GET['section'] )
|
||||||
|
&& 'webhooks' == isset( $_GET['section'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +162,7 @@ class WC_Admin_Webhooks {
|
||||||
delete_transient( 'woocommerce_webhook_ids' );
|
delete_transient( 'woocommerce_webhook_ids' );
|
||||||
|
|
||||||
// Redirect to webhook edit page to avoid settings save actions
|
// Redirect to webhook edit page to avoid settings save actions
|
||||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=webhooks&edit-webhook=' . $webhook->id . '&updated=1' ) );
|
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook->id . '&updated=1' ) );
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +193,7 @@ class WC_Admin_Webhooks {
|
||||||
delete_transient( 'woocommerce_webhook_ids' );
|
delete_transient( 'woocommerce_webhook_ids' );
|
||||||
|
|
||||||
// Redirect to edit page
|
// Redirect to edit page
|
||||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=webhooks&edit-webhook=' . $webhook_id . '&created=1' ) );
|
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook_id . '&created=1' ) );
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +217,7 @@ class WC_Admin_Webhooks {
|
||||||
$status = isset( $_GET['status'] ) ? '&status=' . sanitize_text_field( $_GET['status'] ) : '';
|
$status = isset( $_GET['status'] ) ? '&status=' . sanitize_text_field( $_GET['status'] ) : '';
|
||||||
|
|
||||||
// Redirect to webhooks page
|
// Redirect to webhooks page
|
||||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=webhooks' . $status . '&' . $type . '=' . $qty ) );
|
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks' . $status . '&' . $type . '=' . $qty ) );
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +234,7 @@ class WC_Admin_Webhooks {
|
||||||
$qty = count( $webhooks );
|
$qty = count( $webhooks );
|
||||||
|
|
||||||
// Redirect to webhooks page
|
// Redirect to webhooks page
|
||||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=webhooks&status=trash&untrashed=' . $qty ) );
|
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&status=trash&untrashed=' . $qty ) );
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +288,7 @@ class WC_Admin_Webhooks {
|
||||||
$qty = count( $webhooks );
|
$qty = count( $webhooks );
|
||||||
|
|
||||||
// Redirect to webhooks page
|
// Redirect to webhooks page
|
||||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=webhooks&deleted=' . $qty ) );
|
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&deleted=' . $qty ) );
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,54 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* WooCommerce Webhooks Settings
|
* WooCommerce API Settings
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package WooCommerce/Admin
|
* @package WooCommerce/Admin
|
||||||
* @version 2.3.0
|
* @version 2.4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly
|
exit; // Exit if accessed directly
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! class_exists( 'WC_Settings_Webhooks' ) ) :
|
if ( ! class_exists( 'WC_Settings_Rest_API' ) ) :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Settings_Webhooks
|
* WC_Settings_Rest_API
|
||||||
*/
|
*/
|
||||||
class WC_Settings_Webhooks extends WC_Settings_Page {
|
class WC_Settings_Rest_API extends WC_Settings_Page {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->id = 'webhooks';
|
$this->id = 'api';
|
||||||
$this->label = __( 'Webhooks', 'woocommerce' );
|
$this->label = __( 'API', 'woocommerce' );
|
||||||
|
|
||||||
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||||
add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
|
add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
|
||||||
|
add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) );
|
||||||
add_action( 'woocommerce_settings_form_method_tab_' . $this->id, array( $this, 'form_method' ) );
|
add_action( 'woocommerce_settings_form_method_tab_' . $this->id, array( $this, 'form_method' ) );
|
||||||
|
|
||||||
$this->notices();
|
$this->notices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sections
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_sections() {
|
||||||
|
$sections = array(
|
||||||
|
'' => __( 'Settings', 'woocommerce' ),
|
||||||
|
'keys' => __( 'Keys', 'woocommerce' ),
|
||||||
|
'webhooks' => __( 'Webhooks', 'woocommerce' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form method
|
* Form method
|
||||||
*
|
*
|
||||||
|
@ -41,7 +57,9 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function form_method( $method ) {
|
public function form_method( $method ) {
|
||||||
if ( isset( $_GET['edit-webhook'] ) ) {
|
global $current_section;
|
||||||
|
|
||||||
|
if ( 'webhooks' == $current_section && isset( $_GET['edit-webhook'] ) ) {
|
||||||
$webhook_id = absint( $_GET['edit-webhook'] );
|
$webhook_id = absint( $_GET['edit-webhook'] );
|
||||||
$webhook = new WC_Webhook( $webhook_id );
|
$webhook = new WC_Webhook( $webhook_id );
|
||||||
|
|
||||||
|
@ -57,6 +75,46 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
* Notices.
|
* Notices.
|
||||||
*/
|
*/
|
||||||
private function notices() {
|
private function notices() {
|
||||||
|
if ( isset( $_GET['section'] ) && 'webhooks' == $_GET['section'] ) {
|
||||||
|
$this->webhook_notices();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the settings
|
||||||
|
*/
|
||||||
|
public function output() {
|
||||||
|
global $current_section;
|
||||||
|
|
||||||
|
if ( 'webhooks' == $current_section ) {
|
||||||
|
$this->webhooks_output();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhooks output
|
||||||
|
*/
|
||||||
|
private function webhooks_output() {
|
||||||
|
// Hide the save button
|
||||||
|
$GLOBALS['hide_save_button'] = true;
|
||||||
|
|
||||||
|
if ( isset( $_GET['edit-webhook'] ) ) {
|
||||||
|
$webhook_id = absint( $_GET['edit-webhook'] );
|
||||||
|
$webhook = new WC_Webhook( $webhook_id );
|
||||||
|
|
||||||
|
if ( 'trash' != $webhook->post_data->post_status ) {
|
||||||
|
$this->webhooks_edit_output( $webhook );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->webhooks_table_list_output();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Webhooks - Notices.
|
||||||
|
*/
|
||||||
|
private function webhook_notices() {
|
||||||
if ( isset( $_GET['trashed'] ) ) {
|
if ( isset( $_GET['trashed'] ) ) {
|
||||||
$trashed = absint( $_GET['trashed'] );
|
$trashed = absint( $_GET['trashed'] );
|
||||||
|
|
||||||
|
@ -85,16 +143,17 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table list output
|
* Webhooks - Table list output
|
||||||
*/
|
*/
|
||||||
private function table_list_output() {
|
private function webhooks_table_list_output() {
|
||||||
echo '<h3>' . __( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=webhooks&create-webhook=1' ) ) . '" class="add-new-h2">' . __( 'Add Webhook', 'woocommerce' ) . '</a></h3>';
|
echo '<h3>' . __( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&create-webhook=1' ) ) . '" class="add-new-h2">' . __( 'Add Webhook', 'woocommerce' ) . '</a></h3>';
|
||||||
|
|
||||||
$webhooks_table_list = new WC_Admin_Webhooks_Table_List();
|
$webhooks_table_list = new WC_Admin_Webhooks_Table_List();
|
||||||
$webhooks_table_list->prepare_items();
|
$webhooks_table_list->prepare_items();
|
||||||
|
|
||||||
echo '<input type="hidden" name="page" value="wc-settings" />';
|
echo '<input type="hidden" name="page" value="wc-settings" />';
|
||||||
echo '<input type="hidden" name="tab" value="webhooks" />';
|
echo '<input type="hidden" name="tab" value="api" />';
|
||||||
|
echo '<input type="hidden" name="section" value="webhooks" />';
|
||||||
|
|
||||||
$webhooks_table_list->views();
|
$webhooks_table_list->views();
|
||||||
$webhooks_table_list->search_box( __( 'Search Webhooks', 'woocommerce' ), 'webhook' );
|
$webhooks_table_list->search_box( __( 'Search Webhooks', 'woocommerce' ), 'webhook' );
|
||||||
|
@ -102,20 +161,20 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit webhook output
|
* Webhooks - Edit webhook output
|
||||||
*
|
*
|
||||||
* @param WC_Webhook $webhook
|
* @param WC_Webhook $webhook
|
||||||
*/
|
*/
|
||||||
private function edit_output( $webhook ) {
|
private function webhooks_edit_output( $webhook ) {
|
||||||
include_once( 'views/html-webhooks-edit.php' );
|
include_once( 'views/html-webhooks-edit.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs output
|
* Webhooks - Logs output
|
||||||
*
|
*
|
||||||
* @param WC_Webhook $webhook
|
* @param WC_Webhook $webhook
|
||||||
*/
|
*/
|
||||||
private function logs_output( $webhook ) {
|
private function webhooks_logs_output( $webhook ) {
|
||||||
$current = isset( $_GET['log_page'] ) ? absint( $_GET['log_page'] ) : 1;
|
$current = isset( $_GET['log_page'] ) ? absint( $_GET['log_page'] ) : 1;
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_id' => $webhook->id,
|
'post_id' => $webhook->id,
|
||||||
|
@ -142,33 +201,11 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output the settings
|
* Webhooks - Get the webhook topic data
|
||||||
*/
|
|
||||||
public function output() {
|
|
||||||
global $current_section;
|
|
||||||
|
|
||||||
// Hide the save button
|
|
||||||
$GLOBALS['hide_save_button'] = true;
|
|
||||||
|
|
||||||
if ( isset( $_GET['edit-webhook'] ) ) {
|
|
||||||
$webhook_id = absint( $_GET['edit-webhook'] );
|
|
||||||
$webhook = new WC_Webhook( $webhook_id );
|
|
||||||
|
|
||||||
if ( 'trash' != $webhook->post_data->post_status ) {
|
|
||||||
$this->edit_output( $webhook );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->table_list_output();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the webhook topic data
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function get_topic_data( $webhook ) {
|
private function webhooks_get_topic_data( $webhook ) {
|
||||||
$topic = $webhook->get_topic();
|
$topic = $webhook->get_topic();
|
||||||
$event = '';
|
$event = '';
|
||||||
$resource = '';
|
$resource = '';
|
||||||
|
@ -191,13 +228,13 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the logs navigation.
|
* Webhooks - Get the logs navigation.
|
||||||
*
|
*
|
||||||
* @param int $total
|
* @param int $total
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function get_logs_navigation( $total, $webhook ) {
|
private function webhooks_get_logs_navigation( $total, $webhook ) {
|
||||||
$pages = ceil( $total / 10 );
|
$pages = ceil( $total / 10 );
|
||||||
$current = isset( $_GET['log_page'] ) ? absint( $_GET['log_page'] ) : 1;
|
$current = isset( $_GET['log_page'] ) ? absint( $_GET['log_page'] ) : 1;
|
||||||
|
|
||||||
|
@ -212,13 +249,13 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
if ( 1 == $current ) {
|
if ( 1 == $current ) {
|
||||||
$html .= '<button class="button-primary" disabled="disabled">' . __( '‹ Previous', 'woocommerce' ) . '</button> ';
|
$html .= '<button class="button-primary" disabled="disabled">' . __( '‹ Previous', 'woocommerce' ) . '</button> ';
|
||||||
} else {
|
} else {
|
||||||
$html .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=wc-settings&tab=webhooks&edit-webhook=' . $webhook->id . '&log_page=' . ( $current - 1 ) ) . '#webhook-logs">' . __( '‹ Previous', 'woocommerce' ) . '</a> ';
|
$html .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook->id . '&log_page=' . ( $current - 1 ) ) . '#webhook-logs">' . __( '‹ Previous', 'woocommerce' ) . '</a> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $pages == $current ) {
|
if ( $pages == $current ) {
|
||||||
$html .= '<button class="button-primary" disabled="disabled">' . __( 'Next ›', 'woocommerce' ) . '</button>';
|
$html .= '<button class="button-primary" disabled="disabled">' . __( 'Next ›', 'woocommerce' ) . '</button>';
|
||||||
} else {
|
} else {
|
||||||
$html .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=wc-settings&tab=webhooks&edit-webhook=' . $webhook->id . '&log_page=' . ( $current + 1 ) ) . '#webhook-logs">' . __( 'Next ›', 'woocommerce' ) . '</a>';
|
$html .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=wc-settings&tab=api§ion=webhooks&edit-webhook=' . $webhook->id . '&log_page=' . ( $current + 1 ) ) . '#webhook-logs">' . __( 'Next ›', 'woocommerce' ) . '</a>';
|
||||||
}
|
}
|
||||||
$html .= '</p>';
|
$html .= '</p>';
|
||||||
}
|
}
|
||||||
|
@ -231,4 +268,4 @@ class WC_Settings_Webhooks extends WC_Settings_Page {
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
return new WC_Settings_Webhooks();
|
return new WC_Settings_Rest_API();
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$count_comments = wp_count_comments( $webhook->id );
|
$count_comments = wp_count_comments( $webhook->id );
|
||||||
|
@ -9,7 +9,7 @@ $total = $count_comments->approved;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php echo $this->get_logs_navigation( $total, $webhook ); ?>
|
<?php echo $this->webhooks_get_logs_navigation( $total, $webhook ); ?>
|
||||||
|
|
||||||
<table id="webhook-logs-table" class="widefat">
|
<table id="webhook-logs-table" class="widefat">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -39,4 +39,4 @@ $total = $count_comments->approved;
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php echo $this->get_logs_navigation( $total, $webhook ); ?>
|
<?php echo $this->webhooks_get_logs_navigation( $total, $webhook ); ?>
|
||||||
|
|
|
@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select">
|
<select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select">
|
||||||
<?php
|
<?php
|
||||||
$topic_data = $this->get_topic_data( $webhook );
|
$topic_data = $this->webhooks_get_topic_data( $webhook );
|
||||||
|
|
||||||
$topics = array(
|
$topics = array(
|
||||||
'' => __( 'Select an option…', 'woocommerce' ),
|
'' => __( 'Select an option…', 'woocommerce' ),
|
||||||
|
@ -162,7 +162,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
<div id="webhook-logs" class="settings-panel">
|
<div id="webhook-logs" class="settings-panel">
|
||||||
<h3><?php _e( 'Webhook Logs', 'woocommerce' ); ?></h3>
|
<h3><?php _e( 'Webhook Logs', 'woocommerce' ); ?></h3>
|
||||||
|
|
||||||
<?php $this->logs_output( $webhook ); ?>
|
<?php $this->webhooks_logs_output( $webhook ); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
Loading…
Reference in New Issue