Changeset 3360992
- Timestamp:
- 09/13/2025 11:52:56 AM (7 months ago)
- Location:
- payping-gravityforms/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (1 diff)
-
chart.php (modified) (33 diffs)
-
database.php (modified) (1 diff)
-
payping-gravityforms.php (modified) (1 diff)
-
payping.php (modified) (38 diffs)
Legend:
- Unmodified
- Added
- Removed
-
payping-gravityforms/trunk/README.txt
r3357079 r3360992 27 27 This plugin follows strict privacy guidelines. When using the api.payping.ir service, user data is securely transmitted and stored following industry best practices. 28 28 29 == External services == 30 31 This plugin connects to the PayPing payment API in order to create and verify Gravity Forms payments. 32 It is required to redirect payers to the gateway and to verify transactions on return. 33 34 **What is sent and when** 35 - On form submission (before redirect): amount, callback URL, and a description/reference for the order are sent to PayPing's `/v3/pay` endpoint to create a payment. 36 - On return from the gateway: the transaction reference received from PayPing is sent to `/v3/pay/verify` to confirm the payment result. 37 - Your PayPing API key (Bearer token) is sent in the `Authorization` header for both requests. 38 - No card information is handled by this plugin. Cardholder data is entered on PayPing's pages. 39 40 **Service provider** 41 PayPing — https://payping.ir/ 42 Terms of Service: https://payping.io/terms/ 43 Privacy Policy: https://payping.io/terms/ 44 45 **API documentation** 46 https://docs.payping.io/ 47 29 48 30 49 == Changelog == -
payping-gravityforms/trunk/chart.php
r3357079 r3360992 1 1 <?php 2 2 3 class GFPersian_Chart_payping{3 class Payping_GravityForms_Chart { 4 4 5 5 … … 255 255 $sales_label = __( "تعداد کل پرداخت های پیپینگ این فرم", "payping-gravityforms" ); 256 256 257 $transaction_totals = GFPersian_DB_payping::get_transaction_totals( $form_id );257 $transaction_totals = Payping_GravityForms_database::get_transaction_totals( $form_id ); 258 258 $total_sales = empty( $transaction_totals["active"]["transactions"] ) ? 0 : $transaction_totals["active"]["transactions"]; 259 259 $total_revenue = empty( $transaction_totals["active"]["revenue"] ) ? 0 : $transaction_totals["active"]["revenue"]; … … 312 312 $sales_label = esc_html__( "تعداد کل پرداخت های همه روشهای این فرم", "payping-gravityforms" ); 313 313 314 $transaction_totals = GFPersian_DB_payping::get_transaction_totals_gateways( $form_id );314 $transaction_totals = Payping_GravityForms_database::get_transaction_totals_gateways( $form_id ); 315 315 $total_sales = empty( $transaction_totals["active"]["transactions"] ) ? 0 : $transaction_totals["active"]["transactions"]; 316 316 $total_revenue = empty( $transaction_totals["active"]["revenue"] ) ? 0 : $transaction_totals["active"]["revenue"]; … … 373 373 $sales_label = esc_html__( "تعداد کل پرداخت های درگاه پیپینگ", "payping-gravityforms" ); 374 374 375 $transaction_totals = GFPersian_DB_payping::get_transaction_totals_this_gateway();375 $transaction_totals = Payping_GravityForms_database::get_transaction_totals_this_gateway(); 376 376 $total_sales = empty( $transaction_totals["active"]["transactions"] ) ? 0 : $transaction_totals["active"]["transactions"]; 377 377 $total_revenue = empty( $transaction_totals["active"]["revenue"] ) ? 0 : $transaction_totals["active"]["revenue"]; … … 431 431 $sales_label = esc_html__( "تعداد کل پرداخت های همه فرمهای سایت", "payping-gravityforms" ); 432 432 433 $transaction_totals = GFPersian_DB_payping::get_transaction_totals_site();433 $transaction_totals = Payping_GravityForms_database::get_transaction_totals_site(); 434 434 $total_sales = empty( $transaction_totals["active"]["transactions"] ) ? 0 : $transaction_totals["active"]["transactions"]; 435 435 $total_revenue = empty( $transaction_totals["active"]["revenue"] ) ? 0 : $transaction_totals["active"]["revenue"]; … … 530 530 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 531 531 $t = esc_html__( 'پیپینگ این فرم', 'payping-gravityforms' ); 532 $tblname = GFPersian_DB_payping::get_entry_table_name();532 $tblname = Payping_GravityForms_database::get_entry_table_name(); 533 533 $query = $wpdb->prepare( 534 534 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 550 550 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 551 551 $t = esc_html__( 'همه روشهای این فرم', 'payping-gravityforms' ); 552 $tblname = GFPersian_DB_payping::get_entry_table_name();552 $tblname = Payping_GravityForms_database::get_entry_table_name(); 553 553 $query = $wpdb->prepare( 554 554 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 569 569 $dt = "}"; 570 570 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 571 $tblname = GFPersian_DB_payping::get_entry_table_name();571 $tblname = Payping_GravityForms_database::get_entry_table_name(); 572 572 $query = $wpdb->prepare( 573 573 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 588 588 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 589 589 $t = esc_html__( "همه فرمهای سایت", 'payping-gravityforms' ); 590 $tblname = GFPersian_DB_payping::get_entry_table_name();590 $tblname = Payping_GravityForms_database::get_entry_table_name(); 591 591 $query = $wpdb->prepare( 592 592 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 710 710 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 711 711 $t = esc_html__( "پیپینگ این فرم", 'payping-gravityforms' ); 712 $tblname = GFPersian_DB_payping::get_entry_table_name();712 $tblname = Payping_GravityForms_database::get_entry_table_name(); 713 713 $query = $wpdb->prepare( 714 714 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 730 730 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 731 731 $t = esc_html__( "همه روشهای این فرم", 'payping-gravityforms' ); 732 $tblname = GFPersian_DB_payping::get_entry_table_name();732 $tblname = Payping_GravityForms_database::get_entry_table_name(); 733 733 $query = $wpdb->prepare( 734 734 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 749 749 $dt = "}"; 750 750 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 751 $tblname = GFPersian_DB_payping::get_entry_table_name();751 $tblname = Payping_GravityForms_database::get_entry_table_name(); 752 752 $query = $wpdb->prepare( 753 753 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 768 768 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 769 769 $t = esc_html__( "همه فرم های سایت", 'payping-gravityforms' ); 770 $tblname = GFPersian_DB_payping::get_entry_table_name();770 $tblname = Payping_GravityForms_database::get_entry_table_name(); 771 771 $query = $wpdb->prepare( 772 772 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 948 948 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 949 949 $t = esc_html__( "پیپینگ این فرم", 'payping-gravityforms' ); 950 $tblname = GFPersian_DB_payping::get_entry_table_name();950 $tblname = Payping_GravityForms_database::get_entry_table_name(); 951 951 $query = $wpdb->prepare( 952 952 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 968 968 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 969 969 $t = esc_html__( "همه روشهای این فرم", 'payping-gravityforms' ); 970 $tblname = GFPersian_DB_payping::get_entry_table_name();970 $tblname = Payping_GravityForms_database::get_entry_table_name(); 971 971 $query = $wpdb->prepare( 972 972 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 987 987 $dt = "}"; 988 988 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 989 $tblname = GFPersian_DB_payping::get_entry_table_name();989 $tblname = Payping_GravityForms_database::get_entry_table_name(); 990 990 $query = $wpdb->prepare( 991 991 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1006 1006 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 1007 1007 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 1008 $tblname = GFPersian_DB_payping::get_entry_table_name();1008 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1009 1009 $query = $wpdb->prepare( 1010 1010 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1225 1225 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 1226 1226 $t = esc_html__( "پیپینگ این فرم", 'payping-gravityforms' ); 1227 $tblname = GFPersian_DB_payping::get_entry_table_name();1227 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1228 1228 $query = $wpdb->prepare( 1229 1229 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1245 1245 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 1246 1246 $t = esc_html__( "همه روشهای این فرم", 'payping-gravityforms' ); 1247 $tblname = GFPersian_DB_payping::get_entry_table_name();1247 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1248 1248 $query = $wpdb->prepare( 1249 1249 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1264 1264 $dt = "color: '#EDC240'}"; 1265 1265 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 1266 $tblname = GFPersian_DB_payping::get_entry_table_name();1266 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1267 1267 $query = $wpdb->prepare( 1268 1268 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1283 1283 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 1284 1284 $t = esc_html__( "همه فرم های سایت", 'payping-gravityforms' ); 1285 $tblname = GFPersian_DB_payping::get_entry_table_name();1285 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1286 1286 $query = $wpdb->prepare( 1287 1287 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1405 1405 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 1406 1406 $t = esc_html__( "پیپینگ این فرم", 'payping-gravityforms' ); 1407 $tblname = GFPersian_DB_payping::get_entry_table_name();1407 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1408 1408 $query = $wpdb->prepare( 1409 1409 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1425 1425 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 1426 1426 $t = esc_html__( "همه روشهای این فرم", 'payping-gravityforms' ); 1427 $tblname = GFPersian_DB_payping::get_entry_table_name();1427 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1428 1428 $query = $wpdb->prepare( 1429 1429 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1444 1444 $dt = "}"; 1445 1445 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 1446 $tblname = GFPersian_DB_payping::get_entry_table_name();1446 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1447 1447 $query = $wpdb->prepare( 1448 1448 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1463 1463 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 1464 1464 $t = esc_html__( "همه فرمهای سایت", 'payping-gravityforms' ); 1465 $tblname = GFPersian_DB_payping::get_entry_table_name();1465 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1466 1466 $query = $wpdb->prepare( 1467 1467 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1579 1579 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 1580 1580 $t = esc_html__( "پیپینگ این فرم", 'payping-gravityforms' ); 1581 $tblname = GFPersian_DB_payping::get_entry_table_name();1581 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1582 1582 $query = $wpdb->prepare( 1583 1583 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1599 1599 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 1600 1600 $t = esc_html__( "همه روشهای این فرم", 'payping-gravityforms' ); 1601 $tblname = GFPersian_DB_payping::get_entry_table_name();1601 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1602 1602 $query = $wpdb->prepare( 1603 1603 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1618 1618 $dt = "}"; 1619 1619 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 1620 $tblname = GFPersian_DB_payping::get_entry_table_name();1620 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1621 1621 $query = $wpdb->prepare( 1622 1622 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1636 1636 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 1637 1637 $t = esc_html__( "همه فرم های سایت", 'payping-gravityforms' ); 1638 $tblname = GFPersian_DB_payping::get_entry_table_name();1638 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1639 1639 $query = $wpdb->prepare( 1640 1640 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1796 1796 $dt = "points: { symbol: 'diamond', fillColor: '#058DC7' }, color: '#058DC7'}"; 1797 1797 $t = esc_html__( "پیپینگ این فرم", 'payping-gravityforms' ); 1798 $tblname = GFPersian_DB_payping::get_entry_table_name();1798 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1799 1799 $query = $wpdb->prepare( 1800 1800 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1816 1816 $dt = "points: { symbol: 'square', fillColor: '#50B432' }, color: '#50B432'}"; 1817 1817 $t = esc_html__( "همه روشهای این فرم", 'payping-gravityforms' ); 1818 $tblname = GFPersian_DB_payping::get_entry_table_name();1818 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1819 1819 $query = $wpdb->prepare( 1820 1820 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1835 1835 $dt = "}"; 1836 1836 $t = esc_html__( "همه فرمهای پیپینگ", 'payping-gravityforms' ); 1837 $tblname = GFPersian_DB_payping::get_entry_table_name();1837 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1838 1838 $query = $wpdb->prepare( 1839 1839 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales … … 1854 1854 $dt = "points: { symbol: 'triangle', fillColor: '#AA4643' }, color: '#AA4643'}"; 1855 1855 $t = esc_html__( "همه فرمهای سایت", 'payping-gravityforms' ); 1856 $tblname = GFPersian_DB_payping::get_entry_table_name();1856 $tblname = Payping_GravityForms_database::get_entry_table_name(); 1857 1857 $query = $wpdb->prepare( 1858 1858 "SELECT CONVERT_TZ(l.payment_date, '+00:00', %s) as date, sum(l.payment_amount) as amount_sold, count(l.id) as new_sales -
payping-gravityforms/trunk/database.php
r3099658 r3360992 5 5 } 6 6 7 class GFPersian_DB_payping{7 class Payping_GravityForms_database { 8 8 9 9 private static $method = 'payping'; -
payping-gravityforms/trunk/payping-gravityforms.php
r3357079 r3360992 11 11 License: GPLv3 or later 12 12 License URI: https://www.gnu.org/licenses/gpl-3.0.html 13 Text Domain: payping-gravityforms 13 14 */ 14 if ( !defined('ABSPATH')) exit;15 if ( ! defined('ABSPATH') ) exit; 15 16 16 17 18 function callback_for_setting_up_scripts() { 19 20 if ( ! class_exists("GFPersian_Payments") ) { 17 add_action('admin_enqueue_scripts', 'payping_gravityforms_admin_assets'); 18 function payping_gravityforms_admin_assets() { 19 if ( ! class_exists('GFPersian_Payments') ) { 21 20 return; 22 21 } 23 22 24 $screen = get_current_screen(); 25 if ( $screen && ( $screen->id === "toplevel_page_gf_settings" || strpos($screen->id, "gravityforms") !== false ) ) { 26 wp_enqueue_script( "gf-admin-scripts", plugin_dir_url( __FILE__ ) . "assets/js/scripts.js", array(), false, true ); 27 wp_enqueue_script( "shamsi-chart", esc_url(GFPersian_Payments::get_base_url()) . "/assets/js/shamsi_chart.js", array("jquery"), null, true ); 28 wp_register_script( "jquery-ui-jdatepicker", GFPersian_Payments::get_base_url() . "/assets/js/jalali-datepicker.js", array("jquery","jquery-migrate","jquery-ui-core",), GFCommon::$version, true ); 29 wp_enqueue_script( "jquery-ui-jdatepicker" ); 23 $screen = function_exists('get_current_screen') ? get_current_screen() : null; 24 if ( $screen && ( $screen->id === 'toplevel_page_gf_settings' || strpos($screen->id, 'gravityforms') !== false ) ) { 25 26 wp_enqueue_script( 27 'payping-gravityforms-admin-scripts', 28 plugin_dir_url(__FILE__) . 'assets/js/scripts.js', 29 array('jquery'), 30 false, 31 true 32 ); 33 34 wp_enqueue_script( 35 'payping-gravityforms-shamsi-chart', 36 esc_url( GFPersian_Payments::get_base_url() ) . '/assets/js/shamsi_chart.js', 37 array('jquery'), 38 null, 39 true 40 ); 41 42 wp_register_script( 43 'payping-gravityforms-jalali-datepicker', 44 esc_url( GFPersian_Payments::get_base_url() ) . '/assets/js/jalali-datepicker.js', 45 array('jquery','jquery-migrate','jquery-ui-core'), 46 GFCommon::$version, 47 true 48 ); 49 wp_enqueue_script('payping-gravityforms-jalali-datepicker'); 30 50 31 51 wp_localize_script( 32 "gf-admin-scripts",33 "myLocalizedData",52 'payping-gravityforms-admin-scripts', 53 'paypingGformData', 34 54 array( 35 "ajaxurl" => admin_url("admin-ajax.php"),36 "gf_payping_update_feed_active_nonce" => wp_create_nonce("gf_payping_update_feed_active"),37 "deactivate_message" => esc_html__("درگاه غیر فعال است", "payping-gravityforms"),38 "activate_message" => esc_html__("درگاه فعال است", "payping-gravityforms"),39 "ajax_error_message" => esc_html__("خطای Ajax رخ داده است", "payping-gravityforms")55 'ajaxUrl' => admin_url('admin-ajax.php'), 56 'nonceUpdateFeedActive' => wp_create_nonce('payping_gravityforms_update_feed_active'), 57 'msgDeactivate' => esc_html__('درگاه غیر فعال است', 'payping-gravityforms'), 58 'msgActivate' => esc_html__('درگاه فعال است', 'payping-gravityforms'), 59 'msgAjaxError' => esc_html__('خطای Ajax رخ داده است', 'payping-gravityforms'), 40 60 ) 41 61 ); 42 62 43 63 wp_enqueue_style( 44 "admin-styles-enqueue", plugin_dir_url( __FILE__ ) . "assets/css/styles.css" 64 'payping-gravityforms-admin-styles', 65 plugin_dir_url(__FILE__) . 'assets/css/styles.css' 45 66 ); 46 67 47 68 if ( is_rtl() ) { 48 $custom_css = " table.gforms_form_settings th { text-align: right !important; }"; 49 wp_add_inline_style( "admin-styles-enqueue", $custom_css ); 69 wp_add_inline_style( 70 'payping-gravityforms-admin-styles', 71 'table.gforms_form_settings th { text-align: right !important; }' 72 ); 50 73 } 51 74 } 52 75 } 53 add_action( "admin_enqueue_scripts", "callback_for_setting_up_scripts" );54 76 77 require_once plugin_dir_path(__FILE__) . 'payping.php'; 55 78 56 require_once('payping.php');57 -
payping-gravityforms/trunk/payping.php
r3357079 r3360992 6 6 } 7 7 8 register_activation_hook( __FILE__, array( ' GFPersian_Gateway_payping', "add_permissions" ) );9 add_action( 'init', array( ' GFPersian_Gateway_payping', 'init' ) );8 register_activation_hook( __FILE__, array( 'Payping_GravityForms_Gateway', "add_permissions" ) ); 9 add_action( 'init', array( 'Payping_GravityForms_Gateway', 'init' ) ); 10 10 11 11 require_once( 'database.php' ); 12 12 require_once( 'chart.php' ); 13 13 14 class GFPersian_Gateway_payping{14 class Payping_GravityForms_Gateway { 15 15 16 16 //Dont Change this Parameter if you are legitimate !!! … … 31 31 32 32 if ( ! self::is_gravityforms_supported() ) { 33 add_action( 'admin_notices', array( __CLASS__, 'admin_notice_g f_support' ) );33 add_action( 'admin_notices', array( __CLASS__, 'admin_notice_gravityforms_support' ) ); 34 34 35 35 return false; … … 65 65 } 66 66 67 add_action( 'wp_ajax_ gf_payping_update_feed_active', array( __CLASS__, 'update_feed_active' ) );67 add_action( 'wp_ajax_payping_gravityforms_update_feed_active', array( __CLASS__, 'update_feed_active' ) ); 68 68 } 69 69 if ( get_option( "ppgf_payping_configured" ) ) { … … 78 78 79 79 // -------------------------------------------------------------------------------------------- 80 add_filter( ' gf_payment_gateways', array( __CLASS__, 'gravityformspayping' ), 2 );80 add_filter( 'payping_gravityforms_payment_gateways', array( __CLASS__, 'gravityformspayping' ), 2 ); 81 81 do_action( 'gravityforms_gateways' ); 82 82 do_action( 'gravityforms_payping' ); … … 93 93 94 94 // ------------------------------------------------- 95 public static function admin_notice_g f_support() {95 public static function admin_notice_gravityforms_support() { 96 96 $class_safe = 'notice notice-error'; 97 97 $message_safe = sprintf( esc_html__( "درگاه پیپینگ نیاز به گرویتی فرم نسخه %s به بالا دارد. برای بروز رسانی هسته گرویتی فرم به %sسایت گرویتی فرم فارسی%s مراجعه نمایید .", "payping-gravityforms" ), self::$min_gravityforms_version, "<a href='http:///11378' target='_blank'>", "</a>" ); … … 114 114 ); 115 115 116 return apply_filters( self::$author . '_g f_payping_detail', apply_filters( self::$author . '_gf_gateway_detail', $payping, $form, $entry ), $form, $entry );116 return apply_filters( self::$author . '_gravityforms_payping_detail', apply_filters( self::$author . '_gravityforms_gateway_detail', $payping, $form, $entry ), $form, $entry ); 117 117 } 118 118 … … 137 137 private static function setup() { 138 138 if ( get_option( "ppgf_payping_version" ) != self::$version ) { 139 GFPersian_DB_payping::update_table();139 Payping_GravityForms_database::update_table(); 140 140 update_option( "ppgf_payping_version", self::$version ); 141 141 } … … 218 218 die( esc_html__( "شما مجوز کافی برای این کار را ندارید . سطح دسترسی شما پایین تر از حد مجاز است . ", "payping-gravityforms" ) ); 219 219 } 220 GFPersian_DB_payping::drop_tables();220 Payping_GravityForms_database::drop_tables(); 221 221 delete_option( "ppgf_payping_settings" ); 222 222 delete_option( "ppgf_payping_configured" ); … … 326 326 public static function get_config_by_entry( $entry ) { 327 327 $feed_id = gform_get_meta( $entry["id"], "payping_feed_id" ); 328 $feed = ! empty( $feed_id ) ? GFPersian_DB_payping::get_feed( $feed_id ) : '';328 $feed = ! empty( $feed_id ) ? Payping_GravityForms_database::get_feed( $feed_id ) : ''; 329 329 $return = ! empty( $feed ) ? $feed : false; 330 330 331 return apply_filters( self::$author . '_g f_payping_get_config_by_entry', apply_filters( self::$author . '_gf_gateway_get_config_by_entry', $return, $entry ), $entry );331 return apply_filters( self::$author . '_gravityforms_payping_get_config_by_entry', apply_filters( self::$author . '_gravityforms_gateway_get_config_by_entry', $return, $entry ), $entry ); 332 332 } 333 333 … … 388 388 } 389 389 390 $configs = GFPersian_DB_payping::get_feed_by_form( $form["id"], true );391 392 $configs = apply_filters( self::$author . '_g f_payping_get_active_configs', apply_filters( self::$author . '_gf_gateway_get_active_configs', $configs, $form ), $form );390 $configs = Payping_GravityForms_database::get_feed_by_form( $form["id"], true ); 391 392 $configs = apply_filters( self::$author . '_gravityforms_payping_get_active_configs', apply_filters( self::$author . '_gravityforms_gateway_get_active_configs', $configs, $form ), $form ); 393 393 394 394 $return = false; … … 404 404 } 405 405 406 self::$config = apply_filters( self::$author . '_g f_payping_get_active_config', apply_filters( self::$author . '_gf_gateway_get_active_config', $return, $form ), $form );406 self::$config = apply_filters( self::$author . '_gravityforms_payping_get_active_config', apply_filters( self::$author . '_gravityforms_gateway_get_active_config', $return, $form ), $form ); 407 407 408 408 return self::$config; … … 415 415 self::config_page(); 416 416 } else if ( $view == "stats" ) { 417 GFPersian_Chart_payping::stats_page();417 Payping_GravityForms_Chart::stats_page(); 418 418 } else { 419 419 self::list_page( '' ); … … 429 429 430 430 if ( rgpost( 'action' ) == "delete" ) { 431 check_admin_referer( "list_action", "g f_payping_list" );431 check_admin_referer( "list_action", "gravityforms_payping_list" ); 432 432 $id = absint( rgpost( "action_argument" ) ); 433 GFPersian_DB_payping::delete_feed( $id );433 Payping_GravityForms_database::delete_feed( $id ); 434 434 ?> 435 435 <div class="updated fade" … … 437 437 } else if ( ! empty( $_POST["bulk_action"] ) ) { 438 438 439 check_admin_referer( "list_action", "g f_payping_list" );439 check_admin_referer( "list_action", "gravityforms_payping_list" ); 440 440 $selected_feeds = rgpost( "feed" ); 441 441 if ( is_array( $selected_feeds ) ) { 442 442 foreach ( $selected_feeds as $feed_id ) { 443 GFPersian_DB_payping::delete_feed( $feed_id );443 Payping_GravityForms_database::delete_feed( $feed_id ); 444 444 } 445 445 } … … 467 467 468 468 <form id="confirmation_list_form" method="post"> 469 <?php wp_nonce_field( 'list_action', 'g f_payping_list' ) ?>469 <?php wp_nonce_field( 'list_action', 'gravityforms_payping_list' ) ?> 470 470 <input type="hidden" id="action" name="action"/> 471 471 <input type="hidden" id="action_argument" name="action_argument"/> … … 518 518 <?php 519 519 if ( $arg != 'per-form' ) { 520 $settings = GFPersian_DB_payping::get_feeds();520 $settings = Payping_GravityForms_database::get_feeds(); 521 521 } else { 522 $settings = GFPersian_DB_payping::get_feed_by_form( rgget( 'id' ), false );522 $settings = Payping_GravityForms_database::get_feed_by_form( rgget( 'id' ), false ); 523 523 } 524 524 … … 635 635 // ------------------------------------------------- 636 636 public static function update_feed_active() { 637 check_ajax_referer( 'g f_payping_update_feed_active', 'gf_payping_update_feed_active' );637 check_ajax_referer( 'gravityforms_payping_update_feed_active', 'gravityforms_payping_update_feed_active' ); 638 638 639 639 $id = absint( rgpost( 'feed_id' ) ); // Sanitize as an integer 640 $feed = GFPersian_DB_payping::get_feed( $id );640 $feed = Payping_GravityForms_database::get_feed( $id ); 641 641 642 642 $form_id = intval( $feed["form_id"] ); // Sanitize as an integer … … 644 644 $meta = esc_sql( $feed["meta"] ); // Escape SQL data 645 645 646 GFPersian_DB_payping::update_feed( $id, $form_id, $is_active, $meta );646 Payping_GravityForms_database::update_feed( $id, $form_id, $is_active, $meta ); 647 647 } 648 648 … … 873 873 $payment_string .= '</select>'; 874 874 875 echo '<label for="payment_status">' . esc_html__( 'وضعیت پرداخت :', 'payping-gravityforms' ) . '</label> ' . $payment_string . '<br/><br/>'; 875 //echo '<label for="payment_status">' . esc_html__( 'وضعیت پرداخت :', 'payping-gravityforms' ) . '</label> ' . $payment_string . '<br/><br/>'; 876 echo '<label for="payment_status">' 877 . esc_html__( 'وضعیت پرداخت :', 'payping-gravityforms' ) 878 . '</label> ' 879 . wp_kses_post( $payment_string ) 880 . '<br/><br/>'; 876 881 877 882 ?> … … 1018 1023 1019 1024 if ( rgpost( "uninstall" ) ) { 1020 check_admin_referer( "uninstall", "g f_payping_uninstall" );1025 check_admin_referer( "uninstall", "gravityforms_payping_uninstall" ); 1021 1026 self::uninstall(); 1022 1027 echo wp_kses_post('<div class="updated fade" style="padding:20px;">' . esc_html__( "درگاه با موفقیت غیرفعال شد و اطلاعات مربوط به آن نیز از بین رفت برای فعالسازی مجدد میتوانید از طریق افزونه های وردپرس اقدام نمایید .", "payping-gravityforms" ) . '</div>'); … … 1025 1030 } else if ( isset( $_POST["gf_payping_submit"] ) ) { 1026 1031 1027 check_admin_referer( "update", "g f_payping_update" );1032 check_admin_referer( "update", "gravityforms_payping_update" ); 1028 1033 $settings = array( 1029 "merchent" => rgpost( 'g f_payping_merchent' ),1034 "merchent" => rgpost( 'gravityforms_payping_token' ), 1030 1035 "gname" => rgpost( 'gf_payping_gname' ), 1031 1036 ); … … 1062 1067 <form action="" method="post"> 1063 1068 1064 <?php wp_nonce_field( "update", "g f_payping_update" ) ?>1069 <?php wp_nonce_field( "update", "gravityforms_payping_update" ) ?> 1065 1070 1066 1071 <h3> … … 1087 1092 <tr> 1088 1093 <th scope="row"><label 1089 for="g f_payping_merchent"><?php esc_html_e( "کد توکن", "payping-gravityforms" ); ?></label>1094 for="gravityforms_payping_token"><?php esc_html_e( "کد توکن", "payping-gravityforms" ); ?></label> 1090 1095 </th> 1091 1096 <td> 1092 1097 <input style="width:350px;text-align:left;direction:ltr !important" type="text" 1093 id="g f_payping_merchent" name="gf_payping_merchent"1098 id="gravityforms_payping_token" name="gravityforms_payping_token" 1094 1099 value="<?php echo esc_html( sanitize_text_field( rgar( $settings, 'merchent' ) ) ); ?>"/> 1095 1100 </td> … … 1168 1173 "meta" => array(), 1169 1174 "is_active" => true 1170 ) : GFPersian_DB_payping::get_feed( $id );1171 $get_feeds = GFPersian_DB_payping::get_feeds();1175 ) : Payping_GravityForms_database::get_feed( $id ); 1176 $get_feeds = Payping_GravityForms_database::get_feeds(); 1172 1177 $form_name = ''; 1173 1178 … … 1236 1241 $config = apply_filters( self::$author . '_gform_payping_save_config', $config ); 1237 1242 1238 $id = GFPersian_DB_payping::update_feed( $id, $config["form_id"], $config["is_active"], $config["meta"] );1243 $id = Payping_GravityForms_database::update_feed( $id, $config["form_id"], $config["is_active"], $config["meta"] ); 1239 1244 1240 1245 $redirect_url = esc_url(admin_url('admin.php?page=gravityforms_payping&view=edit&id=' . $id . '&updated=true')); … … 1286 1291 <label for="export_form"><?php esc_html_e( 'یک فید انتخاب کنید', 'payping-gravityforms' ) ?></label> 1287 1292 <?php 1288 $feeds = GFPersian_DB_payping::get_feeds();1293 $feeds = Payping_GravityForms_database::get_feeds(); 1289 1294 if ( RG_CURRENT_VIEW != 'entry' ) { ?> 1290 1295 <select name="form_switcher" id="form_switcher" … … 1391 1396 value=""><?php esc_html_e( "یک فرم انتخاب نمایید", "payping-gravityforms" ); ?> </option> 1392 1397 <?php 1393 $available_forms = GFPersian_DB_payping::get_available_forms();1398 $available_forms = Payping_GravityForms_database::get_available_forms(); 1394 1399 foreach ( $available_forms as $current_form ) { 1395 1400 $selected = absint( $current_form->id ) == $_get_form_id ? 'selected="selected"' : ''; ?> … … 1685 1690 1686 1691 var form = []; 1687 form = <?php echo ! empty( $form ) ? GFCommon::json_encode( $form ) : GFCommon::json_encode( array() ) ?>; 1692 //form = <?php //echo ! empty( $form ) ? GFCommon::json_encode( $form ) : GFCommon::json_encode( array() ) ?>; 1693 form = <?php echo wp_json_encode( ! empty( $form ) ? $form : array() ); ?>; 1688 1694 1689 1695 jQuery(document).ready(function ($) { … … 1728 1734 1729 1735 <?php foreach ( $condition_field_ids as $i => $field_id ) : ?> 1730 selectedField = "<?php echo str_replace( '"', '\"', $field_id )?>"; 1731 selectedValue = "<?php echo str_replace( '"', '\"', $condition_values[ '' . $i . '' ] )?>"; 1732 selectedOperator = "<?php echo str_replace( '"', '\"', $condition_operators[ '' . $i . '' ] )?>"; 1733 RefreshConditionRow("gf_payping_<?php echo $i;?>__conditional", selectedField, selectedOperator, selectedValue, <?php echo $i;?>); 1736 //selectedField = "<?php //echo str_replace( '"', '\"', $field_id )?>"; 1737 //selectedValue = "<?php //echo str_replace( '"', '\"', $condition_values[ '' . $i . '' ] )?>"; 1738 //selectedOperator = "<?php //echo str_replace( '"', '\"', $condition_operators[ '' . $i . '' ] )?>"; 1739 //RefreshConditionRow("gf_payping_<?php //echo $i;?>__conditional", selectedField, selectedOperator, selectedValue, <?php //echo $i;?>); 1740 selectedField = <?php echo wp_json_encode( isset($field_id) ? $field_id : "" ); ?>; 1741 selectedValue = <?php echo wp_json_encode( isset($condition_values[ "" . $i . "" ]) ? $condition_values[ "" . $i . "" ] : "" ); ?>; 1742 selectedOperator = <?php echo wp_json_encode( isset($condition_operators[ "" . $i . "" ]) ? $condition_operators[ "" . $i . "" ] : "" ); ?>; 1743 RefreshConditionRow("gf_payping_<?php echo esc_js( $i ); ?>__conditional", selectedField, selectedOperator, selectedValue, <?php echo esc_js( $i ); ?>); 1734 1744 <?php endforeach;?> 1735 1745 }); … … 1769 1779 1770 1780 if (selectedOperator == '' || selectedOperator == 'is' || selectedOperator == 'isnot') { 1771 if (field["type"] == "post_category" && field["displayAllCategories"]) { 1772 str += '<?php $dd = wp_dropdown_categories( array( 1773 "class" => "condition_field_value", 1774 "orderby" => "name", 1775 "id" => "gf_dropdown_cat_id", 1776 "name" => "gf_dropdown_cat_name", 1777 "hierarchical" => true, 1778 "hide_empty" => 0, 1779 "echo" => false 1780 ) ); echo str_replace( "\n", "", str_replace( "'", "\\'", $dd ) ); ?>'; 1781 str = str.replace("gf_dropdown_cat_id", "" + input + "_value").replace("gf_dropdown_cat_name", name); 1782 } 1781 if ($field["type"] == "post_category" && $field["displayAllCategories"]) { 1782 str += '<?php 1783 $dd = wp_dropdown_categories( array( 1784 "class" => "condition_field_value", 1785 "orderby" => "name", 1786 "id" => "gf_dropdown_cat_id", 1787 "name" => "gf_dropdown_cat_name", 1788 "hierarchical" => true, 1789 "hide_empty" => 0, 1790 "echo" => false 1791 ) ); 1792 echo esc_js( str_replace( "\n", "", str_replace( "\'", "\\'", $dd ) ) ); /*echo str_replace( "\n", "", str_replace( "'", "\\'", $dd ) ); ?>'; */ 1793 ?>'; 1794 1795 str = str.replace("gf_dropdown_cat_id", "" + input + "_value") 1796 .replace("gf_dropdown_cat_name", name); 1797 } 1783 1798 else if (field.choices) { 1784 1799 var isAnySelected = false; … … 1807 1822 if (is_text) { 1808 1823 selectedValue = selectedValue ? selectedValue.replace(/'/g, "'") : ""; 1809 str += "<input type='text' class='condition_field_value' style='padding:3px' placeholder='<?php _e( "یک مقدار وارد نمایید", "gravityformspayping" ); ?>' id='" + input + "_value' name='" + name + "' value='" + selectedValue + "'>";1824 str += "<input type='text' class='condition_field_value' style='padding:3px' placeholder='<?php esc_attr_e( "یک مقدار وارد نمایید", "payping-gravityforms" ); ?>' id='" + input + "_value' name='" + name + "' value='" + selectedValue + "'>"; 1810 1825 } 1811 1826 return str; … … 1878 1893 do_action( 'ppgf_payping_request_1', $confirmation, $form, $entry, $ajax ); 1879 1894 1880 if ( apply_filters( 'g f_payping_request_return', apply_filters( 'ppgf_gateway_request_return', false, $confirmation, $form, $entry, $ajax ), $confirmation, $form, $entry, $ajax ) ) {1895 if ( apply_filters( 'gravityforms_payping_request_return', apply_filters( 'ppgf_gateway_request_return', false, $confirmation, $form, $entry, $ajax ), $confirmation, $form, $entry, $ajax ) ) { 1881 1896 return $confirmation; 1882 1897 } … … 2074 2089 $entry = GFPersian_Payments::get_entry( $entry_id ); 2075 2090 $ReturnPath = self::Return_URL( $form['id'], $entry_id ); 2076 $ResNumber = apply_filters( 'g f_payping_res_number', apply_filters( 'ppgf_gateway_res_number', $entry_id, $entry, $form ), $entry, $form );2091 $ResNumber = apply_filters( 'gravityforms_payping_res_number', apply_filters( 'ppgf_gateway_res_number', $entry_id, $entry, $form ), $entry, $form ); 2077 2092 } else { 2078 2093 $Amount = absint( 10000 ); … … 2110 2125 $headers = array( 2111 2126 'X-Platform' => 'GravityForms', 2112 'X-Platform-Version' => '2.5. 1',2127 'X-Platform-Version' => '2.5.0', 2113 2128 "Accept" => "application/json", 2114 2129 "Authorization" => "Bearer " . self::get_merchent(), … … 2202 2217 2203 2218 // ـــ ۱) گذر از فیلترهای سفارشی و پیششرطها 2204 if ( apply_filters( 'g f_gateway_payping_return', apply_filters( 'ppgf_gateway_verify_return', false ) ) ) {2219 if ( apply_filters( 'gravityforms_gateway_payping_return', apply_filters( 'ppgf_gateway_verify_return', false ) ) ) { 2205 2220 return; 2206 2221 } … … 2234 2249 2235 2250 $config = ( $payment_type === 'custom' ) 2236 ? apply_filters( self::$author . '_g f_payping_config', [], $form, $entry )2251 ? apply_filters( self::$author . '_gravityforms_payping_config', [], $form, $entry ) 2237 2252 : self::get_config_by_entry( $entry ); 2238 2253 … … 2260 2275 // ـــ ۵) واکشی و پاکسازی دادهٔ برگشتی درگاه 2261 2276 //---------------------------------------------- 2262 $raw_data = isset( $_REQUEST['data'] ) ? wp_unslash( $_REQUEST['data'] ) : ''; 2277 //$raw_data = isset( $_REQUEST['data'] ) ? wp_unslash( $_REQUEST['data'] ) : ''; 2278 $raw_data = isset( $_REQUEST['data'] ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['data'] ) ) : ''; 2263 2279 $responseData = json_decode( $raw_data, true ) ?: []; 2264 2280 $status = isset( $_REQUEST['status'] ) ? absint( $_REQUEST['status'] ) : null; … … 2594 2610 2595 2611 // اعلانها و تاییدیه 2596 if ( apply_filters( self::$author . '_g f_payping_verify', true, $form, $entry ) ) {2612 if ( apply_filters( self::$author . '_gravityforms_payping_verify', true, $form, $entry ) ) { 2597 2613 GFPersian_Payments::notification( $form, $entry ); 2598 2614 GFPersian_Payments::confirmation( $form, $entry, $duplicate ? 'پرداخت قبلاً تأیید شده بود.' : '' );
Note: See TracChangeset
for help on using the changeset viewer.