33 Plugin Name: Payment forms for Paystack
44 Plugin URI: https://github.com/Kendysond/Wordpress-paystack-forms
55 Description: Payment forms for Paystack allows you create forms that will be used to bill clients for goods and services via Paystack.
6- Version: 2.0.1
6+ Version: 2.0.3
77 Author: Douglas Kendyson
88 Author URI: http://kendyson.com
99 License: GPL-2.0+
1515}
1616define ( 'KKD_PFF_PAYSTACK_PLUGIN_PATH ' , plugins_url ( __FILE__ ) );
1717define ( 'KKD_PFF_PAYSTACK_MAIN_FILE ' , __FILE__ );
18- define ( 'KKD_PFF_PAYSTACK_VERSION ' , '2.0.0 ' );
18+ define ( 'KKD_PFF_PAYSTACK_VERSION ' , '2.0.4 ' );
1919define ( 'KKD_PFF_PAYSTACK_TABLE ' , 'paystack_forms_payments ' );
2020
2121
@@ -149,22 +149,54 @@ function insertSelectCountries(){
149149 <?php
150150 }
151151}
152- add_action ( 'init ' , 'kkd_pff_paystack_invoice_url_rewrite ' );
153- function kkd_pff_paystack_invoice_url_rewrite (){
154- global $ wp_rewrite ;
155- $ plugin_url = plugins_url ( 'includes/paystack-invoice.php ' , __FILE__ );
156- $ plugin_url = substr ( $ plugin_url , strlen ( home_url () ) + 1 );
157- $ wp_rewrite ->non_wp_rules ['paystackinvoice$ ' ] = $ plugin_url ;
158- $ wp_rewrite ->non_wp_rules ['paystackinvoice/$ ' ] = $ plugin_url ;
159- file_put_contents (ABSPATH .'.htaccess ' , $ wp_rewrite ->mod_rewrite_rules () );
152+ // add_action( 'init', 'kkd_pff_paystack_invoice_url_rewrite' );
153+ // function kkd_pff_paystack_invoice_url_rewrite(){
154+ // global $wp_rewrite;
155+ // $plugin_url = plugins_url( 'includes/paystack-invoice.php', __FILE__ );
156+ // $plugin_url = substr( $plugin_url, strlen( home_url() ) + 1 );
157+ // $wp_rewrite->non_wp_rules['paystackinvoice$'] = $plugin_url; WP_PLUGIN_URL . '/data-fetcher/list-data.php'
158+ // $wp_rewrite->non_wp_rules['paystackinvoice/$'] = $plugin_url;
159+ // file_put_contents(ABSPATH.'.htaccess', $wp_rewrite->mod_rewrite_rules() );
160+ // }
161+ // add_action( 'init', 'my_rewrite' );
162+ // function my_rewrite() {
163+ // global $wp_rewrite;
164+ // add_rewrite_rule('paystackinvoice$', KKD_PFF_PAYSTACK_PLUGIN_PATH. 'includes/paystack-invoice.php', 'top');
165+ // add_rewrite_rule('paystackinvoice/$', KKD_PFF_PAYSTACK_PLUGIN_PATH. 'includes/paystack-invoice.php', 'top');
166+ // // add_rewrite_rule('paystackinvoice/$', plugins_url( 'includes/paystack-invoice.php', __FILE__ ), 'top');
167+ // $wp_rewrite->flush_rules(true); // This should really be done in a plugin activation
168+ // }
169+
170+ add_action ( 'init ' , 'kkd_pff_init ' );
171+ function kkd_pff_init () {
172+ add_rewrite_rule ( '^paystackinvoice$ ' , 'index.php?kkd_pff_stats=true ' , 'top ' );
160173}
161174
162- add_action ( 'init ' , 'kkd_pff_paystack_webhook_url_rewrite ' );
163- function kkd_pff_paystack_webhook_url_rewrite (){
164- global $ wp_rewrite ;
165- $ plugin_url = plugins_url ( 'includes/paystack-webhook.php ' , __FILE__ );
166- $ plugin_url = substr ( $ plugin_url , strlen ( home_url () ) + 1 );
167- $ wp_rewrite ->non_wp_rules ['kkd_wppf_webhoook$ ' ] = $ plugin_url ;
168- $ wp_rewrite ->non_wp_rules ['kkd_wppf_webhoook/$ ' ] = $ plugin_url ;
169- file_put_contents (ABSPATH .'.htaccess ' , $ wp_rewrite ->mod_rewrite_rules () );
170- }
175+ // But WordPress has a whitelist of variables it allows, so we must put it on that list
176+ add_action ( 'query_vars ' , 'kkd_pff_query_vars ' );
177+ function kkd_pff_query_vars ( $ query_vars )
178+ {
179+ $ query_vars [] = 'kkd_pff_stats ' ;
180+ return $ query_vars ;
181+ }
182+
183+ // If this is done, we can access it later
184+ // This example checks very early in the process:
185+ // if the variable is set, we include our page and stop execution after it
186+ add_action ( 'parse_request ' , 'kkd_pff_parse_request ' );
187+ function kkd_pff_parse_request ( &$ wp )
188+ {
189+ if ( array_key_exists ( 'kkd_pff_stats ' , $ wp ->query_vars ) ) {
190+ include ( dirname ( __FILE__ ) . '/includes/paystack-invoice.php ' );
191+ exit ();
192+ }
193+ }
194+ // add_action( 'init', 'kkd_pff_paystack_webhook_url_rewrite' );
195+ // function kkd_pff_paystack_webhook_url_rewrite(){
196+ // global $wp_rewrite;
197+ // $plugin_url = plugins_url( 'includes/paystack-webhook.php', __FILE__ );
198+ // $plugin_url = substr( $plugin_url, strlen( home_url() ) + 1 );
199+ // $wp_rewrite->non_wp_rules['kkd_wppf_webhoook$'] = $plugin_url;
200+ // $wp_rewrite->non_wp_rules['kkd_wppf_webhoook/$'] = $plugin_url;
201+ // file_put_contents(ABSPATH.'.htaccess', $wp_rewrite->mod_rewrite_rules() );
202+ // }
0 commit comments