wp_create_nonce( 'merchant' ),
'ajax_url' => admin_url( 'admin-ajax.php' ),
) );
$module = ( ! empty( $_GET['module'] ) ) ? sanitize_text_field( wp_unslash( $_GET['module'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if( !empty($module) ) {
wp_enqueue_script( 'merchant-admin-preview', MERCHANT_URI . 'assets/js/admin/merchant-preview.min.js', array( 'jquery' ), MERCHANT_VERSION, true );
}
}
}
/**
* Add plugin settings link on the plugin page.
*/
public function action_links( $links ) {
$page_url = add_query_arg( array( 'page' => 'merchant' ), admin_url( 'themes.php' ) );
$action_links = array(
'settings' => '' . esc_html__( 'Settings', 'merchant' ) . '',
);
return array_merge( $action_links, $links );
}
/**
* Add plugin settings link on the plugin page.
*/
public function add_admin_footer_text( $text ) {
$page = ( ! empty( $_GET['page'] ) ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$module = ( ! empty( $_GET['module'] ) ) ? sanitize_text_field( wp_unslash( $_GET['module'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! empty( $page ) && false !== strpos( $page, 'merchant' ) ) {
$text = '';
if ( empty( $module ) ) {
$text .= sprintf( '', esc_html__( 'Join our community', 'merchant' ) );
$text .= esc_html__( 'to discuss about the product and ask for support or help the community.', 'merchant' );
}
}
return $text;
}
/**
* Add admin body class.
*/
public function add_admin_body_class( $classes ) {
$page = ( ! empty( $_GET['page'] ) ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$module = ( ! empty( $_GET['module'] ) ) ? sanitize_text_field( wp_unslash( $_GET['module'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! empty( $page ) && false !== strpos( $page, 'merchant' ) ) {
if ( ! empty( $module ) ) {
$classes .= ' merchant-admin-page-module';
} else {
$classes .= ' merchant-admin-page';
}
}
return $classes;
}
}
Merchant_Admin_Loader::instance();
}