@@ -8,40 +8,40 @@ public function __construct( $plugin_name, $version ) {
88
99 $ this ->plugin_name = $ plugin_name ;
1010 $ this ->version = $ version ;
11- add_action ('admin_menu ' , 'add_settings_page ' );
12- add_action ( 'admin_init ' , 'register_paystack_setting_page ' );
11+ add_action ('admin_menu ' , 'kkd_pff_paystack_add_settings_page ' );
12+ add_action ( 'admin_init ' , 'kkd_pff_paystack_register_setting_page ' );
1313
14- function add_settings_page () {
15- add_submenu_page ('edit.php?post_type=paystack_form ' , 'Api Keys Settings ' , 'Api Keys Settings ' , 'edit_posts ' , basename (__FILE__ ), 'paystack_setting_page ' );
14+ function kkd_pff_paystack_add_settings_page () {
15+ add_submenu_page ('edit.php?post_type=paystack_form ' , 'Api Keys Settings ' , 'Api Keys Settings ' , 'edit_posts ' , basename (__FILE__ ), 'kkd_pff_paystack_setting_page ' );
1616 }
17- function register_paystack_setting_page () {
18- register_setting ( 'paystack-form -settings-group ' , 'mode ' );
19- register_setting ( 'paystack-form -settings-group ' , 'tsk ' );
20- register_setting ( 'paystack-form -settings-group ' , 'tpk ' );
21- register_setting ( 'paystack-form -settings-group ' , 'lsk ' );
22- register_setting ( 'paystack-form -settings-group ' , 'lpk ' );
17+ function kkd_pff_paystack_register_setting_page () {
18+ register_setting ( 'kkd-pff-paystack -settings-group ' , 'mode ' );
19+ register_setting ( 'kkd-pff-paystack -settings-group ' , 'tsk ' );
20+ register_setting ( 'kkd-pff-paystack -settings-group ' , 'tpk ' );
21+ register_setting ( 'kkd-pff-paystack -settings-group ' , 'lsk ' );
22+ register_setting ( 'kkd-pff-paystack -settings-group ' , 'lpk ' );
2323 }
24- function txncheck ($ name ,$ txncharge ){
24+ function kkd_pff_paystack_txncheck ($ name ,$ txncharge ){
2525 if ($ name == $ txncharge ) {
2626 $ result = "selected " ;
2727 }else {
2828 $ result = "" ;
2929 }
3030 return $ result ;
3131 }
32- function paystack_setting_page () {
32+ function kkd_pff_paystack_setting_page () {
3333 ?>
3434 <h1>Paystack Forms API KEYS Settings!</h1>
3535 <form method="post" action="options.php">
36- <?php settings_fields ( 'paystack-form- settings-group ' ); do_settings_sections ( 'paystack-form -settings-group ' ); ?>
36+ <?php settings_fields ( 'kkd-pff-paystack- settings-group ' ); do_settings_sections ( 'kkd-pff-paystack -settings-group ' ); ?>
3737 <table class="form-table paystack_setting_page">
3838 <tr valign="top">
3939 <th scope="row">Mode</th>
4040
4141 <td>
4242 <select class="form-control" name="mode" id="parent_id">
43- <option value="live" <?php echo txncheck ('live ' ,esc_attr ( get_option ('mode ' ) )) ?> >Live Mode</option>
44- <option value="test" <?php echo txncheck ('test ' ,esc_attr ( get_option ('mode ' ) )) ?> >Test Mode</option>
43+ <option value="live" <?php echo kkd_pff_paystack_txncheck ('live ' ,esc_attr ( get_option ('mode ' ) )) ?> >Live Mode</option>
44+ <option value="test" <?php echo kkd_pff_paystack_txncheck ('test ' ,esc_attr ( get_option ('mode ' ) )) ?> >Test Mode</option>
4545 </select>
4646 </tr>
4747 <tr valign="top">
@@ -71,8 +71,8 @@ function paystack_setting_page() {
7171 </form>
7272 <?php
7373 }
74- add_action ( 'init ' , 'register_cpt_paystack_form ' );
75- function register_cpt_paystack_form () {
74+ add_action ( 'init ' , 'register_kkd_pff_paystack ' );
75+ function register_kkd_pff_paystack () {
7676
7777 $ labels = array (
7878 'name ' => _x ( 'Paystack Forms ' , 'paystack_form ' ),
@@ -111,9 +111,9 @@ function register_cpt_paystack_form() {
111111 );
112112 register_post_type ( 'paystack_form ' , $ args );
113113 }
114- add_filter ('user_can_richedit ' , 'disable_wyswyg_for_custom_post_type ' );
114+ add_filter ('user_can_richedit ' , 'kkd_pff_paystack_disable_wyswyg ' );
115115
116- function pform_add_action_button ($ actions , $ post ){
116+ function kkd_pff_paystack_add_view_payments ($ actions , $ post ){
117117
118118 if (get_post_type () === 'paystack_form ' ){
119119 unset($ actions ['view ' ]);
@@ -128,30 +128,30 @@ function pform_add_action_button($actions, $post){
128128 }
129129 return $ actions ;
130130 }
131- add_filter ( 'page_row_actions ' , 'pform_add_action_button ' , 10 , 2 );
131+ add_filter ( 'page_row_actions ' , 'kkd_pff_paystack_add_view_payments ' , 10 , 2 );
132132
133133
134- function wpa_47010 ( $ qtInit ) {
134+ function kkd_pff_paystack_remove_fullscreen ( $ qtInit ) {
135135 $ qtInit ['buttons ' ] = 'fullscreen ' ;
136136 return $ qtInit ;
137137 }
138- function disable_wyswyg_for_custom_post_type ( $ default ){
138+ function kkd_pff_paystack_disable_wyswyg ( $ default ){
139139 global $ post_type , $ _wp_theme_features ;;
140140
141141
142142 if ($ post_type == 'paystack_form ' ) {
143143 echo "<style>#edit-slug-box,#message p > a{display:none;}</style> " ;
144144 add_action ("admin_print_footer_scripts " , "kkd_pff_paystack_shortcode_button_script " );
145145 add_filter ( 'user_can_richedit ' , '__return_false ' , 50 );
146- add_action ( 'wp_dashboard_setup ' , 'remove_dashboard_widgets ' );
146+ add_action ( 'wp_dashboard_setup ' , 'kkd_pff_paystack_remove_dashboard_widgets ' );
147147 remove_action ( 'media_buttons ' , 'media_buttons ' );
148148 remove_meta_box ( 'postimagediv ' ,'post ' ,'side ' );
149- add_filter ('quicktags_settings ' , 'wpa_47010 ' );
149+ add_filter ('quicktags_settings ' , 'kkd_pff_paystack_remove_fullscreen ' );
150150 }
151151
152152 return $ default ;
153153 }
154- function remove_dashboard_widgets () {
154+ function kkd_pff_paystack_remove_dashboard_widgets () {
155155 remove_meta_box ( 'dashboard_right_now ' , 'dashboard ' , 'normal ' ); // Right Now
156156 remove_meta_box ( 'dashboard_recent_comments ' , 'dashboard ' , 'normal ' ); // Recent Comments
157157 remove_meta_box ( 'dashboard_incoming_links ' , 'dashboard ' , 'normal ' ); // Incoming Links
@@ -162,9 +162,9 @@ function remove_dashboard_widgets() {
162162 remove_meta_box ( 'dashboard_secondary ' , 'dashboard ' , 'side ' ); // Other WordPress News
163163 // use 'dashboard-network' as the second parameter to remove widgets from a network dashboard.
164164 }
165- add_filter ( 'manage_edit-paystack_form_columns ' , 'my_edit_paystack_form_columns ' ) ;
165+ add_filter ( 'manage_edit-paystack_form_columns ' , 'kkd_pff_paystack_edit_dashboard_header_columns ' ) ;
166166
167- function my_edit_paystack_form_columns ( $ columns ) {
167+ function kkd_pff_paystack_edit_dashboard_header_columns ( $ columns ) {
168168
169169 $ columns = array (
170170 'cb ' => '<input type="checkbox" /> ' ,
@@ -176,16 +176,16 @@ function my_edit_paystack_form_columns( $columns ) {
176176
177177 return $ columns ;
178178 }
179- add_action ( 'manage_paystack_form_posts_custom_column ' , 'my_paystack_form_columns ' , 10 , 2 );
179+ add_action ( 'manage_paystack_form_posts_custom_column ' , 'kkd_pff_paystack_dashboard_table_data ' , 10 , 2 );
180180
181- function my_paystack_form_columns ( $ column , $ post_id ) {
181+ function kkd_pff_paystack_dashboard_table_data ( $ column , $ post_id ) {
182182 global $ post ,$ wpdb ;
183183 $ table = $ wpdb ->prefix . 'paystack_forms_payments ' ;
184184
185185 switch ( $ column ) {
186186 case 'shortcode ' :
187187 echo '<span class="shortcode">
188- <input type="text" class="large-text code" value="[paystack_form id=" ' .$ post_id .'"]"
188+ <input type="text" class="large-text code" value="[pff-paystack id=" ' .$ post_id .'"]"
189189 readonly="readonly" onfocus="this.select();"></span> ' ;
190190
191191 break ;
@@ -200,9 +200,9 @@ function my_paystack_form_columns( $column, $post_id ) {
200200 break ;
201201 }
202202 }
203- add_filter ( 'default_content ' , 'my_editor_content ' , 10 , 2 );
203+ add_filter ( 'default_content ' , 'kkd_pff_paystack_editor_content ' , 10 , 2 );
204204
205- function my_editor_content ( $ content , $ post ) {
205+ function kkd_pff_paystack_editor_content ( $ content , $ post ) {
206206
207207 switch ( $ post ->post_type ) {
208208 case 'paystack_form ' :
@@ -216,25 +216,25 @@ function my_editor_content( $content, $post ) {
216216 return $ content ;
217217 }
218218 /////
219- function help_metabox ( $ post ) {
219+ function kkd_pff_paystack_editor_help_metabox ( $ post ) {
220220
221221 do_meta_boxes ( null , 'custom-metabox-holder ' , $ post );
222222 }
223- add_action ( 'edit_form_after_title ' , 'help_metabox ' );
224- function add_help_metabox () {
223+ add_action ( 'edit_form_after_title ' , 'kkd_pff_paystack_editor_help_metabox ' );
224+ function kkd_pff_paystack_editor_add_help_metabox () {
225225
226226 add_meta_box (
227227 'awesome_metabox_id ' ,
228228 'Help Section ' ,
229- 'help_metabox_details ' ,
229+ 'kkd_pff_paystack_editor_help_metabox_details ' ,
230230 'paystack_form ' ,
231231 'custom-metabox-holder ' //Look what we have here, a new context
232232 );
233233
234234 }
235- add_action ( 'add_meta_boxes ' , 'add_help_metabox ' );
235+ add_action ( 'add_meta_boxes ' , 'kkd_pff_paystack_editor_add_help_metabox ' );
236236
237- function help_metabox_details ( $ post ) {
237+ function kkd_pff_paystack_editor_help_metabox_details ( $ post ) {
238238 echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value=" ' .
239239 wp_create_nonce ( plugin_basename (__FILE__ ) ) . '" /> ' ;
240240
@@ -252,17 +252,17 @@ function help_metabox_details( $post ) {
252252 <?php
253253 }
254254
255- add_action ( 'add_meta_boxes ' , 'add_extra_metaboxes ' );
256- function add_extra_metaboxes () {
255+ add_action ( 'add_meta_boxes ' , 'kkd_pff_paystack_editor_add_extra_metaboxes ' );
256+ function kkd_pff_paystack_editor_add_extra_metaboxes () {
257257
258- add_meta_box ('wpt_form_data ' , 'Extra Form Description ' , 'wpt_form_data ' , 'paystack_form ' , 'normal ' , 'default ' );
259- add_meta_box ('wpt_recur_data ' , 'Recurring Payment ' , 'wpt_recur_data ' , 'paystack_form ' , 'side ' , 'default ' );
260- add_meta_box ('wpt_email_data ' , 'Email Receipt Settings ' , 'wpt_email_data ' , 'paystack_form ' , 'normal ' , 'default ' );
258+ add_meta_box ('kkd_pff_paystack_editor_add_form_data ' , 'Extra Form Description ' , 'kkd_pff_paystack_editor_add_form_data ' , 'paystack_form ' , 'normal ' , 'default ' );
259+ add_meta_box ('kkd_pff_paystack_editor_add_recur_data ' , 'Recurring Payment ' , 'kkd_pff_paystack_editor_add_recur_data ' , 'paystack_form ' , 'side ' , 'default ' );
260+ add_meta_box ('kkd_pff_paystack_editor_add_email_data ' , 'Email Receipt Settings ' , 'kkd_pff_paystack_editor_add_email_data ' , 'paystack_form ' , 'normal ' , 'default ' );
261261
262262 }
263263
264264
265- function wpt_form_data () {
265+ function kkd_pff_paystack_editor_add_form_data () {
266266 global $ post ;
267267
268268 // Noncename needed to verify where the data originated
@@ -292,22 +292,22 @@ function wpt_form_data() {
292292 echo '<p>Pay button Description:</p> ' ;
293293 echo '<input type="text" name="_paybtn" value=" ' . $ paybtn . '" class="widefat" /> ' ;
294294 echo '<p>Transaction Charges:</p> ' ;
295- echo '<select class="form-control" name="_txncharge" id="parent_id" style="width:100%;">
296- <option value="merchant" ' .txncheck ('merchant ' ,$ txncharge ).'>Merchant Pays(Include in fee)</option>
297- <option value="customer" ' .txncheck ('customer ' ,$ txncharge ).'>Client Pays(Extra Fee added)</option>
298- </select> ' ;
295+ // echo '<select class="form-control" name="_txncharge" id="parent_id" style="width:100%;">
296+ // <option value="merchant"'.kkd_pff_paystack_txncheck ('merchant',$txncharge).'>Merchant Pays(Include in fee)</option>
297+ // <option value="customer" '.kkd_pff_paystack_txncheck ('customer',$txncharge).'>Client Pays(Extra Fee added)</option>
298+ // </select>';
299299 echo '<p>User logged In:</p> ' ;
300300 echo '<select class="form-control" name="_loggedin" id="parent_id" style="width:100%;">
301- <option value="no" ' .txncheck ('no ' ,$ loggedin ).'>User must not be logged in</option>
302- <option value="yes" ' .txncheck ('yes ' ,$ loggedin ).'>User must be logged In</option>
301+ <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ loggedin ).'>User must not be logged in</option>
302+ <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' ,$ loggedin ).'>User must be logged In</option>
303303 </select> ' ;
304304 echo '<p>Success Message after Payment</p> ' ;
305305 echo '<textarea rows="3" name="_successmsg" class="widefat" > ' .$ successmsg .'</textarea> ' ;
306306 echo '<p>File Upload Limit(MB):</p> ' ;
307307 echo '<input ttype="number" name="_filelimit" value=" ' . $ filelimit . '" class="widefat pf-number" /> ' ;
308308
309309 }
310- function wpt_email_data () {
310+ function kkd_pff_paystack_editor_add_email_data () {
311311 global $ post ;
312312
313313 // Noncename needed to verify where the data originated
@@ -327,8 +327,8 @@ function wpt_email_data() {
327327 // Echo out the field
328328 echo '<p>Send Email Receipt:</p> ' ;
329329 echo '<select class="form-control" name="_sendreceipt" id="parent_id" style="width:100%;">
330- <option value="no" ' .txncheck ('no ' ,$ sendreceipt ).'>Don \'t send</option>
331- <option value="yes" ' .txncheck ('yes ' ,$ sendreceipt ).'>Send</option>
330+ <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ sendreceipt ).'>Don \'t send</option>
331+ <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' ,$ sendreceipt ).'>Send</option>
332332 </select> ' ;
333333 echo '<p>Email Subject:</p> ' ;
334334 echo '<input type="text" name="_subject" value=" ' . $ subject . '" class="widefat" /> ' ;
@@ -338,7 +338,7 @@ function wpt_email_data() {
338338 echo '<textarea rows="6" name="_message" class="widefat" > ' .$ message .'</textarea> ' ;
339339
340340 }
341- function wpt_recur_data () {
341+ function kkd_pff_paystack_editor_add_recur_data () {
342342 global $ post ;
343343
344344 // Noncename needed to verify where the data originated
@@ -354,16 +354,16 @@ function wpt_recur_data() {
354354 // Echo out the field
355355 echo '<p>Reccuring Payment:</p> ' ;
356356 echo '<select class="form-control" name="_recur" style="width:100%;">
357- <option value="no" ' .txncheck ('no ' ,$ recur ).'>None</option>
358- <option value="optional" ' .txncheck ('optional ' ,$ recur ).'>Optional Recurring</option>
359- <option value="plan" ' .txncheck ('plan ' ,$ recur ).'>Paystack Plan</option>
357+ <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ recur ).'>None</option>
358+ <option value="optional" ' .kkd_pff_paystack_txncheck ('optional ' ,$ recur ).'>Optional Recurring</option>
359+ <option value="plan" ' .kkd_pff_paystack_txncheck ('plan ' ,$ recur ).'>Paystack Plan</option>
360360 </select> ' ;
361361 echo '<p>Paystack Recur Plan code:</p> ' ;
362362 echo '<input type="text" name="_recurplan" value=" ' . $ recurplan . '" class="widefat" />
363363 <small>Plan amount must match amount on extra form description.</small> ' ;
364364
365365 }
366- function wpt_form_data_meta ($ post_id , $ post ) {
366+ function kkd_pff_paystack_save_data ($ post_id , $ post ) {
367367
368368 if ( !wp_verify_nonce ( @$ _POST ['eventmeta_noncename ' ], plugin_basename (__FILE__ ) )) {
369369 return $ post ->ID ;
@@ -404,7 +404,7 @@ function wpt_form_data_meta($post_id, $post) {
404404 }
405405
406406 }
407- add_action ('save_post ' , 'wpt_form_data_meta ' , 1 , 2 );
407+ add_action ('save_post ' , 'kkd_pff_paystack_save_data ' , 1 , 2 );
408408
409409
410410
@@ -413,47 +413,23 @@ function wpt_form_data_meta($post_id, $post) {
413413
414414 public function enqueue_styles () {
415415
416- /**
417- * This function is provided for demonstration purposes only.
418- *
419- * An instance of this class should be passed to the run() function
420- * defined in Paystack_Forms_Loader as all of the hooks are defined
421- * in that particular class.
422- *
423- * The Paystack_Forms_Loader will then create the relationship
424- * between the defined hooks and the functions defined in this
425- * class.
426- */
427-
428416 wp_enqueue_style ( $ this ->plugin_name , plugin_dir_url ( __FILE__ ) . 'css/paystack-forms-admin.css ' , array (), $ this ->version , 'all ' );
429417
430418 }
431419 public function enqueue_scripts () {
432420
433- /**
434- * This function is provided for demonstration purposes only.
435- *
436- * An instance of this class should be passed to the run() function
437- * defined in Paystack_Forms_Loader as all of the hooks are defined
438- * in that particular class.
439- *
440- * The Paystack_Forms_Loader will then create the relationship
441- * between the defined hooks and the functions defined in this
442- * class.
443- */
444-
445421 wp_enqueue_script ( $ this ->plugin_name , plugin_dir_url ( __FILE__ ) . 'js/paystack-forms-admin.js ' , array ( 'jquery ' ), $ this ->version , false );
446422
447423 }
448424
449425}
450426
451- add_action ( 'admin_menu ' , 'register_newpage ' );
452- function register_newpage (){
453- add_menu_page ('paystack ' , 'paystack ' , 'administrator ' ,'submissions ' , 'payment_submissions ' );
427+ add_action ( 'admin_menu ' , 'kkd_pff_paystack_register_newpage ' );
428+ function kkd_pff_paystack_register_newpage (){
429+ add_menu_page ('paystack ' , 'paystack ' , 'administrator ' ,'submissions ' , 'kkd_pff_paystack_payment_submissions ' );
454430 remove_menu_page ('submissions ' );
455431}
456- function payment_submissions (){
432+ function kkd_pff_paystack_payment_submissions (){
457433 $ id = $ _GET ['form ' ];
458434 $ obj = get_post ($ id );
459435 if ($ obj ->post_type == 'paystack_form ' ) {
@@ -464,7 +440,7 @@ function payment_submissions(){
464440 $ txncharge = get_post_meta ($ id ,'_txncharge ' ,true );
465441
466442 echo "<h1> " .$ obj ->post_title ." Payments</h1> " ;
467- $ exampleListTable = new Payments_List_Table ();
443+ $ exampleListTable = new Kkd_Pff_Paystack_Payments_List_Table ();
468444 $ exampleListTable ->prepare_items ();
469445 ?>
470446 <div class="wrap">
@@ -475,7 +451,7 @@ function payment_submissions(){
475451
476452 }
477453}
478- class Paystack_Wp_List_Table {
454+ class Kkd_Pff_Paystack_Wp_List_Table {
479455 public function __construct (){
480456 add_action ( 'admin_menu ' , array ($ this , 'add_menu_example_list_table_page ' ));
481457 }
@@ -522,7 +498,7 @@ function format_data($data){
522498 return $ text ;
523499}
524500
525- class Payments_List_Table extends WP_List_Table{
501+ class Kkd_Pff_Paystack_Payments_List_Table extends WP_List_Table{
526502 public function prepare_items (){
527503 $ post_id = $ _GET ['form ' ];
528504 $ currency = get_post_meta ($ post_id ,'_currency ' ,true );
0 commit comments