Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/paymob-for-woocommerce/includes/admin/paymob-admin-tabs.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-admin-tabs.php
@@ -3,20 +3,20 @@
exit;
}
-$current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : 'paymob-main';
+$current_section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : 'paymob-main';
$output = '<div class="paymob-admin-tab">
- <a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=paymob-main') . '" class="tablinks ' . ($current_section === 'paymob-main' ? 'active' : '') . '">' . __('Main Configuration', 'paymob-woocommerce') . '</a>
- <a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=paymob_list_gateways') . '" class="tablinks ' . ($current_section === 'paymob_list_gateways' ? 'active' : '') . '">' . __('Payment Integrations', 'paymob-woocommerce') . '</a>
- <a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=paymob_pixel') . '" class="tablinks ' . ($current_section === 'paymob_pixel' ? 'active' : '') . '">' . __('Card Embedded Settings', 'paymob-woocommerce') . '</a>';
+ <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=paymob-main' ) ) . '" class="tablinks ' . esc_attr( 'paymob-main' === $current_section ? 'active' : '' ) . '">' . esc_html__( 'Main Configuration', 'paymob-for-woocommerce' ) . '</a>
+ <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=paymob_list_gateways' ) ) . '" class="tablinks ' . esc_attr( 'paymob_list_gateways' === $current_section ? 'active' : '' ) . '">' . esc_html__( 'Payment Integrations', 'paymob-for-woocommerce' ) . '</a>
+ <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=paymob_pixel' ) ) . '" class="tablinks ' . esc_attr( 'paymob_pixel' === $current_section ? 'active' : '' ) . '">' . esc_html__( 'Card Embedded Settings', 'paymob-for-woocommerce' ) . '</a>';
if ( class_exists( 'WC_Subscriptions' ) ) {
- $output .= '<a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=paymob_subscription') . '" class="tablinks ' . ($current_section === 'paymob_subscription' ? 'active' : '') . '">' . __('Subscription', 'paymob-woocommerce') . '</a>';
+ $output .= '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=paymob_subscription' ) ) . '" class="tablinks ' . esc_attr( 'paymob_subscription' === $current_section ? 'active' : '' ) . '">' . esc_html__( 'Subscription', 'paymob-for-woocommerce' ) . '</a>';
}
-$output .= '<a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=widget') . '" class="tablinks ' . ($current_section === 'widget' ? 'active' : '') . '"><span class="paymob-admin-tab__label">' . __('Affordability Widget', 'paymob-woocommerce') . '</span><span class="paymob-tab-new-badge">' . __('New', 'paymob-woocommerce') . '</span></a>';
+$output .= '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=widget' ) ) . '" class="tablinks ' . esc_attr( 'widget' === $current_section ? 'active' : '' ) . '"><span class="paymob-admin-tab__label">' . esc_html__( 'Affordability Widget', 'paymob-for-woocommerce' ) . '</span><span class="paymob-tab-new-badge">' . esc_html__( 'New', 'paymob-for-woocommerce' ) . '</span></a>';
-// $output .= '<a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=paymob_add_gateway') . '" class="tablinks ' . ($current_section === 'paymob_add_gateway' ? 'active' : '') . '">' . __('Add Payment Integration', 'paymob-woocommerce') . '</a>';
-$output .='</div>';
+// $output .= '<a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=paymob_add_gateway') . '" class="tablinks ' . ($current_section === 'paymob_add_gateway' ? 'active' : '') . '">' . esc_html__( 'Add Payment Integration', 'paymob-for-woocommerce') . '</a>';
+$output .= '</div>';
return $output;
--- a/paymob-for-woocommerce/includes/admin/paymob-connect.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-connect.php
@@ -4,8 +4,8 @@
}
return array(
'config_note' => array(
- 'title' => __( 'Connect Paymob account', 'paymob-woocommerce' ),
- 'description' => include PAYMOB_PLUGIN_PATH . '/includes/admin/views/htmlsviews/html_connect_paymob.php',
+ 'title' => __( 'Connect Paymob account', 'paymob-for-woocommerce' ),
+ 'description' => include __DIR__ . '/views/htmlsviews/html_connect_paymob.php',
'type' => 'title',
)
);
--- a/paymob-for-woocommerce/includes/admin/paymob-custom_list_setting.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-custom_list_setting.php
@@ -6,7 +6,7 @@
return array(
array(
'type' => 'title',
- 'name' => __( 'List of Payment Method Integrations', 'paymob-woocommerce' ),
+ 'name' => __( 'List of Payment Method Integrations', 'paymob-for-woocommerce' ),
),
array(
'type' => 'table',
--- a/paymob-for-woocommerce/includes/admin/paymob-custom_setting.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-custom_setting.php
@@ -2,7 +2,7 @@
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
+$tabs = include __DIR__ . '/paymob-admin-tabs.php';
return array(
array(
@@ -12,24 +12,24 @@
),
array(
'type' => 'title',
- 'name' => __( 'Add Payment Integration', 'paymob-woocommerce' ),
+ 'name' => __( 'Add Payment Integration', 'paymob-for-woocommerce' ),
),
array(
- 'name' => __( 'Enable', 'paymob-woocommerce' ),
+ 'name' => __( 'Enable', 'paymob-for-woocommerce' ),
'type' => 'checkbox',
'id' => 'payment_enabled',
'desc_tip' => true,
'default' => 'no',
),
array(
- 'name' => __( 'Payment Method', 'paymob-woocommerce' ),
+ 'name' => __( 'Payment Method', 'paymob-for-woocommerce' ),
'type' => 'text',
'id' => 'payment_integrations_type',
'desc_tip' => true,
'custom_attributes' => array( 'required' => 'required' ),
),
array(
- 'name' => __( 'Paymob Integration ID', 'paymob-woocommerce' ),
+ 'name' => __( 'Paymob Integration ID', 'paymob-for-woocommerce' ),
'type' => 'select',
'id' => 'integration_id',
'desc_tip' => true,
@@ -37,21 +37,21 @@
'options' => PaymobAutoGenerate::get_integration_ids(), // Dynamically loaded options.
),
array(
- 'name' => __( 'Payment Method - Title', 'paymob-woocommerce' ),
+ 'name' => __( 'Payment Method - Title', 'paymob-for-woocommerce' ),
'type' => 'text',
'id' => 'checkout_title',
'desc_tip' => true,
'custom_attributes' => array( 'required' => 'required' ),
),
array(
- 'name' => __( 'Payment Method - Description', 'paymob-woocommerce' ),
+ 'name' => __( 'Payment Method - Description', 'paymob-for-woocommerce' ),
'type' => 'textarea',
'id' => 'checkout_description',
'desc_tip' => true,
'custom_attributes' => array( 'required' => 'required' ),
),
array(
- 'name' => __( 'Payment Method - Logo URL', 'paymob-woocommerce' ),
+ 'name' => __( 'Payment Method - Logo URL', 'paymob-for-woocommerce' ),
'type' => 'text',
'id' => 'payment_logo',
'desc_tip' => true,
--- a/paymob-for-woocommerce/includes/admin/paymob-error-logs/class-paymob-error-logs.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-error-logs/class-paymob-error-logs.php
@@ -166,8 +166,8 @@
public static function register_menu() {
add_submenu_page(
'woocommerce',
- __( 'Paymob Error Logs', 'paymob-woocommerce' ),
- __( 'Paymob Error Logs', 'paymob-woocommerce' ),
+ __( 'Paymob Error Logs', 'paymob-for-woocommerce' ),
+ __( 'Paymob Error Logs', 'paymob-for-woocommerce' ),
'manage_woocommerce',
self::MENU_SLUG,
array( __CLASS__, 'render_page' )
@@ -197,7 +197,7 @@
$logs = array_reverse( self::get_filtered_logs( $filters ) );
$sources = self::get_distinct_values( 'source' );
$contexts = self::get_distinct_values( 'context' );
- include PAYMOB_PLUGIN_PATH . 'includes/admin/paymob-error-logs/views/view-paymob-error-logs.php';
+ include __DIR__ . '/views/view-paymob-error-logs.php';
}
public static function ajax_log_error() {
@@ -206,15 +206,15 @@
wp_send_json_error( array( 'message' => 'missing message' ) );
}
- $message = wp_unslash( $_POST['message'] );
- $context = isset( $_POST['context'] ) ? wp_unslash( $_POST['context'] ) : 'frontend';
+ $message = sanitize_text_field( wp_unslash( $_POST['message'] ) );
+ $context = isset( $_POST['context'] ) ? sanitize_text_field( wp_unslash( $_POST['context'] ) ) : 'frontend';
self::add( $message, $context, 'frontend' );
wp_send_json_success();
}
public static function clear_logs() {
if ( ! current_user_can( 'manage_woocommerce' ) ) {
- wp_die( esc_html__( 'Permission denied', 'paymob-woocommerce' ) );
+ wp_die( esc_html__( 'Permission denied', 'paymob-for-woocommerce' ) );
}
check_admin_referer( 'paymob_clear_error_logs' );
@@ -225,7 +225,7 @@
public static function export_logs() {
if ( ! current_user_can( 'manage_woocommerce' ) ) {
- wp_die( esc_html__( 'Permission denied', 'paymob-woocommerce' ) );
+ wp_die( esc_html__( 'Permission denied', 'paymob-for-woocommerce' ) );
}
check_admin_referer( 'paymob_export_error_logs' );
@@ -239,7 +239,7 @@
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
$output = fopen( 'php://output', 'w' );
- fputcsv( $output, array( 'time', 'source', 'context', 'message', 'request_method', 'http_code', 'request_url', 'response_raw' ) );
+ fputcsv( $output, array( 'time', 'source', 'context', 'message', 'request_method', 'http_code', 'request_url', 'response_raw' ), ',', '"', '\' );
foreach ( $logs as $log ) {
$meta = isset( $log['meta'] ) && is_array( $log['meta'] ) ? $log['meta'] : array();
@@ -254,11 +254,14 @@
isset( $meta['http_code'] ) ? $meta['http_code'] : '',
isset( $meta['request_url'] ) ? $meta['request_url'] : '',
isset( $meta['response_raw'] ) ? $meta['response_raw'] : '',
- )
+ ),
+ ',',
+ '"',
+ '\'
);
}
- fclose( $output );
+ fclose( $output ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- php://output stream for CSV export.
exit;
}
}
--- a/paymob-for-woocommerce/includes/admin/paymob-error-logs/views/view-paymob-error-logs.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-error-logs/views/view-paymob-error-logs.php
@@ -1,34 +1,56 @@
<?php
/**
* Paymob Error Logs admin view.
- *
- * @var array<int,array{time:string,message:string,context:string,source:string,meta?:array}> $logs
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
+
+// Defaults when this view is analysed or included without caller-provided vars.
+if ( ! isset( $logs ) || ! is_array( $logs ) ) {
+ $logs = array();
+}
+if ( ! isset( $filters ) || ! is_array( $filters ) ) {
+ $filters = array(
+ 'source' => '',
+ 'context' => '',
+ 'http_code' => '',
+ 'date_from' => '',
+ 'date_to' => '',
+ 'search' => '',
+ );
+}
+if ( ! isset( $sources ) || ! is_array( $sources ) ) {
+ $sources = array();
+}
+if ( ! isset( $contexts ) || ! is_array( $contexts ) ) {
+ $contexts = array();
+}
?>
<div class="wrap paymob-error-logs-page">
<div class="paymob-log-hero">
<div>
- <h1><?php echo esc_html__( 'Paymob Error Logs', 'paymob-woocommerce' ); ?></h1>
- <p><?php echo esc_html__( 'Checkout, gateway, and Paymob API errors captured from live payment flows.', 'paymob-woocommerce' ); ?></p>
+ <h1><?php echo esc_html__( 'Paymob Error Logs', 'paymob-for-woocommerce' ); ?></h1>
+ <p><?php echo esc_html__( 'Checkout, gateway, and Paymob API errors captured from live payment flows.', 'paymob-for-woocommerce' ); ?></p>
</div>
- <span class="paymob-log-total"><?php printf( esc_html__( '%d result(s)', 'paymob-woocommerce' ), count( $logs ) ); ?></span>
+ <span class="paymob-log-total"><?php
+ /* translators: %d: number of filtered log entries */
+ printf( esc_html__( '%d result(s)', 'paymob-for-woocommerce' ), count( $logs ) );
+ ?></span>
</div>
<?php if ( isset( $_GET['cleared'] ) ) : ?>
- <div class="notice notice-success is-dismissible"><p><?php echo esc_html__( 'All Paymob error logs were cleared.', 'paymob-woocommerce' ); ?></p></div>
+ <div class="notice notice-success is-dismissible"><p><?php echo esc_html__( 'All Paymob error logs were cleared.', 'paymob-for-woocommerce' ); ?></p></div>
<?php endif; ?>
<form method="get" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" class="paymob-log-filters">
<input type="hidden" name="page" value="<?php echo esc_attr( Paymob_Error_Logs::MENU_SLUG ); ?>" />
<label class="paymob-log-filter">
- <span><?php echo esc_html__( 'Source', 'paymob-woocommerce' ); ?></span>
+ <span><?php echo esc_html__( 'Source', 'paymob-for-woocommerce' ); ?></span>
<select name="source">
- <option value=""><?php echo esc_html__( 'All sources', 'paymob-woocommerce' ); ?></option>
+ <option value=""><?php echo esc_html__( 'All sources', 'paymob-for-woocommerce' ); ?></option>
<?php foreach ( $sources as $source ) : ?>
<option value="<?php echo esc_attr( $source ); ?>" <?php selected( $filters['source'], $source ); ?>><?php echo esc_html( $source ); ?></option>
<?php endforeach; ?>
@@ -36,9 +58,9 @@
</label>
<label class="paymob-log-filter">
- <span><?php echo esc_html__( 'Context', 'paymob-woocommerce' ); ?></span>
+ <span><?php echo esc_html__( 'Context', 'paymob-for-woocommerce' ); ?></span>
<select name="context">
- <option value=""><?php echo esc_html__( 'All contexts', 'paymob-woocommerce' ); ?></option>
+ <option value=""><?php echo esc_html__( 'All contexts', 'paymob-for-woocommerce' ); ?></option>
<?php foreach ( $contexts as $context ) : ?>
<option value="<?php echo esc_attr( $context ); ?>" <?php selected( $filters['context'], $context ); ?>><?php echo esc_html( $context ); ?></option>
<?php endforeach; ?>
@@ -46,33 +68,33 @@
</label>
<label class="paymob-log-filter paymob-log-filter--small">
- <span><?php echo esc_html__( 'HTTP Code', 'paymob-woocommerce' ); ?></span>
+ <span><?php echo esc_html__( 'HTTP Code', 'paymob-for-woocommerce' ); ?></span>
<input type="text" name="http_code" value="<?php echo esc_attr( $filters['http_code'] ); ?>" placeholder="401" />
</label>
<label class="paymob-log-filter">
- <span><?php echo esc_html__( 'From', 'paymob-woocommerce' ); ?></span>
+ <span><?php echo esc_html__( 'From', 'paymob-for-woocommerce' ); ?></span>
<input type="date" name="date_from" value="<?php echo esc_attr( $filters['date_from'] ); ?>" />
</label>
<label class="paymob-log-filter">
- <span><?php echo esc_html__( 'To', 'paymob-woocommerce' ); ?></span>
+ <span><?php echo esc_html__( 'To', 'paymob-for-woocommerce' ); ?></span>
<input type="date" name="date_to" value="<?php echo esc_attr( $filters['date_to'] ); ?>" />
</label>
<label class="paymob-log-filter paymob-log-filter--search">
- <span><?php echo esc_html__( 'Search', 'paymob-woocommerce' ); ?></span>
- <input type="search" name="search" value="<?php echo esc_attr( $filters['search'] ); ?>" placeholder="<?php echo esc_attr__( 'Message, URL, raw response...', 'paymob-woocommerce' ); ?>" />
+ <span><?php echo esc_html__( 'Search', 'paymob-for-woocommerce' ); ?></span>
+ <input type="search" name="search" value="<?php echo esc_attr( $filters['search'] ); ?>" placeholder="<?php echo esc_attr__( 'Message, URL, raw response...', 'paymob-for-woocommerce' ); ?>" />
</label>
<div class="paymob-log-filter-actions">
- <button type="submit" class="button button-primary"><?php echo esc_html__( 'Apply Filter', 'paymob-woocommerce' ); ?></button>
- <a class="button" href="<?php echo esc_url( admin_url( 'admin.php?page=' . Paymob_Error_Logs::MENU_SLUG ) ); ?>"><?php echo esc_html__( 'Reset', 'paymob-woocommerce' ); ?></a>
+ <button type="submit" class="button button-primary"><?php echo esc_html__( 'Apply Filter', 'paymob-for-woocommerce' ); ?></button>
+ <a class="button" href="<?php echo esc_url( admin_url( 'admin.php?page=' . Paymob_Error_Logs::MENU_SLUG ) ); ?>"><?php echo esc_html__( 'Reset', 'paymob-for-woocommerce' ); ?></a>
</div>
</form>
<div class="paymob-log-toolbar">
- <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=paymob-main' ) ); ?>"><?php echo esc_html__( 'Back to Paymob Settings', 'paymob-woocommerce' ); ?></a>
+ <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=paymob-main' ) ); ?>"><?php echo esc_html__( 'Back to Paymob Settings', 'paymob-for-woocommerce' ); ?></a>
<div class="paymob-log-toolbar__actions">
<form method="get" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
@@ -84,20 +106,20 @@
<input type="hidden" name="date_from" value="<?php echo esc_attr( $filters['date_from'] ); ?>" />
<input type="hidden" name="date_to" value="<?php echo esc_attr( $filters['date_to'] ); ?>" />
<input type="hidden" name="search" value="<?php echo esc_attr( $filters['search'] ); ?>" />
- <button type="submit" class="button button-secondary"><?php echo esc_html__( 'Export CSV', 'paymob-woocommerce' ); ?></button>
+ <button type="submit" class="button button-secondary"><?php echo esc_html__( 'Export CSV', 'paymob-for-woocommerce' ); ?></button>
</form>
- <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" onsubmit="return confirm('<?php echo esc_js( __( 'Are you sure you want to clear all logs?', 'paymob-woocommerce' ) ); ?>');">
+ <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" onsubmit="return confirm('<?php echo esc_js( __( 'Are you sure you want to clear all logs?', 'paymob-for-woocommerce' ) ); ?>');">
<input type="hidden" name="action" value="paymob_clear_error_logs" />
<?php wp_nonce_field( 'paymob_clear_error_logs' ); ?>
- <button type="submit" class="button button-link-delete"><?php echo esc_html__( 'Clear Logs', 'paymob-woocommerce' ); ?></button>
+ <button type="submit" class="button button-link-delete"><?php echo esc_html__( 'Clear Logs', 'paymob-for-woocommerce' ); ?></button>
</form>
</div>
</div>
<div class="paymob-log-grid">
<?php if ( empty( $logs ) ) : ?>
- <div class="paymob-log-empty"><?php echo esc_html__( 'No errors found for the current filters.', 'paymob-woocommerce' ); ?></div>
+ <div class="paymob-log-empty"><?php echo esc_html__( 'No errors found for the current filters.', 'paymob-for-woocommerce' ); ?></div>
<?php else : ?>
<?php foreach ( $logs as $log ) : ?>
<?php
@@ -118,14 +140,14 @@
</div>
<p class="paymob-log-card__message"><?php echo esc_html( $message ); ?></p>
<div class="paymob-log-card__meta">
- <span><?php echo esc_html__( 'Context:', 'paymob-woocommerce' ); ?> <?php echo esc_html( $context ); ?></span>
+ <span><?php echo esc_html__( 'Context:', 'paymob-for-woocommerce' ); ?> <?php echo esc_html( $context ); ?></span>
<?php if ( '' !== $method || '' !== $http_code ) : ?>
<div class="paymob-log-meta-line">
<?php if ( '' !== $method ) : ?>
<code><?php echo esc_html( $method ); ?></code>
<?php endif; ?>
<?php if ( '' !== $http_code ) : ?>
- <strong><?php echo esc_html__( 'HTTP', 'paymob-woocommerce' ); ?></strong>
+ <strong><?php echo esc_html__( 'HTTP', 'paymob-for-woocommerce' ); ?></strong>
<?php echo esc_html( $http_code ); ?>
<?php endif; ?>
</div>
@@ -135,13 +157,13 @@
<?php endif; ?>
<?php if ( '' !== $raw ) : ?>
<details class="paymob-log-details" open>
- <summary><?php echo esc_html__( 'Raw HTTP body (before JSON decode)', 'paymob-woocommerce' ); ?></summary>
+ <summary><?php echo esc_html__( 'Raw HTTP body (before JSON decode)', 'paymob-for-woocommerce' ); ?></summary>
<pre class="paymob-log-response-raw"><?php echo esc_html( $raw ); ?></pre>
</details>
<?php elseif ( '' !== $method || '' !== $http_code || '' !== $url ) : ?>
<details class="paymob-log-details">
- <summary><?php echo esc_html__( 'Raw HTTP body (before JSON decode)', 'paymob-woocommerce' ); ?></summary>
- <pre class="paymob-log-response-raw paymob-log-response-raw--empty"><?php echo esc_html__( 'No response body was returned by Paymob.', 'paymob-woocommerce' ); ?></pre>
+ <summary><?php echo esc_html__( 'Raw HTTP body (before JSON decode)', 'paymob-for-woocommerce' ); ?></summary>
+ <pre class="paymob-log-response-raw paymob-log-response-raw--empty"><?php echo esc_html__( 'No response body was returned by Paymob.', 'paymob-for-woocommerce' ); ?></pre>
</details>
<?php endif; ?>
<?php if ( ! empty( $meta ) ) : ?>
--- a/paymob-for-woocommerce/includes/admin/paymob-list_gateway_table.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-list_gateway_table.php
@@ -54,11 +54,11 @@
// Edit button with conditional disabled attribute for "paymob-pixel".
$row_html .= '<td data-label="Webhook URL" class="webhook_uRL" integration_id="'.$integration_id.'">' . ($webhook_url ? esc_html( $webhook_url ) : $webhook_button) . '</td>'; // Add Webhook URL column
- $row_html .= '<td data-label="Action"><a href="' . esc_url( $edit_url ) . '" class="button button-secondary" >' . __( 'Edit', 'paymob-woocommerce' ) . '</a> ';
+ $row_html .= '<td data-label="Action"><a href="' . esc_url( $edit_url ) . '" class="button button-secondary" >' . __( 'Edit', 'paymob-for-woocommerce' ) . '</a> ';
// Remove button with conditional disabled attribute based on is_manual.
$remove_button_disabled = '0' === $gateway->is_manual ? 'disabled="disabled"' : '';
- $row_html .= '<button type="button" class="button remove-button button-primary" data-gateway-id="' . esc_attr( $gateway_id ) . '" ' . $remove_button_disabled . '>' . __( 'Remove', 'paymob-woocommerce' ) . '</button></td>';
+ $row_html .= '<button type="button" class="button remove-button button-primary" data-gateway-id="' . esc_attr( $gateway_id ) . '" ' . $remove_button_disabled . '>' . __( 'Remove', 'paymob-for-woocommerce' ) . '</button></td>';
$row_html .= '</tr>';
@@ -67,7 +67,7 @@
public static function paymob_not_found_record_table() {
$table_body = '';
- $table_body .= '<tr><td colspan="8">' . __( 'No gateways found.', 'paymob-woocommerce' ) . '</td></tr>';
+ $table_body .= '<tr><td colspan="8">' . __( 'No gateways found.', 'paymob-for-woocommerce' ) . '</td></tr>';
return $table_body;
}
--- a/paymob-for-woocommerce/includes/admin/paymob-main.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-main.php
@@ -5,35 +5,35 @@
return array(
'tabs' => array(
'title' =>'',
- 'description' => include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php',
+ 'description' => include __DIR__ . '/paymob-admin-tabs.php',
'type' => 'title',
),
'buttons' => array(
'title' =>'',
- 'description' => include PAYMOB_PLUGIN_PATH . '/includes/admin/views/htmlsviews/html_reconnect_buttons.php',
+ 'description' => include __DIR__ . '/views/htmlsviews/html_reconnect_buttons.php',
'type' => 'title',
),
'has_items' => array(
- 'title' => __( "Show Product Details on Paymob's Checkout", 'paymob-woocommerce' ),
+ 'title' => __( "Show Product Details on Paymob's Checkout", 'paymob-for-woocommerce' ),
'label' => ' ',
'type' => 'checkbox',
'default' => 'yes',
'description'=>'<div style="width:50%" id="-description"><div style="background-color: #f0f8ff;border: 1px solid #ddd;padding: 15px;margin-top: 20px;border-radius: 8px;font-family: Arial, sans-serif;color: #333">
<div>
<ol>
- <li>' . __( 'Enable the checkbox in this section.', 'paymob-woocommerce' ) . '</li>
- <li>' . __( 'Log in to the Paymob Merchant Dashboard.', 'paymob-woocommerce' ) . '</li>
- <li>' . __( 'Navigate to "Checkout Customization" → "Payment Methods."', 'paymob-woocommerce' ) . '</li>
- <li>' . __( 'Under the "Additional Information" section, enable the "Show Item/Product" option and click "Apply Changes."', 'paymob-woocommerce' ) . '</li>
+ <li>' . __( 'Enable the checkbox in this section.', 'paymob-for-woocommerce' ) . '</li>
+ <li>' . __( 'Log in to the Paymob Merchant Dashboard.', 'paymob-for-woocommerce' ) . '</li>
+ <li>' . __( 'Navigate to "Checkout Customization" → "Payment Methods."', 'paymob-for-woocommerce' ) . '</li>
+ <li>' . __( 'Under the "Additional Information" section, enable the "Show Item/Product" option and click "Apply Changes."', 'paymob-for-woocommerce' ) . '</li>
</ol>
</div></div></div>',
),
'debug' => array(
- 'title' => __( 'Debug Log', 'paymob-woocommerce' ),
+ 'title' => __( 'Debug Log', 'paymob-for-woocommerce' ),
'label' => ' ',
'type' => 'checkbox',
'default' => 'yes',
'description'=>'<div style="width:50%" id="-description"><div style="background-color: #f0f8ff;border: 1px solid #ddd;padding: 15px;margin-top: 20px;border-radius: 8px;font-family: Arial, sans-serif;color: #333">
- ' . __( 'Enabling the Debug Log checkbox in this section will log all actions in Paymob files. These files will be saved in the directory', 'paymob-woocommerce' ) . ' <b>' . ( defined( 'WC_LOG_DIR' ) ? WC_LOG_DIR : WC()->plugin_path() . '/logs/' ) . '</b>.</div></div>',
+ ' . __( 'Enabling the Debug Log checkbox in this section will log all actions in Paymob files. These files will be saved in the directory', 'paymob-for-woocommerce' ) . ' <b>' . Paymob::log_dir() . '</b>.</div></div>',
),
);
--- a/paymob-for-woocommerce/includes/admin/paymob-single-gateway.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-single-gateway.php
@@ -1,10 +1,17 @@
<?php
+/**
+ * Single gateway settings fields.
+ *
+ * Included from Paymob_Payment::init_form_fields().
+ */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$single_integration_id_properties = PaymobAutoGenerate::disable_single_integration_id_field();
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
+$tabs = include __DIR__ . '/paymob-admin-tabs.php';
+$title_default = '';
+$description_default = '';
$settings = array(
@@ -20,26 +27,26 @@
'custom_attributes' => $single_integration_id_properties['custom_attributes'], // Set custom attributes dynamically
),
'title' => array(
- 'title' => __( 'Payment Method - Title', 'paymob-woocommerce' ),
+ 'title' => __( 'Payment Method - Title', 'paymob-for-woocommerce' ),
'type' => 'text',
- 'description' => __( 'This controls the title which the user sees during checkout.', 'paymob-woocommerce' ),
- 'default' => $this->title,
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'paymob-for-woocommerce' ),
+ 'default' => $title_default,
'sanitize_callback' => 'sanitize_text_field',
'custom_attributes' => array( 'required' => 'required' ),
),
'description' => array(
- 'title' => __( 'Payment Method - Description', 'paymob-woocommerce' ),
+ 'title' => __( 'Payment Method - Description', 'paymob-for-woocommerce' ),
'type' => 'textarea',
- 'default' => $this->description,
- 'description' => __( 'This controls the description which the user sees during checkout.', 'paymob-woocommerce' ),
+ 'default' => $description_default,
+ 'description' => __( 'This controls the description which the user sees during checkout.', 'paymob-for-woocommerce' ),
'sanitize_callback' => 'sanitize_text_field',
'custom_attributes' => array( 'required' => 'required' ),
),
'logo' => array(
- 'title' => __( 'Payment Method - Logo URL', 'paymob-woocommerce' ),
+ 'title' => __( 'Payment Method - Logo URL', 'paymob-for-woocommerce' ),
'default' => plugins_url( PAYMOB_PLUGIN_NAME ) . '/assets/img/paymob.png',
'type' => 'text',
- 'description' => __( 'Add a Logo URL for checkout icon.', 'paymob-woocommerce' ),
+ 'description' => __( 'Add a Logo URL for checkout icon.', 'paymob-for-woocommerce' ),
'sanitize_callback' => 'sanitize_url',
'custom_attributes' => array( 'required' => 'required' ),
),
--- a/paymob-for-woocommerce/includes/admin/paymob-unified.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-unified.php
@@ -1,9 +1,16 @@
<?php
+/**
+ * Unified gateway settings fields.
+ *
+ * Included from gateway init_form_fields().
+ */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
+$tabs = include __DIR__ . '/paymob-admin-tabs.php';
+// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- section is used only for default logo path.
+$gateway_id = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : 'paymob';
return array(
'tabs'=> array(
@@ -12,7 +19,7 @@
'description' => $tabs,
),
'integration_id' => array(
- 'title' => __( 'Paymob Integration ID(s)', 'paymob-woocommerce' ),
+ 'title' => __( 'Paymob Integration ID(s)', 'paymob-for-woocommerce' ),
'type' => 'multiselect',
'options' => PaymobAutoGenerate::get_integration_ids(),
'custom_attributes' => array(
@@ -21,26 +28,26 @@
),
),
'title' => array(
- 'title' => __( 'Payment Method - Title', 'paymob-woocommerce' ),
+ 'title' => __( 'Payment Method - Title', 'paymob-for-woocommerce' ),
'type' => 'text',
- 'description' => __( 'This controls the title which the user sees during checkout.', 'paymob-woocommerce' ),
- 'default' => __( 'Pay with Paymob', 'paymob-woocommerce' ),
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'paymob-for-woocommerce' ),
+ 'default' => __( 'Pay with Paymob', 'paymob-for-woocommerce' ),
'sanitize_callback' => 'sanitize_text_field',
'custom_attributes' => array( 'required' => 'required' ),
),
'description' => array(
- 'title' => __( 'Payment Method - Description', 'paymob-woocommerce' ),
+ 'title' => __( 'Payment Method - Description', 'paymob-for-woocommerce' ),
'type' => 'textarea',
- 'default' => __( 'Pay with Paymob', 'paymob-woocommerce' ),
- 'description' => __( 'This controls the description which the user sees during checkout.', 'paymob-woocommerce' ),
+ 'default' => __( 'Pay with Paymob', 'paymob-for-woocommerce' ),
+ 'description' => __( 'This controls the description which the user sees during checkout.', 'paymob-for-woocommerce' ),
'sanitize_callback' => 'sanitize_text_field',
'custom_attributes' => array( 'required' => 'required' ),
),
'logo' => array(
- 'title' => __( 'Payment Method - Logo URL', 'paymob-woocommerce' ),
- 'default' => plugins_url( PAYMOB_PLUGIN_NAME ) . '/assets/img/' . $this->id . '.png',
+ 'title' => __( 'Payment Method - Logo URL', 'paymob-for-woocommerce' ),
+ 'default' => plugins_url( PAYMOB_PLUGIN_NAME ) . '/assets/img/' . $gateway_id . '.png',
'type' => 'text',
- 'description' => __( 'Add a Logo URL for checkout icon.', 'paymob-woocommerce' ),
+ 'description' => __( 'Add a Logo URL for checkout icon.', 'paymob-for-woocommerce' ),
'sanitize_callback' => 'sanitize_url',
'custom_attributes' => array( 'required' => 'required' ),
),
--- a/paymob-for-woocommerce/includes/admin/paymob-valu_widget_setting.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-valu_widget_setting.php
@@ -9,7 +9,7 @@
? '<strong style="color: red;">Please enable a ValU Integration ID from the Payment Integrations section to use the ValU Widget.</strong>'
: 'Choose the Integration ID for the ValU Widget.';
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
+$tabs = include __DIR__ . '/paymob-admin-tabs.php';
$settings = array(
'tab'=>array(
@@ -18,20 +18,20 @@
'desc' => $tabs,
),
'section_title' => array(
- 'title' => __( 'ValU Widget Settings', 'paymob-woocommerce' ),
+ 'title' => __( 'ValU Widget Settings', 'paymob-for-woocommerce' ),
'type' => 'title',
'id' => 'valu_widget_section_title',
),
'enable_widget' => array(
- 'title' => __( 'Enable ValU Widget', 'paymob-woocommerce' ),
+ 'title' => __( 'Enable ValU Widget', 'paymob-for-woocommerce' ),
'type' => 'checkbox',
'id' => 'enable', // ✅ Added ID
'default' => 'no',
'label' => ' ',
- 'description' => __( 'Enable or disable the ValU widget.', 'paymob-woocommerce' ),
+ 'description' => __( 'Enable or disable the ValU widget.', 'paymob-for-woocommerce' ),
),
'integration_id' => array(
- 'title' => __( 'Select Integration ID for ValU Widget', 'paymob-woocommerce' ),
+ 'title' => __( 'Select Integration ID for ValU Widget', 'paymob-for-woocommerce' ),
'type' => 'select',
'id' => 'integration_id', // ✅ Added ID
'options' => $valu_integration_ids,
@@ -47,12 +47,12 @@
),
'dark_mode' => array(
- 'title' => __( 'Enable Dark Mode', 'paymob-woocommerce' ),
+ 'title' => __( 'Enable Dark Mode', 'paymob-for-woocommerce' ),
'type' => 'checkbox',
'id' => 'dark_mode', // ✅ Added ID
'default' => 'no',
'label' => ' ',
- 'description' => __( 'This controls the style mode for ValuWidget.', 'paymob-woocommerce' ),
+ 'description' => __( 'This controls the style mode for ValuWidget.', 'paymob-for-woocommerce' ),
),
'section_end' => array(
'type' => 'sectionend',
--- a/paymob-for-woocommerce/includes/admin/paymob-widget-setting.php
+++ b/paymob-for-woocommerce/includes/admin/paymob-widget-setting.php
@@ -11,7 +11,7 @@
exit;
}
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
+$tabs = include __DIR__ . '/paymob-admin-tabs.php';
return array(
array(
--- a/paymob-for-woocommerce/includes/admin/paymob_checkout_sections.php
+++ b/paymob-for-woocommerce/includes/admin/paymob_checkout_sections.php
@@ -1,9 +1,13 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
$sections = array();
-$sections['paymob-main'] = __( 'Main configuration', 'paymob-woocommerce' );
+$sections['paymob-main'] = __( 'Main configuration', 'paymob-for-woocommerce' );
if ( !empty( $pub_key ) && !empty( $sec_key ) && !empty( $api_key ) ) {
- $sections['paymob_list_gateways'] = __( 'Payment Integrations', 'paymob-woocommerce' );
- $sections['paymob_pixel'] = __( 'Card Embedded Settings', 'paymob-woocommerce' );
- $sections['paymob_add_gateway'] = __( 'Add Payment Integration', 'paymob-woocommerce' );
+ $sections['paymob_list_gateways'] = __( 'Payment Integrations', 'paymob-for-woocommerce' );
+ $sections['paymob_pixel'] = __( 'Card Embedded Settings', 'paymob-for-woocommerce' );
+ $sections['paymob_add_gateway'] = __( 'Add Payment Integration', 'paymob-for-woocommerce' );
}
-return $sections;
+return $sections;
--- a/paymob-for-woocommerce/includes/admin/paymob_subscription.php
+++ b/paymob-for-woocommerce/includes/admin/paymob_subscription.php
@@ -4,7 +4,7 @@
}
// Include admin tabs (if needed)
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
+$tabs = include __DIR__ . '/paymob-admin-tabs.php';
$moto_options = PaymobAutoGenerate::get_moto_integration_ids();
$threeds_options = PaymobAutoGenerate::get_ds3_integration_ids();
@@ -19,17 +19,17 @@
array(
'type' => 'title',
'class' => 'payment-feature-description',
- 'name' => __( 'About Feature', 'paymob-woocommerce' ),
+ 'name' => __( 'About Feature', 'paymob-for-woocommerce' ),
'desc' => '<div style="background-color: #f0f8ff; border: 1px solid #ddd; padding: 15px; margin-top: 20px; border-radius: 8px; font-family: Arial, sans-serif; color: #333; width:70%; margin-left:1%">
'.__( '<span style="font-weight: bold; color: #28a745;">Enable Recurring Payments:</span><br/>
Use Paymob’s Subscription Module to automatically bill customers for your products or services.<br/><br/>
Supports WooCommerce product types: <span style="font-weight: bold;">Simple Subscription</span> and <span style="font-weight: bold;">Variable Subscription</span>.<br/><br/>
- For support, reach out to your account manager or email <a href="mailto:support@paymob.com" style="color: #007bff; font-weight: bold;">support@paymob.com</a>.' ).'
+ For support, reach out to your account manager or email <a href="mailto:support@paymob.com" style="color: #007bff; font-weight: bold;">support@paymob.com</a>.', 'paymob-for-woocommerce' ).'
</div>',
),
array(
- 'name' => __( 'Enable Subscription', 'paymob-woocommerce' ),
+ 'name' => __( 'Enable Subscription', 'paymob-for-woocommerce' ),
'type' => 'checkbox',
'id' => 'woocommerce_paymob-subscription_settings[enabled]',
'desc_tip' => true,
@@ -37,7 +37,7 @@
),
array(
- 'name' => __( 'Subscription Title', 'paymob-woocommerce' ),
+ 'name' => __( 'Subscription Title', 'paymob-for-woocommerce' ),
'type' => 'text',
'id' => 'woocommerce_paymob-subscription_settings[title]',
'desc_tip' => true,
@@ -45,15 +45,15 @@
),
array(
- 'name' => __( 'Subscription Description', 'paymob-woocommerce' ),
+ 'name' => __( 'Subscription Description', 'paymob-for-woocommerce' ),
'type' => 'textarea',
'id' => 'woocommerce_paymob-subscription_settings[description]',
'desc_tip' => true,
- 'default' => __( 'Recurring Payment via Paymob.', 'paymob-woocommerce' ),
+ 'default' => __( 'Recurring Payment via Paymob.', 'paymob-for-woocommerce' ),
),
array(
- 'name' => __( 'MOTO Integration ID', 'paymob-woocommerce' ),
+ 'name' => __( 'MOTO Integration ID', 'paymob-for-woocommerce' ),
'type' => 'select',
'id' => 'woocommerce_paymob-subscription_settings[moto_integration_id]',
'desc_tip' => true,
@@ -63,7 +63,7 @@
),
array(
- 'name' => __( '3DS Integration ID', 'paymob-woocommerce' ),
+ 'name' => __( '3DS Integration ID', 'paymob-for-woocommerce' ),
'type' => 'select',
'id' => 'woocommerce_paymob-subscription_settings[ds3_integration_ids]',
'desc_tip' => true,
@@ -73,12 +73,12 @@
),
array(
- 'name' => __( 'Allow Customer Cancel', 'paymob-woocommerce' ),
+ 'name' => __( 'Allow Customer Cancel', 'paymob-for-woocommerce' ),
'type' => 'checkbox',
'id' => 'woocommerce_paymob-subscription_settings[allow_cancel]',
- 'label' => __( 'Show the "Cancel Subscription" button to customers', 'paymob-woocommerce' ),
+ 'label' => __( 'Show the "Cancel Subscription" button to customers', 'paymob-for-woocommerce' ),
'default' => 'no',
- 'desc' => __( 'If enabled, customers can cancel their subscriptions from My Account > Subscriptions.', 'paymob-woocommerce' ),
+ 'desc' => __( 'If enabled, customers can cancel their subscriptions from My Account > Subscriptions.', 'paymob-for-woocommerce' ),
),
array(
--- a/paymob-for-woocommerce/includes/admin/scripts/paymob_admin_scripts.php
+++ b/paymob-for-woocommerce/includes/admin/scripts/paymob_admin_scripts.php
@@ -14,13 +14,13 @@
'toggle_nonce' => wp_create_nonce( 'toggle_gateway_nonce' ),
'save_gateway_order_nonce' => wp_create_nonce( 'save_gateway_order' ),
'reset_paymob_gateways_nonce' => wp_create_nonce( 'reset_paymob_gateways' ),
- 'rg' =>__('Remove Gateway', 'paymob-woocommerce'),
- 'ays' => __('Are you sure you want to remove this gateway?', 'paymob-woocommerce'),
- 'ay' => __('Are you sure you want to ', 'paymob-woocommerce'),
- 'tg' => __(' this gateway?', 'paymob-woocommerce'),
- 'gat' => __(' Gateway', 'paymob-woocommerce'),
- 'rp' => __('Reset Payment Methods', 'paymob-woocommerce'),
- 'arp' => __('Are you sure you want to reset the payment methods?', 'paymob-woocommerce'),
+ 'rg' =>__('Remove Gateway', 'paymob-for-woocommerce'),
+ 'ays' => __('Are you sure you want to remove this gateway?', 'paymob-for-woocommerce'),
+ 'ay' => __('Are you sure you want to ', 'paymob-for-woocommerce'),
+ 'tg' => __(' this gateway?', 'paymob-for-woocommerce'),
+ 'gat' => __(' Gateway', 'paymob-for-woocommerce'),
+ 'rp' => __('Reset Payment Methods', 'paymob-for-woocommerce'),
+ 'arp' => __('Are you sure you want to reset the payment methods?', 'paymob-for-woocommerce'),
)
);
}
--- a/paymob-for-woocommerce/includes/admin/scripts/pixel_checkout.php
+++ b/paymob-for-woocommerce/includes/admin/scripts/pixel_checkout.php
@@ -1,3 +1,8 @@
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+?>
<div id="paymob-elements"></div>
<script>
window.hasEmptyFields = false;
--- a/paymob-for-woocommerce/includes/admin/styles/paymob_admin_styles.php
+++ b/paymob-for-woocommerce/includes/admin/styles/paymob_admin_styles.php
@@ -99,8 +99,6 @@
}
public static function paymob_pixel_styles() {
- wp_enqueue_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');
-
wp_enqueue_style( 'paymob-pixel-css', plugins_url( PAYMOB_PLUGIN_NAME ) . '/assets/css/pixel.css', array(), PAYMOB_VERSION );
}
}
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_change_mode_model.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_change_mode_model.php
@@ -1,11 +1,16 @@
-<div id="changemodeconfirmationModal" class="changemode-modal" style="display:none;">
- <div class="changemode-modal-content">
- <p> Are You Sure To Switch Mode? </p>
- <!-- Modal Buttons -->
- <div class="modal-buttons">
- <button id="changemodemodal_confirm_button">Confirm</button>
- <button id="changemodemodal_close_button">Cancel</button>
- </div>
-
- </div>
-</div>
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+?>
+<div id="changemodeconfirmationModal" class="changemode-modal" style="display:none;">
+ <div class="changemode-modal-content">
+ <p> Are You Sure To Switch Mode? </p>
+ <!-- Modal Buttons -->
+ <div class="modal-buttons">
+ <button id="changemodemodal_confirm_button">Confirm</button>
+ <button id="changemodemodal_close_button">Cancel</button>
+ </div>
+
+ </div>
+</div>
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_connect_paymob.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_connect_paymob.php
@@ -1,4 +1,8 @@
-<?php
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
return '<div class="paymob-connect-div">
<img style="width:10%; float: left;" src="' . plugins_url( PAYMOB_PLUGIN_NAME ) . '/assets/img/paymob.png" alt="Image" class="paymob-img">
<div >
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_custom_confirmation_modal.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_custom_confirmation_modal.php
@@ -1,25 +1,36 @@
-<div id="confirmationModal">
- <h2><?php echo esc_html(__( 'Disable Paymob Gateway','paymob-woocommerce')); ?></h2>
- <p><?php echo esc_html(__( 'If you disable this gateway, all Paymob gateways will be disabled. Do you want to continue?','paymob-woocommerce')); ?></p>
- <ul>
- <?php
- foreach ( $gateways as $gateway ) {
- $options = get_option( 'woocommerce_' . $gateway->gateway_id . '_settings', array() );
- $enabled = isset( $options['enabled'] ) && 'yes' === $options['enabled'];
- if ( $enabled ) {
- $logo = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : '';
- $title = isset( $options['title'] ) ? esc_html( $options['title'] ) : 'Unknown Gateway';
- ?>
- <li>
- <img src="<?php echo esc_url( $logo ); ?>" width="36" height="23" alt="<?php echo esc_attr( $title ); ?>">
- <?php echo esc_html( $title ); ?>
- </li>
- <?php
- }
- }
- ?>
- </ul>
- <button id="confirmDisable"><?php echo esc_html(__( 'Disable','paymob-woocommerce')); ?></button>
- <button id="confirmCancel"><?php echo esc_html(__( 'Cancel','paymob-woocommerce')); ?></button>
-</div>
+<?php
+/**
+ * Confirmation modal for disabling Paymob gateways.
+ */
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+if ( ! isset( $gateways ) || ! is_array( $gateways ) ) {
+ $gateways = array();
+}
+?>
+<div id="confirmationModal">
+ <h2><?php echo esc_html(__( 'Disable Paymob Gateway','paymob-for-woocommerce')); ?></h2>
+ <p><?php echo esc_html(__( 'If you disable this gateway, all Paymob gateways will be disabled. Do you want to continue?','paymob-for-woocommerce')); ?></p>
+ <ul>
+ <?php
+ foreach ( $gateways as $gateway ) {
+ $options = get_option( 'woocommerce_' . $gateway->gateway_id . '_settings', array() );
+ $enabled = isset( $options['enabled'] ) && 'yes' === $options['enabled'];
+ if ( $enabled ) {
+ $logo = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : '';
+ $title = isset( $options['title'] ) ? esc_html( $options['title'] ) : 'Unknown Gateway';
+ ?>
+ <li>
+ <img src="<?php echo esc_url( $logo ); ?>" width="36" height="23" alt="<?php echo esc_attr( $title ); ?>">
+ <?php echo esc_html( $title ); ?>
+ </li>
+ <?php
+ }
+ }
+ ?>
+ </ul>
+ <button id="confirmDisable"><?php echo esc_html(__( 'Disable','paymob-for-woocommerce')); ?></button>
+ <button id="confirmCancel"><?php echo esc_html(__( 'Cancel','paymob-for-woocommerce')); ?></button>
+</div>
<div id="overlay"></div>
No newline at end of file
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_disconnect_paymob.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_disconnect_paymob.php
@@ -1,11 +1,16 @@
-<div id="disconnectconfirmationModal" class="disconnect-modal" style="display:none;">
- <div class="disconnect-modal-content">
- <p> Are you sure you want to disconnect from Paymob? </p>
- <!-- Modal Buttons -->
- <div class="modal-buttons">
- <button id="disconnectmodal_confirm_button">Confirm</button>
- <button id="disconnectmodal_close_button">Cancel</button>
- </div>
-
- </div>
-</div>
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+?>
+<div id="disconnectconfirmationModal" class="disconnect-modal" style="display:none;">
+ <div class="disconnect-modal-content">
+ <p> Are you sure you want to disconnect from Paymob? </p>
+ <!-- Modal Buttons -->
+ <div class="modal-buttons">
+ <button id="disconnectmodal_confirm_button">Confirm</button>
+ <button id="disconnectmodal_close_button">Cancel</button>
+ </div>
+
+ </div>
+</div>
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_gateway_list.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_gateway_list.php
@@ -1,24 +1,29 @@
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+?>
<table id="paymob_custom_gateways" class="wp-list-table widefat fixed striped">
<thead>
<tr>
- <th class="column-reorder"><?php esc_html_e('Re-Order', 'paymob-woocommerce'); ?></th>
- <th><?php esc_html_e('Enable / Disable', 'paymob-woocommerce'); ?></th>
- <th><?php esc_html_e('Payment Method', 'paymob-woocommerce'); ?></th>
- <th><?php esc_html_e('Title', 'paymob-woocommerce'); ?></th>
- <th><?php esc_html_e('Description', 'paymob-woocommerce'); ?></th>
- <th class="column-integration-id"><?php esc_html_e('Integration ID', 'paymob-woocommerce'); ?></th>
- <th class="column-logo"><?php esc_html_e('Logo', 'paymob-woocommerce'); ?></th>
- <th><?php esc_html_e('Webhook URL', 'paymob-woocommerce'); ?></th>
- <th><?php esc_html_e('Action', 'paymob-woocommerce'); ?></th>
+ <th class="column-reorder"><?php esc_html_e('Re-Order', 'paymob-for-woocommerce'); ?></th>
+ <th><?php esc_html_e('Enable / Disable', 'paymob-for-woocommerce'); ?></th>
+ <th><?php esc_html_e('Payment Method', 'paymob-for-woocommerce'); ?></th>
+ <th><?php esc_html_e('Title', 'paymob-for-woocommerce'); ?></th>
+ <th><?php esc_html_e('Description', 'paymob-for-woocommerce'); ?></th>
+ <th class="column-integration-id"><?php esc_html_e('Integration ID', 'paymob-for-woocommerce'); ?></th>
+ <th class="column-logo"><?php esc_html_e('Logo', 'paymob-for-woocommerce'); ?></th>
+ <th><?php esc_html_e('Webhook URL', 'paymob-for-woocommerce'); ?></th>
+ <th><?php esc_html_e('Action', 'paymob-for-woocommerce'); ?></th>
</tr>
</thead>
<tbody>
<tr>
- <td colspan="8"><?php esc_html_e('Please wait while loading Payment methods ...', 'paymob-woocommerce'); ?></td>
+ <td colspan="8"><?php esc_html_e('Please wait while loading Payment methods ...', 'paymob-for-woocommerce'); ?></td>
</tr>
</tbody>
</table>
<p><a href="#" style="cursor:pointer;"
- id="reset-paymob-gateways"><?php esc_html_e( 'Click here', 'paymob-woocommerce' ); ?></a>
- <?php esc_html_e( 'to re-authenticate your Paymob configuration to get the new updated payment methods.', 'paymob-woocommerce' ); ?>
-</p>
No newline at end of file
+ id="reset-paymob-gateways"><?php esc_html_e( 'Click here', 'paymob-for-woocommerce' ); ?></a>
+ <?php esc_html_e( 'to re-authenticate your Paymob configuration to get the new updated payment methods.', 'paymob-for-woocommerce' ); ?>
+</p>
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_loader_paymob.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_loader_paymob.php
@@ -1,29 +1,38 @@
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+?>
<div id="confirmation-modal" style="display:none;">
<div id="confirmation-modal-content">
<h2 id="confirmation-modal-title"></h2>
<p id="confirmation-modal-message"></p>
<div class="modal-buttons">
- <button type="button" id="confirmation-modal-confirm"><?php echo esc_html( __( 'Confirm', 'paymob-woocommerce' ) ); ?></button>
- <button type="button" id="confirmation-modal-cancel"><?php echo esc_html( __( 'Cancel', 'paymob-woocommerce' ) ); ?></button>
+ <button type="button" id="confirmation-modal-confirm"><?php echo esc_html( __( 'Confirm', 'paymob-for-woocommerce' ) ); ?></button>
+ <button type="button" id="confirmation-modal-cancel"><?php echo esc_html( __( 'Cancel', 'paymob-for-woocommerce' ) ); ?></button>
</div>
</div>
</div>
<div class="loader_paymob"></div>
<?php
-$paymobOptions = get_option('woocommerce_paymob-main_settings');
-$mode = isset($paymobOptions['mode']) ? $paymobOptions['mode'] : 'test';
-$sliderMode = ($mode=='test')?'':'silderMode';
+$paymobOptions = get_option( 'woocommerce_paymob-main_settings' );
+$mode = isset( $paymobOptions['mode'] ) ? $paymobOptions['mode'] : 'test';
+$sliderMode = ( 'test' === $mode ) ? '' : 'silderMode';
// Generate HTML row.
-$tabs = include PAYMOB_PLUGIN_PATH . '/includes/admin/paymob-admin-tabs.php';
-$modeSwitcher = '<div id="changemodemodal_confirm_button" class="mode-toggle-container switch-mode" style="max-width: 20%;">
+$tabs = include __DIR__ . '/../../paymob-admin-tabs.php';
+$modeSwitcher = sprintf(
+ '<div id="changemodemodal_confirm_button" class="mode-toggle-container switch-mode" style="max-width: 20%%;">
<label for="mode-toggle"></label>
<label class="switch">
- <span class="slider round '.$sliderMode.'"></span>
+ <span class="slider round %1$s"></span>
</label>
- <span id="mode-status">'. ucfirst($mode) .'</span>
-</div>';
+ <span id="mode-status">%2$s</span>
+</div>',
+ esc_attr( $sliderMode ),
+ esc_html( ucfirst( $mode ) )
+);
-echo $tabs. '<br/><br/>'.$modeSwitcher;
+echo wp_kses_post( $tabs . '<br/><br/>' . $modeSwitcher );
?>
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_manual_setup_modal.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_manual_setup_modal.php
@@ -1,13 +1,15 @@
-<?php
-
-$paymobOptions = get_option('woocommerce_paymob-main_settings');
-$mode = isset($paymobOptions['mode']) ? $paymobOptions['mode'] : 'test';
-$checked = ($mode=='test')?'':'checked';
-$apiKey = isset($paymobOptions['api_key']) ? $paymobOptions['api_key'] : '';
-$live_pub_key = isset($paymobOptions['live_pub_key']) ? $paymobOptions['live_pub_key'] : '';
-$live_sec_key = isset($paymobOptions['live_sec_key']) ? $paymobOptions['live_sec_key'] : '';
-$test_sec_key = isset($paymobOptions['test_sec_key']) ? $paymobOptions['test_sec_key'] : '';
-$test_pub_key = isset($paymobOptions['test_pub_key']) ? $paymobOptions['test_pub_key'] : '';
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+$paymobOptions = get_option( 'woocommerce_paymob-main_settings' );
+$mode = isset( $paymobOptions['mode'] ) ? $paymobOptions['mode'] : 'test';
+$apiKey = isset( $paymobOptions['api_key'] ) ? $paymobOptions['api_key'] : '';
+$live_pub_key = isset( $paymobOptions['live_pub_key'] ) ? $paymobOptions['live_pub_key'] : '';
+$live_sec_key = isset( $paymobOptions['live_sec_key'] ) ? $paymobOptions['live_sec_key'] : '';
+$test_sec_key = isset( $paymobOptions['test_sec_key'] ) ? $paymobOptions['test_sec_key'] : '';
+$test_pub_key = isset( $paymobOptions['test_pub_key'] ) ? $paymobOptions['test_pub_key'] : '';
?>
<div id="manualsetupconfirmationModal" class="manualsetup-modal" style="display:none;">
@@ -15,7 +17,7 @@
<script>
- var mode = '<?=$mode;?>';
+ var mode = <?php echo wp_json_encode( $mode ); ?>;
</script>
<div class="manualsetup-modal-content">
@@ -26,22 +28,22 @@
<div class="mode-toggle-container">
<label for="mode-toggle">Mode</label>
<label class="switch">
- <input type="checkbox" id="mode-toggle" <?= $checked;?>>
+ <input type="checkbox" id="mode-toggle" <?php checked( $mode, 'live' ); ?>>
<span class="slider round"></span>
</label>
<span id="mode-status2">Test</span> <!-- Default mode status -->
</div>
- <input type="text" id="api_key" placeholder="Paymob API Key" required value="<?= $apiKey; ?>">
+ <input type="text" id="api_key" placeholder="Paymob API Key" required value="<?php echo esc_attr( $apiKey ); ?>">
<div id="liveKeys" class="tabcontent">
- <input type="text" id="live_secret_key" placeholder="Paymob Live Secret Key" value="<?= $live_sec_key; ?>">
- <input type="text" id="live_public_key" placeholder="Paymob Live Public Key" value="<?= $live_pub_key; ?>">
+ <input type="text" id="live_secret_key" placeholder="Paymob Live Secret Key" value="<?php echo esc_attr( $live_sec_key ); ?>">
+ <input type="text" id="live_public_key" placeholder="Paymob Live Public Key" value="<?php echo esc_attr( $live_pub_key ); ?>">
</div>
<div id="testKeys" class="tabcontent">
- <input type="text" id="test_secret_key" placeholder="Paymob Test Secret Key" value="<?= $test_sec_key; ?>">
- <input type="text" id="test_public_key" placeholder="Paymob Test Public Key" value="<?= $test_pub_key; ?>">
+ <input type="text" id="test_secret_key" placeholder="Paymob Test Secret Key" value="<?php echo esc_attr( $test_sec_key ); ?>">
+ <input type="text" id="test_public_key" placeholder="Paymob Test Public Key" value="<?php echo esc_attr( $test_pub_key ); ?>">
</div>
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_reconnect_buttons.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_reconnect_buttons.php
@@ -1,4 +1,8 @@
-<?php
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
$paymobOptions = get_option('woocommerce_paymob-main_settings');
$mode = isset($paymobOptions['mode']) ? $paymobOptions['mode'] : 'test';
$sliderMode = ($mode=='test')?'':'silderMode';
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_save_card_confirmation_model.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_save_card_confirmation_model.php
@@ -1,8 +1,13 @@
+<?php
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+?>
<div id="paymob-delete-modal" class="paymob-modal">
<div class="paymob-modal-content">
<span class="paymob-close">×</span>
- <p><?php echo esc_html( __( 'Are you sure you want to delete this card? This action cannot be undone.', 'paymob-woocommerce' ) ); ?></p>
- <button id="paymob-confirm-delete" class="button"><?php echo esc_html( __( 'Delete', 'paymob-woocommerce' ) ); ?></button>
- <button id="paymob-cancel-delete" class="button"><?php echo esc_html( __( 'Cancel', 'paymob-woocommerce' ) ); ?></button>
+ <p><?php echo esc_html( __( 'Are you sure you want to delete this card? This action cannot be undone.', 'paymob-for-woocommerce' ) ); ?></p>
+ <button id="paymob-confirm-delete" class="button"><?php echo esc_html( __( 'Delete', 'paymob-for-woocommerce' ) ); ?></button>
+ <button id="paymob-cancel-delete" class="button"><?php echo esc_html( __( 'Cancel', 'paymob-for-woocommerce' ) ); ?></button>
</div>
- </div>
No newline at end of file
+ </div>
--- a/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_webhook_url_modal.php
+++ b/paymob-for-woocommerce/includes/admin/views/htmlsviews/html_webhook_url_modal.php
@@ -1,27 +1,32 @@
-<div id="webhookconfirmationModal" class="webhook-modal" style="display:none;">
- <div class="webhook-modal-content">
- <h2>Webhook Callbacks</h2>
- <p class="modal-description">Review and update the callback URLs for transaction processing.</p>
- <!-- Callback URLs -->
- <div class="modal-callbacks">
- <div class="modal-callback">
- <label for="processed_callback">Current Processed Callback:</label>
- <p id="processed_callback_display">Loading...</p>
- </div>
- <div class="modal-callback">
- <label for="response_callback">Current Response Callback:</label>
- <p id="response_callback_display">Loading...</p>
- </div>
- </div>
- <!-- Input Fields -->
- <label for="new_callback" id="integration_label">Click "Confirm" if you wish to update the Webhook URL to the one provided below for Integration ID :</label>
-