From 2355839e00229561e47e07102d8bc06444a921c4 Mon Sep 17 00:00:00 2001 From: MahdiSarani Date: Wed, 29 Nov 2023 11:11:30 +0330 Subject: [PATCH] fix element safe --- assets/css/index.css | 704 ++++++++++++------------ class-wp-payping-donation.php | 970 +++++++++++++++++----------------- 2 files changed, 835 insertions(+), 839 deletions(-) diff --git a/assets/css/index.css b/assets/css/index.css index 2c79756..c3317a1 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -1,357 +1,349 @@ -.pp-donate { - position: fixed !important; - bottom: 18px !important; - left: 20px !important; - cursor: default !important; - direction: rtl !important; - z-index: 100 !important; -} - -.pp-donate svg { - vertical-align: middle !important; -} -.pp-donate-btn { - margin: auto; - width: 120px !important; - height: 35px !important; - line-height: 35px !important; - background-color: #0080ff !important; - border-radius: 5px !important; - text-align: center !important; - cursor: pointer !important; - color: #fff !important; - padding: 0 8px !important; -} - -.pp-donate-btn:hover { - background-color: #0096d6 !important; -} - -.pp-donate .pp-donate-btn svg { - margin-right: 10px !important; -} - -.pp-donate-box { - position: fixed !important; - bottom: 18px !important; - left: 20px !important; - visibility: hidden; - opacity: 0; - transition: all 0.2s !important; -} - -@media (max-width: 992px) { - .pp-donate-box { - left: 0 !important; - right: 0 !important; - margin: auto !important; - width: 95% !important; - } -} -.pp-donate-box-header { - position: relative !important; - width: 100% !important; - height: 50px !important; - padding-top: 3px !important; -} - -.pp-donate-box-header .pp-donate-text { - text-align: center !important; - color: #172b4d !important; - font-size: 17px !important; -} - -.pp-donate-box-header .pp-donate-text svg { - margin: 0 5px !important; -} - -.pp-donate-box-header .pp-operate-btn { - padding: 3px !important; - top: 18px !important; - border-radius: 25px !important; - cursor: pointer !important; -} - -.pp-donate-box-header .close-btn { - position: absolute !important; - left: 10px !important; -} - -.pp-donate-box-header .pp-operate-btn:hover, -.pp-donate-box-header .pp-donate-back:hover svg { - transition: all 0.2s ease-in-out !important; - background-color: #e9e9e9 !important; -} - -.pp-donate-body { - transition: all 0.2s !important; - text-align: center !important; - padding: 10px 20px !important; -} - -.pp-donate-logo { - width: 100px !important; - height: 100px !important; - margin: auto; - overflow: hidden !important; - background-size: cover !important; - background-repeat: no-repeat !important; - background-position: center center !important; - border-radius: 50% !important; -} - -.pp-donate-input { - background-color: #fff !important; - border-radius: 5px !important; - text-align: center !important; - border: none !important; - width: 100% !important; - height: 35px !important; - line-height: 35px !important; - margin-bottom: 15px; -} - -.pp-amount div { - border-radius: 5px !important; - transition: all 0.27s !important; -} - -.pp-select-amount div { - padding: 8px 5px !important; - margin: 15px 3px !important; - background-color: #fff !important; - display: inline-block !important; - cursor: pointer !important; - min-width: 22% !important; - color: #323232 !important; -} - -.pp-select-amount div:hover { - background-color: #172b4d !important; - color: #fff !important; -} - -.pp-donate-box-footer { - color: #172b4d !important; - position: absolute !important; - right: 0 !important; - left: 0 !important; - bottom: 20px !important; -} - -.pp-donate .pp-donate-box-footer p { - font-size: 12px !important; -} - -.pp-donate .pp-donate-box-footer svg { - margin-right: 3px !important; -} - -/* new style */ -form#donate_payping input[type=text]{ - width: 536px; - height: 40px; - color: #202124; - margin-bottom: 18px; - background: transparent; - border: 1px solid #C1C7D0; - border-radius: 5px; - opacity: 1; -} -form#donate_payping button#add_price { - width: 536px; - height: 40px; - background: #0080ff; - color: #fff; - cursor: pointer; - border: none; -} -button#add_price:before { - content: '\002B'; - padding: 5px; -} -.errorTxt { - font-size: 12px; - color: #e12d35; - margin-right: 10px; -} -.amountInput::-webkit-inner-spin-button, -.amountInput::-webkit-outer-spin-button { - -webkit-appearance: none; - margin: 0; -} - -.amountInput { - direction: ltr; - width: 536px; - height: 40px; - margin-bottom: 18px; - -moz-appearance: textfield; -} -form#donate_payping textarea{ - width: 536px; - height: 108px; - margin-bottom: 18px; - border: 1px solid #C1C7D0; - border-radius: 5px; - opacity: 1; - resize: none; - background: transparent; -} - -p#title_price { - display: inline-block; - font-weight: bold; -} - -input#amount0, div#prices input { - text-align: center; - cursor: pointer; -} - -input[type=checkbox]{ - height: 0; - width: 0; - visibility: hidden; -} - -label#price_switch { - cursor: pointer; - width: 73px; - height: 29px; - background: #97A0AF; - display: inline-block; - border-radius: 100px; - position: relative; - -} -.suggested_subtitle { - margin-right: 20px; - color: green; - font-size: 12px; -} -.removeInput { - width: 20px; - display: inline-block; - text-align: center; - background: #e12d35; - border-radius: 50px; - color: #fff; - height: 20px; - line-height: 20px; - margin-right: 5px; - font-size: 12px; - cursor: pointer; -} -label#price_switch:before { - content: 'غیرفعال'; - font-size: 13px; - position: relative; - top: 5px; - right: 5px; - color: #fff; - opacity: 0.8; - transition: 0.3s; -} - -label#price_switch:after { - content: ''; - position: absolute; - top: 5px; - left: 5px; - width: 19px; - height: 19px; - background: #fff; - border-radius: 50%; - transition: 0.3s; -} - -input[type=checkbox]:checked + label#price_switch { - background: #0080ff; -} - -input[type=checkbox]:checked + label#price_switch:before { - content: 'فعال'; - right: calc(50% - 5px); - transform: translateX(-50%); -} - -input[type=checkbox]:checked + label#price_switch:after { - left: calc(100% - 5px); - transform: translateX(-100%); -} - -label#price_switch:active:before { - font-size: 0px; -} - -label#price_switch:active:after { - width:30px; -} -div.checkbox-pages { - width: calc( 30% - 5px); - display: inline-block; -} - -input.input-value { - width: 15px; - height: 15px; - visibility: visible; - margin-right: 5px; -} - -div.title_checkbox { - text-align: right; - font-size: 16px; - font-weight: bold; - margin: 25px 0px 0px; -} - -section.enable{ - height: auto; - visibility: visible; -} - -section.disabled { - pointer-events: none; - visibility: hidden; - display: none; - animation: slideDown 0.5s ease 0.5s forwards; -} - -@-webkit-keyframes slideDown { - from { height: auto; } - to { height: 0px; } -} - -@keyframes slideDown { - from { height: auto; } - to { height: 0px; } -} - -span.note-danger { - font-size: 13px; - color: #d63606; - margin-top: -10px; - display: block; -} - -/* preview Box */ -.pp-donate-box { - width: 380px; - height: 500px; - background: #F4F5F7 0% 0% no-repeat padding-box; - border-radius: 5px 5px 0px 0px; - opacity: 1; -} -.form-table td { - position: relative; -} -#loader { - right: -25px; - position: absolute; - top: 22px; -} -#loader .spinner.active { - visibility: visible; +.pp-donate { + position: fixed !important; + bottom: 18px !important; + left: 20px !important; + cursor: default !important; + direction: rtl !important; + z-index: 100 !important; +} + +.pp-donate svg { + vertical-align: middle !important; +} + +.pp-donate-btn { + margin: auto; + width: 120px !important; + height: 35px !important; + line-height: 35px !important; + background-color: #0080ff !important; + border-radius: 5px !important; + text-align: center !important; + cursor: pointer !important; + color: #fff !important; + padding: 0 8px !important; +} + +.pp-donate-btn:hover { + background-color: #0096d6 !important; +} + +.pp-donate .pp-donate-btn svg { + margin-right: 10px !important; +} + +.pp-donate-box { + position: fixed !important; + bottom: 18px !important; + left: 20px !important; + visibility: hidden; + opacity: 0; + transition: all 0.2s !important; +} + +@media (max-width: 992px) { + .pp-donate-box { + left: 0 !important; + right: 0 !important; + margin: auto !important; + width: 95% !important; + } +} + +.pp-donate-box-header { + position: relative !important; + width: 100% !important; + height: 50px !important; + padding-top: 3px !important; +} + +.pp-donate-box-header .pp-donate-text { + text-align: center !important; + color: #172b4d !important; + font-size: 17px !important; +} + +.pp-donate-box-header .pp-donate-text svg { + margin: 0 5px !important; +} + +.pp-donate-box-header .pp-operate-btn { + padding: 3px !important; + top: 18px !important; + border-radius: 25px !important; + cursor: pointer !important; +} + +.pp-donate-box-header .close-btn { + position: absolute !important; + left: 10px !important; +} + +.pp-donate-box-header .pp-operate-btn:hover, +.pp-donate-box-header .pp-donate-back:hover svg { + transition: all 0.2s ease-in-out !important; + background-color: #e9e9e9 !important; +} + +.pp-donate-body { + transition: all 0.2s !important; + text-align: center !important; + padding: 10px 20px !important; +} + +.pp-donate-logo { + width: 100px !important; + height: 100px !important; + margin: auto; + overflow: hidden !important; + background-size: cover !important; + background-repeat: no-repeat !important; + background-position: center center !important; + border-radius: 50% !important; +} + +.pp-donate-input { + background-color: #fff !important; + border-radius: 5px !important; + text-align: center !important; + border: none !important; + width: 100% !important; + height: 35px !important; + line-height: 35px !important; + margin-bottom: 15px; +} + +.pp-amount div { + border-radius: 5px !important; + transition: all 0.27s !important; +} + +.pp-select-amount div { + padding: 8px 5px !important; + margin: 15px 3px !important; + background-color: #fff !important; + display: inline-block !important; + cursor: pointer !important; + min-width: 22% !important; + color: #323232 !important; +} + +.pp-select-amount div:hover { + background-color: #172b4d !important; + color: #fff !important; +} + +.pp-donate-box-footer { + color: #172b4d !important; + position: absolute !important; + right: 0 !important; + left: 0 !important; + bottom: 20px !important; +} + +.pp-donate .pp-donate-box-footer p { + font-size: 12px !important; +} + +.pp-donate .pp-donate-box-footer svg { + margin-right: 3px !important; +} + +/* new style */ +form#donate_payping input[type=text], button#add_price{ + width: 536px; + height: 40px; + color: #202124; + margin-bottom: 18px; + background: transparent; + border: 1px solid #C1C7D0; + border-radius: 5px; + opacity: 1; +} + +button#add_price:before { + content: '\002B'; + padding: 5px; +} +#add_price { + background: #0080ff; + color: #fff; +} +.errorTxt { + font-size: 12px; + color: #e12d35; + margin-right: 10px; +} +.amountInput::-webkit-inner-spin-button, +.amountInput::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} + +.amountInput { + direction: ltr; + width: 536px; + height: 40px; + margin-bottom: 18px; + -moz-appearance: textfield; +} +form#donate_payping textarea{ + width: 536px; + height: 108px; + margin-bottom: 18px; + border: 1px solid #C1C7D0; + border-radius: 5px; + opacity: 1; + resize: none; + background: transparent; +} + +p#title_price { + display: inline-block; + font-weight: bold; +} + +#donate_payping input#amount0, #donate_payping div#prices input { + text-align: center; + cursor: pointer; +} +label#price_switch { + cursor: pointer; + width: 73px; + height: 29px; + background: #97A0AF; + display: inline-block; + border-radius: 100px; + position: relative; + +} +.suggested_subtitle { + margin-right: 20px; + color: green; + font-size: 12px; +} +.removeInput { + width: 20px; + display: inline-block; + text-align: center; + background: #e12d35; + border-radius: 50px; + color: #fff; + height: 20px; + line-height: 20px; + margin-right: 5px; + font-size: 12px; + cursor: pointer; +} +label#price_switch:before { + content: 'غیرفعال'; + font-size: 13px; + position: relative; + top: 5px; + right: 5px; + color: #fff; + opacity: 0.8; + transition: 0.3s; +} + +label#price_switch:after { + content: ''; + position: absolute; + top: 5px; + left: 5px; + width: 19px; + height: 19px; + background: #fff; + border-radius: 50%; + transition: 0.3s; +} + +#donate_payping input[type=checkbox]:checked + label#price_switch { + background: #0080ff; +} + +#donate_payping input[type=checkbox]:checked + label#price_switch:before { + content: 'فعال'; + right: calc(50% - 5px); + transform: translateX(-50%); +} + +#donate_payping input[type=checkbox]:checked + label#price_switch:after { + left: calc(100% - 5px); + transform: translateX(-100%); +} + +label#price_switch:active:before { + font-size: 0px; +} + +label#price_switch:active:after { + width:30px; +} +#donate_payping div.checkbox-pages { + width: calc( 30% - 5px); + display: inline-block; +} + +#donate_payping input.input-value { + width: 15px; + height: 15px; + visibility: visible; + margin-right: 5px; +} + +div.title_checkbox { + text-align: right; + font-size: 16px; + font-weight: bold; + margin: 25px 0px 0px; +} + +section.enable{ + height: auto; + visibility: visible; +} + +section.disabled { + pointer-events: none; + visibility: hidden; + display: none; + animation: slideDown 0.5s ease 0.5s forwards; +} + +@-webkit-keyframes slideDown { + from { height: auto; } + to { height: 0px; } +} + +@keyframes slideDown { + from { height: auto; } + to { height: 0px; } +} + +span.note-danger { + font-size: 13px; + color: #d63606; + margin-top: -10px; + display: block; +} + +/* preview Box */ +.pp-donate-box { + width: 380px; + height: 500px; + background: #F4F5F7 0% 0% no-repeat padding-box; + border-radius: 5px 5px 0px 0px; + opacity: 1; +} +.form-table td { + position: relative; +} +#loader { + right: -25px; + position: absolute; + top: 22px; +} +#loader .spinner.active { + visibility: visible; } \ No newline at end of file diff --git a/class-wp-payping-donation.php b/class-wp-payping-donation.php index c913b43..e35c555 100644 --- a/class-wp-payping-donation.php +++ b/class-wp-payping-donation.php @@ -1,484 +1,488 @@ - admin_url( 'admin-ajax.php' ) ) - ); - } - public function Donate_Payping_Menu(){ - add_menu_page( __( 'افزونه حمایت مالی پی‌پینگ', 'textdomain' ), __( 'حمایت مالی پی‌پینگ', 'textdomain' ), 'read', 'PayPing-Donate', [$this, 'Donate_Payping_function'], 'dashicons-chart-bar', 7 ); - } - - public function register_Donate_PayPing_plugin_settings(){ - register_setting( 'Donate_PayPing-plugin-settings-group', 'Script' ); - register_setting( 'Donate_PayPing-plugin-settings-group', 'Pages' ); - register_setting( 'Donate_PayPing-plugin-settings-group', 'Pages_Ids' ); - } - public function Donate_Payping_function(){ ?> -
-

تنظیمات افزونه حمایت مالی پی‌پینگ

-
- -
-
-
-
- - - -

- - - - حمایت مالی -

-
-
- -

-

- مبلغ دلخواه خود را وارد کنید -

-
-


-
-
- -
-
- مرحله بعد -
-
- -
-
- wp_json_encode(array()), - 'timeout' => '45', - 'redirection' => '5', - 'httpsversion' => '1.0', - 'blocking' => true, - 'headers' => array( - 'Authorization' => 'Bearer ' . $TokenCode_Ajax, - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' ), - 'cookies' => array() - - ); - - $getUserInfo_url = 'https://oauth.payping.ir/connect/userinfo'; - $getUserInfo_response = wp_remote_post( $getUserInfo_url, $getUserInfo_args ); - if( is_wp_error( $getUserInfo_response ) ){ - echo sprintf('خطا در ارتباط به پی‌پینگ : شرح خطا %s%', esc_html($getUserInfo_response->get_error_message())); - }else{ - $code = wp_remote_retrieve_response_code( $getUserInfo_response ); - if( $code === 200 ){ - if ( isset( $getUserInfo_response["body"] ) and $getUserInfo_response["body"] != '' ) { - $userInfo = $getUserInfo_response["body"]; - echo wp_kses_post($userInfo); - exit; - }else{ - echo sprintf('کد خطا : %s%', esc_html($getUserInfo_response->get_error_message())); - } - }elseif( $code === 400){ - echo sprintf('%s% کد خطا: %s%', esc_html(wp_remote_retrieve_body( $response )), esc_html($getUserInfo_response->get_error_message() )); - }else{ - echo sprintf('%s% کد خطا: %s%', esc_html(wp_remote_retrieve_body( $response )), esc_html($getUserInfo_response->get_error_message() )); - } - } - } - die(); - } -} + admin_url( 'admin-ajax.php' ) ) + ); + } + public function Donate_Payping_Menu(){ + add_menu_page( __( 'افزونه حمایت مالی پی‌پینگ', 'textdomain' ), __( 'حمایت مالی پی‌پینگ', 'textdomain' ), 'read', 'PayPing-Donate', [$this, 'Donate_Payping_function'], 'dashicons-chart-bar', 7 ); + } + + public function register_Donate_PayPing_plugin_settings(){ + register_setting( 'Donate_PayPing-plugin-settings-group', 'Script' ); + register_setting( 'Donate_PayPing-plugin-settings-group', 'Pages' ); + register_setting( 'Donate_PayPing-plugin-settings-group', 'Pages_Ids' ); + } + public function Donate_Payping_function(){ ?> +
+

تنظیمات افزونه حمایت مالی پی‌پینگ

+
+ +
+
+
+
+ + + +

+ + + + حمایت مالی +

+
+
+ +

+

+ مبلغ دلخواه خود را وارد کنید +

+
+


+
+
+ +
+
+ مرحله بعد +
+
+ +
+
+ wp_json_encode(array()), + 'timeout' => '45', + 'redirection' => '5', + 'httpsversion' => '1.0', + 'blocking' => true, + 'headers' => array( + 'Authorization' => 'Bearer ' . $TokenCode_Ajax, + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' ), + 'cookies' => array() + + ); + + $getUserInfo_url = 'https://oauth.payping.ir/connect/userinfo'; + $getUserInfo_response = wp_remote_post( $getUserInfo_url, $getUserInfo_args ); + if( is_wp_error( $getUserInfo_response ) ){ + echo sprintf(esc_html('خطا در ارتباط به پی‌پینگ : شرح خطا %s%', $getUserInfo_response->get_error_message())); + }else{ + $code = wp_remote_retrieve_response_code( $getUserInfo_response ); + if( $code === 200 ){ + if ( isset( $getUserInfo_response["body"] ) and $getUserInfo_response["body"] != '' ) { + $userInfo = $getUserInfo_response["body"]; + echo wp_kses_post($userInfo); + exit; + }else{ + echo sprintf(esc_html('کد خطا : %s%', $getUserInfo_response->get_error_message())); + } + }elseif( $code === 400){ + echo sprintf(esc_html('%s% کد خطا: %s%', wp_remote_retrieve_body( $response ), $getUserInfo_response->get_error_message()) ); + }else{ + echo sprintf(esc_html('%s% کد خطا: %s%', wp_remote_retrieve_body( $response ), $getUserInfo_response->get_error_message()) ); + } + } + } + die(); + } +} new payping_donation(); \ No newline at end of file