| 1 | <?php |
|---|
| 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | function NEXForms_entries_page(){ |
|---|
| 6 | global $wpdb; |
|---|
| 7 | $theme = wp_get_theme(); |
|---|
| 8 | $output = ''; |
|---|
| 9 | |
|---|
| 10 | $nf_function = new NEXForms_functions(); |
|---|
| 11 | |
|---|
| 12 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 13 | |
|---|
| 14 | $dashboard = new NEXForms_dashboard(); |
|---|
| 15 | $dashboard->dashboard_checkout(); |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | $count_entries = $wpdb->get_results('SELECT nex_forms_Id, COUNT(nex_forms_Id) as counted FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE trashed IS NULL GROUP BY nex_forms_Id;'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 20 | foreach($count_entries as $entry) |
|---|
| 21 | { |
|---|
| 22 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms', array('entry_count'=>$entry->counted), array('Id' => $entry->nex_forms_Id) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | $entries = new NEXForms_dashboard(); |
|---|
| 28 | //$entries->action = 'print_entries'; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | $entries->table = 'wap_nex_forms_entries'; |
|---|
| 35 | $entries->table_resize = true; |
|---|
| 36 | $entries->table_header = '<span class="fas fa-filter"></span> Filters:'; |
|---|
| 37 | $entries->extra_buttons = array( |
|---|
| 38 | 'unread' =>array('class'=>'filter_unread filter_button', 'id'=>'filter_unread', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-eye-slash"></span> '.__(' Unread','nex-forms').''), |
|---|
| 39 | 'starred' =>array('class'=>'filter_starred filter_button', 'id'=>'filter_starred', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-star"></span> '.__(' Starred','nex-forms').''), |
|---|
| 40 | 'attachments' =>array('class'=>'filter_attachments filter_button', 'id'=>'filter_attachments', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-paperclip"></span> '.__(' Attachment','nex-forms').'') |
|---|
| 41 | //'read' =>array('class'=>'filter_read filter_button', 'id'=>'filter_read', 'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-eye"></span> '.__(' Read','nex-forms').''), |
|---|
| 42 | ); |
|---|
| 43 | $entries->table_header_icon = 'assignment'; |
|---|
| 44 | $entries->additional_params = array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 45 | $entries->table_headings = array( |
|---|
| 46 | 'Id', |
|---|
| 47 | array('icon'=>'fas fa-star', 'user_func'=>'NEXForms_starred','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom starred','sort_by'=>'starred'), |
|---|
| 48 | array('icon'=>'fas fa-paperclip', 'user_func'=>'NEXForms_get_attachment','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_files', 'set_class'=>'custom read', 'sort_by'=>'attachments'), |
|---|
| 49 | array('icon'=>'fas fa-glasses', 'user_func'=>'NEXForms_entry_status','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom read','sort_by'=>'viewed'), |
|---|
| 50 | //'title', |
|---|
| 51 | array('heading'=> __('Form','nex-forms'), 'user_func'=>'NEXForms_get_title3','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms','sort_by'=>'nex_forms_Id'), |
|---|
| 52 | 'page', |
|---|
| 53 | array('heading'=>__('Submitted','nex-forms'), 'user_func'=>'NEXForms_time_elapsed_string','user_func_args_1'=>'date_time', 'user_func_args_2'=>'wap_nex_forms', 'sort_by'=>'date_time'), |
|---|
| 54 | 'date_time', |
|---|
| 55 | ); |
|---|
| 56 | $entries->show_headings=true; |
|---|
| 57 | $entries->search_params = array('Id','form_data'); |
|---|
| 58 | $entries->color_adapt = true; |
|---|
| 59 | $entries->checkout = $dashboard->checkout; |
|---|
| 60 | $entries->record_limit = 100; |
|---|
| 61 | $entries->show_delete = false; |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | /*$file_uploads = new NEXForms_dashboard(); |
|---|
| 67 | $file_uploads->table = 'wap_nex_forms_files'; |
|---|
| 68 | $file_uploads->table_header = 'Form Entries'; |
|---|
| 69 | $file_uploads->table_header_icon = 'insert_drive_file'; |
|---|
| 70 | $file_uploads->table_headings = array('entry_Id', array('heading'=>__('Form','nex-forms'), 'user_func'=>'NEXForms_get_title','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'), 'name','type','size','url'); |
|---|
| 71 | $file_uploads->show_headings=true; |
|---|
| 72 | $file_uploads->extra_classes = 'file_manager'; |
|---|
| 73 | $file_uploads->search_params = array('entry_Id','name','type'); |
|---|
| 74 | //$file_uploads->build_table_dropdown = 'form_id'; |
|---|
| 75 | $file_uploads->checkout = $dashboard->checkout; |
|---|
| 76 | $file_uploads->show_delete = true;*/ |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | $output .= '<div class="hidden" style="display:none;">'; |
|---|
| 80 | $output .= $dashboard->dashboard_menu('Form Entries'); |
|---|
| 81 | $output .= '</div>'; |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | $output .= '<div class="admin_url" style="display:none;">'.admin_url().'</div>'; |
|---|
| 85 | |
|---|
| 86 | $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' ); |
|---|
| 87 | $output .= '<div id="nex_forms_wpnonce" style="display:none;">'.$nonce_url.'</div>'; |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | $output .= '<div class="nf_context_menu nf_context_menu_2 aa_menu aa_bg_main"> |
|---|
| 91 | |
|---|
| 92 | <ul class="aa_menu"> |
|---|
| 93 | <li class="cm-action-item mark-read" data-action="mark-read"><a href="#" class="cm-item-text"><span class="fas fa-eye"></span>Mark as read</span><span class="kbsc"></span></a></li> |
|---|
| 94 | <li class="cm-action-item mark-unread" data-action="mark-unread"><a href="#" class="cm-item-text"><span class="fas fa-eye-slash"></span>Mark as unread</span><span class="kbsc"></span></a></li> |
|---|
| 95 | <li class="sec_divider"></li> |
|---|
| 96 | <li class="cm-action-item" data-action="add-star"><a href="#" class="cm-item-text"><span class="fas fa-star"></span> Add Star</span><span class="kbsc"></span></a></li> |
|---|
| 97 | <li class="cm-action-item" data-action="remove-star"><a href="#" class="cm-item-text"><span class="far fa-star"></span> remove Star</span><span class="kbsc"></span></a></li> |
|---|
| 98 | |
|---|
| 99 | <li class="sec_divider restore_record" tyle="display:none;"></li> |
|---|
| 100 | <li class="cm-action-item restore_record" data-action="restore" style="display:none;"><a href="#" class="cm-item-text"><span class="fas fa-trash-restore"></span> Restore</span><span class="kbsc"></span></a></li> |
|---|
| 101 | <li class="sec_divider"></li> |
|---|
| 102 | <li class="cm-action-item" data-action="delete"><a href="#" class="cm-item-text"><span class="fas fa-trash"></span> Delete</span><span class="kbsc">Delete</span></a></li> |
|---|
| 103 | <ul> |
|---|
| 104 | </div>'; |
|---|
| 105 | |
|---|
| 106 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | $output .= $dashboard->new_menu(); |
|---|
| 117 | |
|---|
| 118 | $output .= '<div id="nex_forms_entries" class="nex_forms_entries">'; |
|---|
| 119 | |
|---|
| 120 | $output .= '<div class="entries_wrapper">'; |
|---|
| 121 | |
|---|
| 122 | $output .= '<div class="left-col aa_bg_main">'; |
|---|
| 123 | |
|---|
| 124 | $output .= $dashboard->entries_menu(); |
|---|
| 125 | |
|---|
| 126 | $output .= '</div>'; |
|---|
| 127 | |
|---|
| 128 | $output .= '<div class="right-col">'; |
|---|
| 129 | $output .= '<div class="right-col-top">'; |
|---|
| 130 | $output .= $entries->print_record_table(); |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | $output .= '</div>'; |
|---|
| 135 | $output .= '<div class="right-mid">'; |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | $output .= '<div class="entry_tools aa_bg_main">'; |
|---|
| 140 | |
|---|
| 141 | $output .= '<button type="submit" class="save_form_entry save_button button button-primary" style="display:none;">'.__('Save','nex-forms').'</button>'; |
|---|
| 142 | $output .= '<button class="cancel_save_form_entry save_button button button-primary" style="display:none;"><i class="fa fa-close"></i></button>'; |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | $output .= '<div class="entry_views">'; |
|---|
| 146 | |
|---|
| 147 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch view_form_data active" data-action="view-data" disabled="disabled"><span class="fas fa-database"></span> '.__('Entry Data','nex-forms').'</button>'; |
|---|
| 148 | if($dashboard->checkout){ |
|---|
| 149 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-admin-email" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>'; |
|---|
| 150 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-user-email" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>'; |
|---|
| 151 | } |
|---|
| 152 | else |
|---|
| 153 | { |
|---|
| 154 | $output .= '<button class="nf_button aa_bg_main_btn no_batch" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>'; |
|---|
| 155 | $output .= '<button class="nf_button aa_bg_main_btn no_batch" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>'; |
|---|
| 156 | } |
|---|
| 157 | $output .= '</div>'; |
|---|
| 158 | |
|---|
| 159 | $output .= '<div class="entry_actions">'; |
|---|
| 160 | $output .= '<button class="print_to_pdf aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'</button>'; |
|---|
| 161 | //$output .= '<button class="button no_batch do_action" data-action="print-form-entry" disabled="disabled"><span class="fas fa-print"></span> '.__('Print','nex-forms').'</button>'; |
|---|
| 162 | $output .= '<button id="" class="edit_form_entry aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-pen-square"></span> '.__('Edit','nex-forms').'</button>'; |
|---|
| 163 | $output .= '<button class="nf_button aa_bg_main_btn do_action" data-action="delete" disabled="disabled"><span class="fas fa-trash"></span> '.__('Delete','nex-forms').'</button>'; |
|---|
| 164 | $output .= '</div>'; |
|---|
| 165 | |
|---|
| 166 | $output .= '</div>'; |
|---|
| 167 | |
|---|
| 168 | $output .= '</div>'; |
|---|
| 169 | $output .= '<div class="right-bottom">'; |
|---|
| 170 | $output .= $entries->print_form_entry(); |
|---|
| 171 | $output .= '</div>'; |
|---|
| 172 | |
|---|
| 173 | $output .= '</div>'; |
|---|
| 174 | |
|---|
| 175 | $output .= '</div>'; |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | // |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | // |
|---|
| 182 | $output .= '</div>'; |
|---|
| 183 | $output .= '</div>'; |
|---|
| 184 | NEXForms_clean_echo( $output); |
|---|
| 185 | |
|---|
| 186 | $dashboard->remove_unwanted_styles(); |
|---|
| 187 | if(!get_option('7103891')) |
|---|
| 188 | { |
|---|
| 189 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 190 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 191 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 192 | } |
|---|
| 193 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | function NEXForms_stats_page(){ |
|---|
| 197 | global $wpdb; |
|---|
| 198 | $theme = wp_get_theme(); |
|---|
| 199 | $nf_function = new NEXForms_functions(); |
|---|
| 200 | $dashboard = new NEXForms_dashboard(); |
|---|
| 201 | $dashboard->dashboard_checkout(); |
|---|
| 202 | $dashboard->color_adapt = true; |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | $output = ''; |
|---|
| 206 | $output .= '<div class="hidden">'; |
|---|
| 207 | $output .= $dashboard->dashboard_menu('Form Analytics'); |
|---|
| 208 | $output .= '</div>'; |
|---|
| 209 | if(!$dashboard->checkout) |
|---|
| 210 | { |
|---|
| 211 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 212 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 213 | |
|---|
| 214 | $output .= '<div class="col-sm-5">'; |
|---|
| 215 | $output .= $dashboard->license_setup(); |
|---|
| 216 | $output .= '</div>'; |
|---|
| 217 | $output .= '</div>'; |
|---|
| 218 | $output .= '</div>'; |
|---|
| 219 | $output .= '</div>'; |
|---|
| 220 | |
|---|
| 221 | NEXForms_clean_echo( $output); |
|---|
| 222 | return; |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 226 | $output .= $dashboard->new_menu(); |
|---|
| 227 | |
|---|
| 228 | $output .= '<div id="nex_forms_entries" class="nex_forms_entries submission_reporting analytics">'; |
|---|
| 229 | |
|---|
| 230 | $output .= '<div class="entries_wrapper">'; |
|---|
| 231 | |
|---|
| 232 | $output .= '<div class="left-col aa_bg_main">'; |
|---|
| 233 | |
|---|
| 234 | $output .= $dashboard->analytics_menu(); |
|---|
| 235 | |
|---|
| 236 | $output .= '</div>'; |
|---|
| 237 | |
|---|
| 238 | $output .= '<div class="right-col">'; |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | $output .= '<div class="hidden">'; |
|---|
| 242 | $output .= '<div id="siteurl">'.get_option('siteurl').'</div>'; |
|---|
| 243 | $output .= '<div id="nf_dashboard_load">0</div>'; |
|---|
| 244 | $output .= '<div id="plugins_url">'.plugins_url('/',__FILE__).'</div>'; |
|---|
| 245 | $output .= '<div id="load_entry">'.$dashboard->checkout.'</div>'; |
|---|
| 246 | $output .= '</div>'; |
|---|
| 247 | |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | $output .= '<div class="form_analytics_panel">'; |
|---|
| 251 | |
|---|
| 252 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | $output .= '<div class="col-sm-9">'; |
|---|
| 256 | $output .= $dashboard->form_analytics(); |
|---|
| 257 | $output .= '</div>'; |
|---|
| 258 | |
|---|
| 259 | |
|---|
| 260 | $output .= '</div>'; |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | $output .= '</div>'; |
|---|
| 265 | |
|---|
| 266 | $output .= '</div>'; |
|---|
| 267 | $output .= '</div>'; |
|---|
| 268 | $output .= '</div>'; //nex_forms_admin_page_wrapper |
|---|
| 269 | $output .= '</div>'; |
|---|
| 270 | NEXForms_clean_echo( $output); |
|---|
| 271 | |
|---|
| 272 | if(!get_option('7103891')) |
|---|
| 273 | { |
|---|
| 274 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 275 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 276 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 277 | } |
|---|
| 278 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 279 | } |
|---|
| 280 | |
|---|
| 281 | function NEXForms_reporting_page(){ |
|---|
| 282 | global $wpdb; |
|---|
| 283 | $theme = wp_get_theme(); |
|---|
| 284 | |
|---|
| 285 | $nf_function = new NEXForms_functions(); |
|---|
| 286 | $dashboard = new NEXForms_dashboard(); |
|---|
| 287 | $dashboard->dashboard_checkout(); |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | $output = ''; |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | $output .= '<div class="hidden">'; |
|---|
| 294 | $output .= $dashboard->dashboard_menu('Submission Reporting'); |
|---|
| 295 | $output .= '</div>'; |
|---|
| 296 | if(!$dashboard->checkout) |
|---|
| 297 | { |
|---|
| 298 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 299 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 300 | |
|---|
| 301 | $output .= '<div class="col-sm-5">'; |
|---|
| 302 | $output .= $dashboard->license_setup(); |
|---|
| 303 | $output .= '</div>'; |
|---|
| 304 | $output .= '</div>'; |
|---|
| 305 | $output .= '</div>'; |
|---|
| 306 | $output .= '</div>'; |
|---|
| 307 | |
|---|
| 308 | NEXForms_clean_echo( $output); |
|---|
| 309 | return; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 313 | $output .= $dashboard->new_menu(); |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | $output .= '<div id="nex_forms_entries" class="nex_forms_entries submission_reporting">'; |
|---|
| 317 | |
|---|
| 318 | $output .= '<div class="entries_wrapper">'; |
|---|
| 319 | |
|---|
| 320 | $output .= '<div class="left-col aa_bg_main">'; |
|---|
| 321 | |
|---|
| 322 | $output .= $dashboard->reporting_menu(); |
|---|
| 323 | |
|---|
| 324 | $output .= '</div>'; |
|---|
| 325 | |
|---|
| 326 | $output .= '<div class="right-col">'; |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | $output .= '<div class="hidden">'; |
|---|
| 330 | $output .= '<div id="siteurl">'.get_option('siteurl').'</div>'; |
|---|
| 331 | $output .= '<div id="nf_dashboard_load">0</div>'; |
|---|
| 332 | $output .= '<div id="plugins_url">'.plugins_url('/',__FILE__).'</div>'; |
|---|
| 333 | $output .= '<div id="load_entry">'.$dashboard->checkout.'</div>'; |
|---|
| 334 | $output .= '</div>'; |
|---|
| 335 | $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' ); |
|---|
| 336 | $output .= '<div id="nex_forms_wpnonce" style="display:none;">'.$nonce_url.'</div>'; |
|---|
| 337 | //DASHBOARD |
|---|
| 338 | $output .= '<div id="" class="reporting_panel">'; |
|---|
| 339 | |
|---|
| 340 | $output .= '<div id="submission_reports" class="" >'; |
|---|
| 341 | $output .= '<div class="row row_zero_margin report_table_selection">'; |
|---|
| 342 | |
|---|
| 343 | $output .= '<div class="col-xs-12 zero_padding">'; |
|---|
| 344 | $output .= '<div class="row row_zero_margin report_table_container">'; |
|---|
| 345 | $output .= '<div class="col-sm-12 zero_padding ">'; |
|---|
| 346 | $output .= '<div class="right-col">'; |
|---|
| 347 | |
|---|
| 348 | $output .= '<div class="right-col-top faded"> |
|---|
| 349 | <div class="right-col-inner aa_bg_tri"> |
|---|
| 350 | <div class="reporting_controls"> |
|---|
| 351 | <div class="col-sm-3 field_selection_col "> |
|---|
| 352 | <select name="showhide_fields[]" multiple="multiple" class="aa_multi_select field_selection_multi_select"> |
|---|
| 353 | <option disabled="disabled">Show Fields</option> |
|---|
| 354 | </select> |
|---|
| 355 | </div> |
|---|
| 356 | |
|---|
| 357 | </div> |
|---|
| 358 | </div> |
|---|
| 359 | <div class="right-bottom"> |
|---|
| 360 | <div class="dashboard-box database_table wap_nex_forms_temp_report wap_nex_forms_entries" data-table="wap_nex_forms_temp_report"> |
|---|
| 361 | <div class="dashboard-box-header aa_bg_main"> |
|---|
| 362 | <div class="table_title font_color_1 ">Report</div> |
|---|
| 363 | |
|---|
| 364 | </div> |
|---|
| 365 | <div class="dashboard-box-content zero_padding"> |
|---|
| 366 | <div class="no_records"><span class="fa fa-ban"></span> <span class="result_text">No results found</span></div> |
|---|
| 367 | |
|---|
| 368 | </div> |
|---|
| 369 | |
|---|
| 370 | </div> |
|---|
| 371 | </div>'; |
|---|
| 372 | |
|---|
| 373 | |
|---|
| 374 | $output .= '</div>'; |
|---|
| 375 | |
|---|
| 376 | $output .= '</div>'; |
|---|
| 377 | $output .= '</div>'; |
|---|
| 378 | $output .= '</div>'; |
|---|
| 379 | $output .= '</div>'; |
|---|
| 380 | $output .= '</div>'; |
|---|
| 381 | $output .= '</div>'; |
|---|
| 382 | $output .= '</div>'; |
|---|
| 383 | $output .= '</div>'; |
|---|
| 384 | |
|---|
| 385 | $output .= '</div>'; |
|---|
| 386 | $output .= '</div>'; |
|---|
| 387 | $output .= '</div>'; |
|---|
| 388 | |
|---|
| 389 | $output .= '</div>'; |
|---|
| 390 | $output .= '</div>'; |
|---|
| 391 | |
|---|
| 392 | NEXForms_clean_echo( $output); |
|---|
| 393 | |
|---|
| 394 | $dashboard->remove_unwanted_styles(); |
|---|
| 395 | if(!get_option('7103891')) |
|---|
| 396 | { |
|---|
| 397 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 398 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 399 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 400 | } |
|---|
| 401 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 402 | } |
|---|
| 403 | |
|---|
| 404 | function NEXForms_attachments_page(){ |
|---|
| 405 | global $wpdb; |
|---|
| 406 | $theme = wp_get_theme(); |
|---|
| 407 | $output = ''; |
|---|
| 408 | |
|---|
| 409 | $nf_function = new NEXForms_functions(); |
|---|
| 410 | |
|---|
| 411 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 412 | |
|---|
| 413 | $dashboard = new NEXForms_dashboard(); |
|---|
| 414 | $dashboard->dashboard_checkout(); |
|---|
| 415 | |
|---|
| 416 | /*$entries = new NEXForms_dashboard(); |
|---|
| 417 | //$entries->action = 'print_entries'; |
|---|
| 418 | $entries->table = 'wap_nex_forms_entries'; |
|---|
| 419 | $entries->table_resize = true; |
|---|
| 420 | $entries->table_header = '<span class="fas fa-filter"></span> Filters:'; |
|---|
| 421 | $entries->extra_buttons = array( |
|---|
| 422 | 'unread' =>array('class'=>'filter_unread filter_button', 'id'=>'filter_unread', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-eye-slash"></span> '.__(' Unread','nex-forms').''), |
|---|
| 423 | 'starred' =>array('class'=>'filter_starred filter_button', 'id'=>'filter_starred', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-star"></span> '.__(' Starred','nex-forms').''), |
|---|
| 424 | 'attachments' =>array('class'=>'filter_attachments filter_button', 'id'=>'filter_attachments', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-paperclip"></span> '.__(' Attachment','nex-forms').'') |
|---|
| 425 | //'read' =>array('class'=>'filter_read filter_button', 'id'=>'filter_read', 'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-eye"></span> '.__(' Read','nex-forms').''), |
|---|
| 426 | ); |
|---|
| 427 | $entries->table_header_icon = 'assignment'; |
|---|
| 428 | $entries->additional_params = array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 429 | $entries->table_headings = array( |
|---|
| 430 | 'Id', |
|---|
| 431 | array('icon'=>'fas fa-star', 'user_func'=>'NEXForms_starred','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom starred','sort_by'=>'starred'), |
|---|
| 432 | array('icon'=>'fas fa-paperclip', 'user_func'=>'NEXForms_get_attachment','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_files', 'set_class'=>'custom read', 'sort_by'=>'attachments'), |
|---|
| 433 | array('icon'=>'fas fa-glasses', 'user_func'=>'NEXForms_entry_status','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom read','sort_by'=>'viewed'), |
|---|
| 434 | //'title', |
|---|
| 435 | array('heading'=> __('Form','nex-forms'), 'user_func'=>'NEXForms_get_title3','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'),//'sort_by'=>'nex_forms_Id' |
|---|
| 436 | 'page', |
|---|
| 437 | array('heading'=>__('Submitted','nex-forms'), 'user_func'=>'NEXForms_time_elapsed_string','user_func_args_1'=>'date_time', 'user_func_args_2'=>'wap_nex_forms', 'sort_by'=>'date_time'), |
|---|
| 438 | 'date_time', |
|---|
| 439 | ); |
|---|
| 440 | $entries->show_headings=true; |
|---|
| 441 | $entries->search_params = array('form_data'); |
|---|
| 442 | $entries->color_adapt = true; |
|---|
| 443 | $entries->checkout = $dashboard->checkout; |
|---|
| 444 | $entries->record_limit = 100; |
|---|
| 445 | $entries->show_delete = false;*/ |
|---|
| 446 | |
|---|
| 447 | |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | $file_uploads = new NEXForms_dashboard(); |
|---|
| 451 | $file_uploads->table = 'wap_nex_forms_files'; |
|---|
| 452 | $file_uploads->table_header = ''; |
|---|
| 453 | $file_uploads->table_header_icon = 'insert_drive_file'; |
|---|
| 454 | $file_uploads->table_headings = array('Id','entry_Id', array('heading'=>__('Form','nex-forms'), 'user_func'=>'NEXForms_get_title','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'), 'name','type','size','url', array('heading'=>'', 'user_func'=>'NEXForms_download_file','user_func_args_1'=>'url','user_func_args_2'=>'wap_nex_forms_files','set_class'=>'read download')); |
|---|
| 455 | $file_uploads->show_headings=true; |
|---|
| 456 | $file_uploads->table_resize = true; |
|---|
| 457 | $file_uploads->extra_classes = ' wap_nex_forms_entries file_manager'; |
|---|
| 458 | $file_uploads->search_params = array('Id','entry_Id','name','type'); |
|---|
| 459 | $file_uploads->color_adapt = true; |
|---|
| 460 | //$file_uploads->build_table_dropdown = 'form_id'; |
|---|
| 461 | $file_uploads->record_limit = 50; |
|---|
| 462 | $file_uploads->checkout = $dashboard->checkout; |
|---|
| 463 | $file_uploads->show_delete = true; |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | $output .= '<div class="hidden">'; |
|---|
| 467 | $output .= $dashboard->dashboard_menu('File Uploads'); |
|---|
| 468 | $output .= '</div>'; |
|---|
| 469 | |
|---|
| 470 | if(!$dashboard->checkout) |
|---|
| 471 | { |
|---|
| 472 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 473 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 474 | |
|---|
| 475 | $output .= '<div class="col-sm-5">'; |
|---|
| 476 | $output .= $dashboard->license_setup(); |
|---|
| 477 | $output .= '</div>'; |
|---|
| 478 | $output .= '</div>'; |
|---|
| 479 | $output .= '</div>'; |
|---|
| 480 | $output .= '</div>'; |
|---|
| 481 | |
|---|
| 482 | NEXForms_clean_echo( $output); |
|---|
| 483 | return; |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | $output .= '<div class="admin_url" style="display:none;">'.admin_url().'</div>'; |
|---|
| 487 | $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' ); |
|---|
| 488 | $output .= '<div id="nex_forms_wpnonce" style="display:none;">'.$nonce_url.'</div>'; |
|---|
| 489 | |
|---|
| 490 | $output .= '<div class="nf_context_menu nf_context_menu_2 aa_menu aa_bg_main"> |
|---|
| 491 | |
|---|
| 492 | <ul class="aa_menu"> |
|---|
| 493 | <li class="cm-action-item mark-read" data-action="mark-read"><a href="#" class="cm-item-text"><span class="fas fa-eye"></span>Mark as read</span><span class="kbsc"></span></a></li> |
|---|
| 494 | <li class="cm-action-item mark-unread" data-action="mark-unread"><a href="#" class="cm-item-text"><span class="fas fa-eye-slash"></span>Mark as unread</span><span class="kbsc"></span></a></li> |
|---|
| 495 | <li class="sec_divider"></li> |
|---|
| 496 | <li class="cm-action-item" data-action="add-star"><a href="#" class="cm-item-text"><span class="fas fa-star"></span> Add Star</span><span class="kbsc"></span></a></li> |
|---|
| 497 | <li class="cm-action-item" data-action="remove-star"><a href="#" class="cm-item-text"><span class="far fa-star"></span> remove Star</span><span class="kbsc"></span></a></li> |
|---|
| 498 | |
|---|
| 499 | <li class="sec_divider restore_record" tyle="display:none;"></li> |
|---|
| 500 | <li class="cm-action-item restore_record" data-action="restore" style="display:none;"><a href="#" class="cm-item-text"><span class="fas fa-trash-restore"></span> Restore</span><span class="kbsc"></span></a></li> |
|---|
| 501 | <li class="sec_divider"></li> |
|---|
| 502 | <li class="cm-action-item" data-action="delete"><a href="#" class="cm-item-text"><span class="fas fa-trash"></span> Delete</span><span class="kbsc">Delete</span></a></li> |
|---|
| 503 | <ul> |
|---|
| 504 | </div>'; |
|---|
| 505 | |
|---|
| 506 | |
|---|
| 507 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 508 | $output .= $dashboard->new_menu(); |
|---|
| 509 | |
|---|
| 510 | |
|---|
| 511 | $output .= '<div id="nex_forms_entries" class="nex_forms_entries file_uploads">'; |
|---|
| 512 | |
|---|
| 513 | $output .= '<div class="entries_wrapper">'; |
|---|
| 514 | |
|---|
| 515 | $output .= '<div class="left-col aa_bg_main">'; |
|---|
| 516 | |
|---|
| 517 | $output .= $dashboard->uploads_menu(); |
|---|
| 518 | |
|---|
| 519 | $output .= '</div>'; |
|---|
| 520 | |
|---|
| 521 | $output .= '<div class="right-col">'; |
|---|
| 522 | $output .= '<div class="right-col-top">'; |
|---|
| 523 | $output .= $file_uploads->print_record_table(); |
|---|
| 524 | |
|---|
| 525 | |
|---|
| 526 | |
|---|
| 527 | $output .= '</div>'; |
|---|
| 528 | /*$output .= '<div class="right-mid">'; |
|---|
| 529 | |
|---|
| 530 | |
|---|
| 531 | |
|---|
| 532 | $output .= '<div class="entry_tools aa_bg_main">'; |
|---|
| 533 | |
|---|
| 534 | $output .= '<button type="submit" class="save_form_entry save_button button button-primary" style="display:none;">'.__('Save','nex-forms').'</button>'; |
|---|
| 535 | $output .= '<button class="cancel_save_form_entry save_button button button-primary" style="display:none;"><i class="fa fa-close"></i></button>'; |
|---|
| 536 | |
|---|
| 537 | |
|---|
| 538 | $output .= '<div class="entry_views">'; |
|---|
| 539 | |
|---|
| 540 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch view_form_data active" data-action="view-data" disabled="disabled"><span class="fas fa-database"></span> '.__('Entry Data','nex-forms').'</button>'; |
|---|
| 541 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-admin-email" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>'; |
|---|
| 542 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-user-email" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>'; |
|---|
| 543 | $output .= '</div>'; |
|---|
| 544 | |
|---|
| 545 | $output .= '<div class="entry_actions">'; |
|---|
| 546 | $output .= '<button class="print_to_pdf aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'</button>'; |
|---|
| 547 | //$output .= '<button class="button no_batch do_action" data-action="print-form-entry" disabled="disabled"><span class="fas fa-print"></span> '.__('Print','nex-forms').'</button>'; |
|---|
| 548 | $output .= '<button id="" class="edit_form_entry aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-pen-square"></span> '.__('Edit','nex-forms').'</button>'; |
|---|
| 549 | $output .= '<button class="nf_button aa_bg_main_btn do_action" data-action="delete" disabled="disabled"><span class="fas fa-trash"></span> '.__('Delete','nex-forms').'</button>'; |
|---|
| 550 | $output .= '</div>'; |
|---|
| 551 | |
|---|
| 552 | $output .= '</div>'; |
|---|
| 553 | |
|---|
| 554 | $output .= '</div>'; |
|---|
| 555 | $output .= '<div class="right-bottom">'; |
|---|
| 556 | $output .= $file_uploads->print_form_entry(); |
|---|
| 557 | $output .= '</div>'; |
|---|
| 558 | */ |
|---|
| 559 | $output .= '</div>'; |
|---|
| 560 | |
|---|
| 561 | $output .= '</div>'; |
|---|
| 562 | |
|---|
| 563 | |
|---|
| 564 | // |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | // |
|---|
| 568 | $output .= '</div>'; |
|---|
| 569 | $output .= '</div>'; |
|---|
| 570 | $output .= '</div>'; |
|---|
| 571 | |
|---|
| 572 | NEXForms_clean_echo( $output); |
|---|
| 573 | |
|---|
| 574 | $dashboard->remove_unwanted_styles(); |
|---|
| 575 | if(!get_option('7103891')) |
|---|
| 576 | { |
|---|
| 577 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 578 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 579 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 580 | } |
|---|
| 581 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 582 | } |
|---|
| 583 | |
|---|
| 584 | function NEXForms_global_setup_page(){ |
|---|
| 585 | global $wpdb; |
|---|
| 586 | $theme = wp_get_theme(); |
|---|
| 587 | $output = ''; |
|---|
| 588 | |
|---|
| 589 | $nf_function = new NEXForms_functions(); |
|---|
| 590 | $dashboard = new NEXForms_dashboard(); |
|---|
| 591 | $dashboard->dashboard_checkout(); |
|---|
| 592 | |
|---|
| 593 | $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' ); |
|---|
| 594 | $output .= '<div id="nex_forms_wpnonce" style="display:none;">'.$nonce_url.'</div>'; |
|---|
| 595 | |
|---|
| 596 | $output .= '<div class="nex_forms_admin_page_wrapper">'; |
|---|
| 597 | |
|---|
| 598 | |
|---|
| 599 | $output .= '<div class="hidden">'; |
|---|
| 600 | $output .= $dashboard->dashboard_menu('Settings'); |
|---|
| 601 | $output .= '</div>'; |
|---|
| 602 | |
|---|
| 603 | $output .= '<div id="dashboard_panel" class="dashboard_panel global_settings_page">'; |
|---|
| 604 | $output .= $dashboard->new_menu(); |
|---|
| 605 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 606 | |
|---|
| 607 | //EMAIL SETUP |
|---|
| 608 | $output .= '<div class="col-sm-4">'; |
|---|
| 609 | $output .= $dashboard->license_setup($dashboard->checkout, $dashboard->client_info); |
|---|
| 610 | $output .= $dashboard->email_setup(); |
|---|
| 611 | $output .= '</div>'; |
|---|
| 612 | |
|---|
| 613 | //WP ADMIN OPTIONS |
|---|
| 614 | $output .= '<div class="col-sm-4">'; |
|---|
| 615 | $output .= $dashboard->preferences(); |
|---|
| 616 | $output .= $dashboard->wp_admin_options(); |
|---|
| 617 | $output .= '</div>'; |
|---|
| 618 | |
|---|
| 619 | //PREFERENCES |
|---|
| 620 | $output .= '<div class="col-sm-4">'; |
|---|
| 621 | $output .= $dashboard->email_subscriptions_setup(); |
|---|
| 622 | $output .= $dashboard->troubleshooting_options(); |
|---|
| 623 | $output .= '</div>'; |
|---|
| 624 | |
|---|
| 625 | $output .= '</div>'; |
|---|
| 626 | |
|---|
| 627 | $output .= '</div>'; |
|---|
| 628 | $output .= '</div>'; |
|---|
| 629 | $output .= '</div>'; //nex_forms_admin_page_wrapper |
|---|
| 630 | |
|---|
| 631 | NEXForms_clean_echo( $output); |
|---|
| 632 | $dashboard->remove_unwanted_styles(); |
|---|
| 633 | |
|---|
| 634 | if(!is_array(get_option('7103891'))) |
|---|
| 635 | { |
|---|
| 636 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 637 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 638 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 639 | } |
|---|
| 640 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 641 | |
|---|
| 642 | |
|---|
| 643 | } |
|---|
| 644 | |
|---|
| 645 | function NEXForms_add_ons_page(){ |
|---|
| 646 | global $wpdb; |
|---|
| 647 | $theme = wp_get_theme(); |
|---|
| 648 | $output = ''; |
|---|
| 649 | |
|---|
| 650 | $nf_function = new NEXForms_functions(); |
|---|
| 651 | $dashboard = new NEXForms_dashboard(); |
|---|
| 652 | $dashboard->dashboard_checkout(); |
|---|
| 653 | |
|---|
| 654 | |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | |
|---|
| 658 | $get_info = $dashboard->client_info; |
|---|
| 659 | |
|---|
| 660 | $get_license = $dashboard->license_info; |
|---|
| 661 | |
|---|
| 662 | $set_year = 2021; //substr($get_info['date_puchased'],0,4); |
|---|
| 663 | $set_month = 8; //substr($get_info['date_puchased'],5,2); |
|---|
| 664 | $set_day = 20; //substr($get_info['date_puchased'],8,2); |
|---|
| 665 | |
|---|
| 666 | $supported_until = (isset($get_license['supported_until']) ? $get_license['supported_until'] : ''); |
|---|
| 667 | |
|---|
| 668 | $set_support_year = substr($supported_until,0,4); |
|---|
| 669 | $set_support_month = substr($supported_until,5,2); |
|---|
| 670 | $set_support_day = substr($supported_until,8,2); |
|---|
| 671 | |
|---|
| 672 | $get_support_date = (isset($get_info['expiration_date']) ? $get_info['expiration_date'] : ''); |
|---|
| 673 | |
|---|
| 674 | $date1 = $set_support_year.'-'.$set_support_month.'-'.$set_support_day; |
|---|
| 675 | $date2 = date('yy-m-d'); |
|---|
| 676 | |
|---|
| 677 | $diff = strtotime($date1) - strtotime($date2); |
|---|
| 678 | |
|---|
| 679 | $years = floor($diff / (365*60*60*24)); |
|---|
| 680 | $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|---|
| 681 | $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|---|
| 682 | |
|---|
| 683 | if($set_year==2020 || $set_year==2021 || $set_year==2022) |
|---|
| 684 | { |
|---|
| 685 | $download=true; |
|---|
| 686 | } |
|---|
| 687 | |
|---|
| 688 | |
|---|
| 689 | |
|---|
| 690 | if($download && $diff>0) |
|---|
| 691 | $output .= '<div class="set_free_add_ons hidden">true</div>'; |
|---|
| 692 | else |
|---|
| 693 | { |
|---|
| 694 | //if(!get_option('nf_activated')) |
|---|
| 695 | // $output .= '<div class="row"><div class="col-sm-12"><div class="alert alert-info"><h3>SALE NOW ON!</h3>We are celebrating 12 000+ Sales! <a href="http://codecanyon.net/item/nexforms-the-ultimate-wordpress-form-builder/7103891?license=regular&open_purchase_for_item_id=7103891&purchasable=source&ref=Basix">Buy NEX-forms today</a> and all these add-ons worth $210 absolutely FREE!.</div></div></div>'; |
|---|
| 696 | }// |
|---|
| 697 | |
|---|
| 698 | |
|---|
| 699 | $output .= '<div class="nex_forms_admin_page_wrapper">'; |
|---|
| 700 | $output .= '<div class="hidden">'; |
|---|
| 701 | $output .= $dashboard->dashboard_menu('Add-ons'); |
|---|
| 702 | $output .= '</div>'; |
|---|
| 703 | $output .= '<div id="dashboard_panel" class="dashboard_panel global_settings_page">'; |
|---|
| 704 | $output .= $dashboard->new_menu('add-ons'); |
|---|
| 705 | |
|---|
| 706 | |
|---|
| 707 | |
|---|
| 708 | //PAYPAL PRO |
|---|
| 709 | $output .= '<div class="col-sm-12">'; |
|---|
| 710 | $output .= '<div class="add_on_item">'; |
|---|
| 711 | $output .= '<div class="add_on_cover">'; |
|---|
| 712 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/paypal-pro/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-paypal-pro.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 713 | $output .= '</div>'; |
|---|
| 714 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 715 | $output .= '<h3>PayPal Pro</h3>'; |
|---|
| 716 | |
|---|
| 717 | $output .= 'Enable online payments through PayPal. Incudes Itemized PayPal checkout and email sending options based on payment status.'; |
|---|
| 718 | $output .= '</div>'; |
|---|
| 719 | $output .= '<div class="add_on_check">'; |
|---|
| 720 | |
|---|
| 721 | if(function_exists('nf_get_paypal_payment')) |
|---|
| 722 | { |
|---|
| 723 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 724 | } |
|---|
| 725 | else |
|---|
| 726 | { |
|---|
| 727 | $output .= '<a href="https://codecanyon.net/item/paypal-pro-for-nexforms/22449576?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 728 | } |
|---|
| 729 | |
|---|
| 730 | $output .= '</div>'; |
|---|
| 731 | $output .= '</div>'; |
|---|
| 732 | $output .= '</div>'; |
|---|
| 733 | |
|---|
| 734 | //PDF CREATOR |
|---|
| 735 | $output .= '<div class="col-sm-12">'; |
|---|
| 736 | $output .= '<div class="add_on_item">'; |
|---|
| 737 | $output .= '<div class="add_on_cover">'; |
|---|
| 738 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/pdf-creator/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-pdf-creator.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 739 | $output .= '</div>'; |
|---|
| 740 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 741 | $output .= '<h3>PDF Creator</h3>'; |
|---|
| 742 | $output .= 'Enables custom PDF creation from submmited form data. Also include options for these PDF\'s to be attached to admin and user emails.'; |
|---|
| 743 | $output .= '</div>'; |
|---|
| 744 | $output .= '<div class="add_on_check">'; |
|---|
| 745 | |
|---|
| 746 | if(function_exists('nf_not_found_notice_pdf')) |
|---|
| 747 | { |
|---|
| 748 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 749 | } |
|---|
| 750 | else |
|---|
| 751 | { |
|---|
| 752 | $output .= '<a href="https://codecanyon.net/item/pdf-creator-for-nexforms/11220942?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 753 | } |
|---|
| 754 | |
|---|
| 755 | $output .= '</div>'; |
|---|
| 756 | $output .= '</div>'; |
|---|
| 757 | $output .= '</div>'; |
|---|
| 758 | |
|---|
| 759 | //MULTI-PAGE FORMS |
|---|
| 760 | $output .= '<div class="col-sm-12">'; |
|---|
| 761 | $output .= '<div class="add_on_item">'; |
|---|
| 762 | $output .= '<div class="add_on_cover">'; |
|---|
| 763 | $output .= '<a href="https://codecanyon.net/item/multipage-forms-for-nexforms/56328595" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-multi-page-forms.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 764 | $output .= '</div>'; |
|---|
| 765 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 766 | $output .= '<h3>Multi-Page Forms</h3>'; |
|---|
| 767 | $output .= 'Enables multi-page forms allowing submitted form data to be sent from one form to the next.'; |
|---|
| 768 | $output .= '</div>'; |
|---|
| 769 | $output .= '<div class="add_on_check">'; |
|---|
| 770 | |
|---|
| 771 | if(function_exists('nex_forms_not_found_notice_mpf')) |
|---|
| 772 | { |
|---|
| 773 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 774 | } |
|---|
| 775 | else |
|---|
| 776 | { |
|---|
| 777 | $output .= '<a href="https://codecanyon.net/item/multipage-forms-for-nexforms/56328595?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 778 | } |
|---|
| 779 | |
|---|
| 780 | $output .= '</div>'; |
|---|
| 781 | $output .= '</div>'; |
|---|
| 782 | $output .= '</div>'; |
|---|
| 783 | |
|---|
| 784 | |
|---|
| 785 | |
|---|
| 786 | //FORM THEMES |
|---|
| 787 | $output .= '<div class="col-sm-12">'; |
|---|
| 788 | $output .= '<div class="add_on_item">'; |
|---|
| 789 | $output .= '<div class="add_on_cover">'; |
|---|
| 790 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/form-themes/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-form-themes.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 791 | $output .= '</div>'; |
|---|
| 792 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 793 | $output .= '<h3>Form Themes/Color Schemes</h3>'; |
|---|
| 794 | $output .= 'Instantly fit your form design to your site\'s look and feel. Switch forms to Bootstrap, Material Design, Neumorphism, JQuery UI or Classic Themes. Includes 44 Preset Color Schemes.'; |
|---|
| 795 | $output .= '</div>'; |
|---|
| 796 | $output .= '<div class="add_on_check">'; |
|---|
| 797 | |
|---|
| 798 | if(function_exists('nf_not_found_notice_ft')) |
|---|
| 799 | { |
|---|
| 800 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 801 | } |
|---|
| 802 | else |
|---|
| 803 | { |
|---|
| 804 | $output .= '<a href="https://codecanyon.net/item/form-themes-for-nexforms/10037800?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 805 | } |
|---|
| 806 | |
|---|
| 807 | $output .= '</div>'; |
|---|
| 808 | $output .= '</div>'; |
|---|
| 809 | $output .= '</div>'; |
|---|
| 810 | |
|---|
| 811 | |
|---|
| 812 | //ZAPIER |
|---|
| 813 | $output .= '<div class="col-sm-12">'; |
|---|
| 814 | $output .= '<div class="add_on_item">'; |
|---|
| 815 | $output .= '<div class="add_on_cover">'; |
|---|
| 816 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/zapier-integration/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-zapier.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 817 | $output .= '</div>'; |
|---|
| 818 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 819 | $output .= '<h3>Zapier Integration</h3>'; |
|---|
| 820 | $output .= 'Enables the integration of NEX-Forms to over 4000 apps.'; |
|---|
| 821 | $output .= '</div>'; |
|---|
| 822 | $output .= '<div class="add_on_check">'; |
|---|
| 823 | |
|---|
| 824 | if(function_exists('NEXForms_not_found_notice_zapier')) |
|---|
| 825 | { |
|---|
| 826 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 827 | } |
|---|
| 828 | else |
|---|
| 829 | { |
|---|
| 830 | $output .= '<a href="https://codecanyon.net/item/zapier-integration-for-nexforms/38000632?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 831 | } |
|---|
| 832 | |
|---|
| 833 | $output .= '</div>'; |
|---|
| 834 | $output .= '</div>'; |
|---|
| 835 | $output .= '</div>'; |
|---|
| 836 | |
|---|
| 837 | |
|---|
| 838 | //DIGITAL SIGNATURES |
|---|
| 839 | $output .= '<div class="col-sm-12">'; |
|---|
| 840 | $output .= '<div class="add_on_item">'; |
|---|
| 841 | $output .= '<div class="add_on_cover">'; |
|---|
| 842 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/digital-signatures/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-digital-signatures.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 843 | $output .= '</div>'; |
|---|
| 844 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 845 | $output .= '<h3>Digital / E-Signatures</h3>'; |
|---|
| 846 | $output .= 'Allows you to add digital signature fields to your forms. Use these signatures in email and PDF\'s.'; |
|---|
| 847 | $output .= '</div>'; |
|---|
| 848 | $output .= '<div class="add_on_check">'; |
|---|
| 849 | |
|---|
| 850 | if(function_exists('nf_not_found_notice_ds')) |
|---|
| 851 | { |
|---|
| 852 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 853 | } |
|---|
| 854 | else |
|---|
| 855 | { |
|---|
| 856 | $output .= '<a href="https://codecanyon.net/item/digital-signatures-for-nexforms/17044658?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 857 | } |
|---|
| 858 | |
|---|
| 859 | $output .= '</div>'; |
|---|
| 860 | $output .= '</div>'; |
|---|
| 861 | $output .= '</div>'; |
|---|
| 862 | |
|---|
| 863 | |
|---|
| 864 | //SUPER SELECT |
|---|
| 865 | $output .= '<div class="col-sm-12">'; |
|---|
| 866 | $output .= '<div class="add_on_item">'; |
|---|
| 867 | $output .= '<div class="add_on_cover">'; |
|---|
| 868 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/super-select-form-field/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-super-select.png', dirname(dirname(__FILE__))).'"></a>';// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 869 | $output .= '</div>'; |
|---|
| 870 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 871 | $output .= '<h3>Super Selection Form Field</h3>'; |
|---|
| 872 | $output .= 'Use 1500+ Icons to create your own custom Radio Buttons, Checkboxes, Dropdown selects and Spinner selects. Abolutely Full Cutomisation...use any on/off colors and any on/off icons for each option.'; |
|---|
| 873 | $output .= '</div>'; |
|---|
| 874 | $output .= '<div class="add_on_check">'; |
|---|
| 875 | |
|---|
| 876 | if(function_exists('nf_not_found_notice_ss')) |
|---|
| 877 | { |
|---|
| 878 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 879 | } |
|---|
| 880 | else |
|---|
| 881 | { |
|---|
| 882 | $output .= '<a href="https://codecanyon.net/item/super-selection-form-field-for-nexforms/23748570?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 883 | } |
|---|
| 884 | |
|---|
| 885 | $output .= '</div>'; |
|---|
| 886 | $output .= '</div>'; |
|---|
| 887 | $output .= '</div>'; |
|---|
| 888 | //STRIPE |
|---|
| 889 | /*$output .= '<div class="col-sm-12">'; |
|---|
| 890 | $output .= '<div class="add_on_item">'; |
|---|
| 891 | $output .= '<div class="add_on_cover">'; |
|---|
| 892 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/stripe/" target="_blank"><img src="https://basixonline.net/add-ons/covers/nex-forms-add-on-stripe.png"></a>'; |
|---|
| 893 | $output .= '</div>'; |
|---|
| 894 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 895 | $output .= '<h3>Stripe</h3>'; |
|---|
| 896 | $output .= 'Enable online payments through Stripe<br /><br /><br /> '; |
|---|
| 897 | $output .= '</div>'; |
|---|
| 898 | $output .= '<div class="add_on_check">'; |
|---|
| 899 | |
|---|
| 900 | if(function_exists('nf_not_found_notice_stripe')) |
|---|
| 901 | { |
|---|
| 902 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 903 | } |
|---|
| 904 | else |
|---|
| 905 | { |
|---|
| 906 | $output .= '<a href="https://codecanyon.net/user/basix/portfolio?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 907 | } |
|---|
| 908 | |
|---|
| 909 | $output .= '</div>'; |
|---|
| 910 | $output .= '</div>'; |
|---|
| 911 | $output .= '</div>';*/ |
|---|
| 912 | |
|---|
| 913 | |
|---|
| 914 | |
|---|
| 915 | |
|---|
| 916 | |
|---|
| 917 | |
|---|
| 918 | //FORM TO POST |
|---|
| 919 | $output .= '<div class="col-sm-12">'; |
|---|
| 920 | $output .= '<div class="add_on_item">'; |
|---|
| 921 | $output .= '<div class="add_on_cover">'; |
|---|
| 922 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/form-to-post-or-page/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-form-to-post-or-page.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 923 | $output .= '</div>'; |
|---|
| 924 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 925 | $output .= '<h3>Form to POST / PAGE</h3>'; |
|---|
| 926 | $output .= 'Automatically create posts or pages from NEX-Forms form submissions. Includes setting featured image and the use of data tags to populate Page/Post content.'; |
|---|
| 927 | $output .= '</div>'; |
|---|
| 928 | $output .= '<div class="add_on_check">'; |
|---|
| 929 | |
|---|
| 930 | if(function_exists('nexforms_ftp_setup')) |
|---|
| 931 | { |
|---|
| 932 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 933 | } |
|---|
| 934 | else |
|---|
| 935 | { |
|---|
| 936 | $output .= '<a href="https://codecanyon.net/item/form-to-postpage-for-nexforms/19538774?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 937 | } |
|---|
| 938 | |
|---|
| 939 | $output .= '</div>'; |
|---|
| 940 | $output .= '</div>'; |
|---|
| 941 | $output .= '</div>'; |
|---|
| 942 | |
|---|
| 943 | |
|---|
| 944 | |
|---|
| 945 | |
|---|
| 946 | |
|---|
| 947 | |
|---|
| 948 | |
|---|
| 949 | |
|---|
| 950 | //CONDITIONAL CONTENT BLOCKS |
|---|
| 951 | $output .= '<div class="col-sm-12">'; |
|---|
| 952 | $output .= '<div class="add_on_item">'; |
|---|
| 953 | $output .= '<div class="add_on_cover">'; |
|---|
| 954 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/conditional-content-blocks/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-conditional-content-blocks.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 955 | $output .= '</div>'; |
|---|
| 956 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 957 | $output .= '<h3>Conditional Content Blocks</h3>'; |
|---|
| 958 | $output .= 'Create dynamic content in emails and PDF\'s from submitted data. Meaning you can hide/show specific content in the emails or PDF\'s based on a users input or selection.'; |
|---|
| 959 | $output .= '</div>'; |
|---|
| 960 | $output .= '<div class="add_on_check">'; |
|---|
| 961 | |
|---|
| 962 | if(function_exists('nf_not_found_notice_ccb')) |
|---|
| 963 | { |
|---|
| 964 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 965 | } |
|---|
| 966 | else |
|---|
| 967 | { |
|---|
| 968 | $output .= '<a href="https://codecanyon.net/item/conditional-content-blocks-for-nexforms/22096224?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 969 | } |
|---|
| 970 | |
|---|
| 971 | $output .= '</div>'; |
|---|
| 972 | $output .= '</div>'; |
|---|
| 973 | $output .= '</div>'; |
|---|
| 974 | |
|---|
| 975 | |
|---|
| 976 | //SHORTCODE PROCESSOR |
|---|
| 977 | $output .= '<div class="col-sm-12">'; |
|---|
| 978 | $output .= '<div class="add_on_item">'; |
|---|
| 979 | $output .= '<div class="add_on_cover">'; |
|---|
| 980 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/shortcode-processor/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-shortcode-processor.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 981 | $output .= '</div>'; |
|---|
| 982 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 983 | $output .= '<h3>Shorcode Processor</h3>'; |
|---|
| 984 | $output .= 'Run your own custom shorcode or 3rd party plugin/theme shorcode anywhere in your forms.'; |
|---|
| 985 | $output .= '</div>'; |
|---|
| 986 | $output .= '<div class="add_on_check">'; |
|---|
| 987 | |
|---|
| 988 | if(function_exists('nf_not_found_notice_sp')) |
|---|
| 989 | { |
|---|
| 990 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 991 | } |
|---|
| 992 | else |
|---|
| 993 | { |
|---|
| 994 | $output .= '<a href="https://codecanyon.net/item/shortcode-processor-for-nexforms/22556756?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 995 | } |
|---|
| 996 | |
|---|
| 997 | $output .= '</div>'; |
|---|
| 998 | $output .= '</div>'; |
|---|
| 999 | $output .= '</div>'; |
|---|
| 1000 | |
|---|
| 1001 | |
|---|
| 1002 | |
|---|
| 1003 | |
|---|
| 1004 | //MAILCHIMP |
|---|
| 1005 | $output .= '<div class="col-sm-12">'; |
|---|
| 1006 | $output .= '<div class="add_on_item">'; |
|---|
| 1007 | $output .= '<div class="add_on_cover">'; |
|---|
| 1008 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/mailchimp/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-mailchimp.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 1009 | $output .= '</div>'; |
|---|
| 1010 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 1011 | $output .= '<h3>MailChimp</h3>'; |
|---|
| 1012 | $output .= 'Automatically update your MailChimp lists with new subscribers from NEX-Forms. '; |
|---|
| 1013 | $output .= '</div>'; |
|---|
| 1014 | $output .= '<div class="add_on_check">'; |
|---|
| 1015 | |
|---|
| 1016 | if(function_exists('nexforms_mc_test_api')) |
|---|
| 1017 | { |
|---|
| 1018 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 1019 | } |
|---|
| 1020 | else |
|---|
| 1021 | { |
|---|
| 1022 | $output .= '<a href="https://codecanyon.net/item/mailchimp-for-nexforms/18030221?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 1023 | } |
|---|
| 1024 | |
|---|
| 1025 | $output .= '</div>'; |
|---|
| 1026 | $output .= '</div>'; |
|---|
| 1027 | $output .= '</div>'; |
|---|
| 1028 | |
|---|
| 1029 | |
|---|
| 1030 | //MAILSTER |
|---|
| 1031 | $output .= '<div class="col-sm-12">'; |
|---|
| 1032 | $output .= '<div class="add_on_item">'; |
|---|
| 1033 | $output .= '<div class="add_on_cover">'; |
|---|
| 1034 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/mailchimp/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-mailster.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 1035 | $output .= '</div>'; |
|---|
| 1036 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 1037 | $output .= '<h3>Mailster</h3>'; |
|---|
| 1038 | $output .= 'Automatically update your Mailster lists with new subscribers from NEX-Forms. '; |
|---|
| 1039 | $output .= '</div>'; |
|---|
| 1040 | $output .= '<div class="add_on_check">'; |
|---|
| 1041 | |
|---|
| 1042 | if(function_exists('nexforms_ms_test_api')) |
|---|
| 1043 | { |
|---|
| 1044 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 1045 | } |
|---|
| 1046 | else |
|---|
| 1047 | { |
|---|
| 1048 | $output .= '<a href="https://codecanyon.net/item/mailster-for-nexforms/27019198?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 1049 | } |
|---|
| 1050 | |
|---|
| 1051 | $output .= '</div>'; |
|---|
| 1052 | $output .= '</div>'; |
|---|
| 1053 | $output .= '</div>'; |
|---|
| 1054 | |
|---|
| 1055 | //MAILPOET |
|---|
| 1056 | $output .= '<div class="col-sm-12">'; |
|---|
| 1057 | $output .= '<div class="add_on_item">'; |
|---|
| 1058 | $output .= '<div class="add_on_cover">'; |
|---|
| 1059 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/mailchimp/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-mailpoet.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 1060 | $output .= '</div>'; |
|---|
| 1061 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 1062 | $output .= '<h3>MailPoet</h3>'; |
|---|
| 1063 | $output .= 'Automatically update your MailPoet lists with new subscribers from NEX-Forms. '; |
|---|
| 1064 | $output .= '</div>'; |
|---|
| 1065 | $output .= '<div class="add_on_check">'; |
|---|
| 1066 | |
|---|
| 1067 | if(function_exists('nexforms_mp_test_api')) |
|---|
| 1068 | { |
|---|
| 1069 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 1070 | } |
|---|
| 1071 | else |
|---|
| 1072 | { |
|---|
| 1073 | $output .= '<a href="https://codecanyon.net/item/mailpoet-for-nexforms/26950120?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 1074 | } |
|---|
| 1075 | |
|---|
| 1076 | $output .= '</div>'; |
|---|
| 1077 | $output .= '</div>'; |
|---|
| 1078 | $output .= '</div>'; |
|---|
| 1079 | |
|---|
| 1080 | |
|---|
| 1081 | |
|---|
| 1082 | //GETRESPONSE |
|---|
| 1083 | $output .= '<div class="col-sm-12">'; |
|---|
| 1084 | $output .= '<div class="add_on_item">'; |
|---|
| 1085 | $output .= '<div class="add_on_cover">'; |
|---|
| 1086 | $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/getresponse/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-getresponse.png', dirname(dirname(__FILE__))).'"></a>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 1087 | $output .= '</div>'; |
|---|
| 1088 | $output .= '<div class="add_on_desciprtion">'; |
|---|
| 1089 | $output .= '<h3>GetRepsonse</h3>'; |
|---|
| 1090 | $output .= 'Automatically update your GetResponse lists with new subscribers from NEX-Forms.'; |
|---|
| 1091 | $output .= '</div>'; |
|---|
| 1092 | $output .= '<div class="add_on_check">'; |
|---|
| 1093 | |
|---|
| 1094 | if(function_exists('nexforms_gr_test_api')) |
|---|
| 1095 | { |
|---|
| 1096 | $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>'; |
|---|
| 1097 | } |
|---|
| 1098 | else |
|---|
| 1099 | { |
|---|
| 1100 | $output .= '<a href="https://codecanyon.net/item/getresponse-for-nexforms/18462247?ref=Basix" class="buy_add_on" target="_blank">Get Add-on</a>'; |
|---|
| 1101 | } |
|---|
| 1102 | |
|---|
| 1103 | $output .= '</div>'; |
|---|
| 1104 | $output .= '</div>'; |
|---|
| 1105 | $output .= '</div>'; |
|---|
| 1106 | |
|---|
| 1107 | |
|---|
| 1108 | |
|---|
| 1109 | |
|---|
| 1110 | |
|---|
| 1111 | |
|---|
| 1112 | |
|---|
| 1113 | $output .= '</div>'; |
|---|
| 1114 | $output .= '</div>'; |
|---|
| 1115 | $output .= '</div>'; |
|---|
| 1116 | NEXForms_clean_echo( $output); |
|---|
| 1117 | $dashboard->remove_unwanted_styles(); |
|---|
| 1118 | |
|---|
| 1119 | } |
|---|
| 1120 | |
|---|
| 1121 | function NEXForms_dashboard(){ |
|---|
| 1122 | |
|---|
| 1123 | global $wpdb; |
|---|
| 1124 | $theme = wp_get_theme(); |
|---|
| 1125 | $output = ''; |
|---|
| 1126 | |
|---|
| 1127 | $nf_function = new NEXForms_functions(); |
|---|
| 1128 | |
|---|
| 1129 | |
|---|
| 1130 | $count_entries = $wpdb->get_results('SELECT nex_forms_Id, COUNT(nex_forms_Id) as counted FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE trashed IS NULL GROUP BY nex_forms_Id;'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1131 | foreach($count_entries as $entry) |
|---|
| 1132 | { |
|---|
| 1133 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms', array('entry_count'=>$entry->counted), array('Id' => $entry->nex_forms_Id) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1134 | } |
|---|
| 1135 | |
|---|
| 1136 | |
|---|
| 1137 | $config = new NEXForms5_Config(); |
|---|
| 1138 | |
|---|
| 1139 | $dashboard = new NEXForms_dashboard(); |
|---|
| 1140 | $dashboard->dashboard_checkout(); |
|---|
| 1141 | $dashboard->color_adapt = true; |
|---|
| 1142 | |
|---|
| 1143 | //MY FORMS |
|---|
| 1144 | $saved_forms = new NEXForms_dashboard(); |
|---|
| 1145 | $saved_forms->table = 'wap_nex_forms'; |
|---|
| 1146 | $saved_forms->table_header = 'Forms'; |
|---|
| 1147 | $saved_forms->table_header_icon = 'insert_drive_file'; |
|---|
| 1148 | $saved_forms->table_headings = array('Id', array('heading'=>__('title','nex-forms'), 'user_func'=>'link_form_title_2', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id','sort_by'=>'title'),array('heading'=>__('Shortcode','nex-forms'), 'user_func'=>'get_form_shortcode', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id', 'sort_by'=>'Id'), array('heading'=>__('Total Entries','nex-forms'), 'user_func'=>'get_total_entries_3', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id','user_func_args_2'=>'entry_count', 'sort_by'=>'entry_count'),array('heading'=>'', 'user_func'=>'link_form_title', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'),array('heading'=>'', 'user_func'=>'duplicate_record', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'),array('heading'=>'', 'user_func'=>'print_export_form_link', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id')); |
|---|
| 1149 | $saved_forms->show_headings=true; |
|---|
| 1150 | $saved_forms->extra_classes = 'my-forms chart-selection'; |
|---|
| 1151 | $saved_forms->additional_params = array(array('column'=>'is_template','operator'=>'=','value'=>0),array('column'=>'is_form','operator'=>'=','value'=>1)); |
|---|
| 1152 | $saved_forms->search_params = array('Id','title'); |
|---|
| 1153 | $saved_forms->checkout = $dashboard->checkout; |
|---|
| 1154 | //$saved_forms->extra_buttons = array('new_form'=>array('class'=>'create_new_form', 'id'=>isset($_POST['form_Id']) ? sanitize_text_field($_POST['form_Id']) : '', 'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-file-medical"></span> '.__(' Add a New Form','nex-forms').'')); |
|---|
| 1155 | $saved_forms->color_adapt = true; |
|---|
| 1156 | $saved_forms->show_delete = true; |
|---|
| 1157 | |
|---|
| 1158 | //LATEST ENTRIES |
|---|
| 1159 | $latest_entries = new NEXForms_dashboard(); |
|---|
| 1160 | $latest_entries->table = 'wap_nex_forms_entries'; |
|---|
| 1161 | $latest_entries->table_header = 'Last 10 Form Submissions'; |
|---|
| 1162 | $latest_entries->sortable_columns = false; |
|---|
| 1163 | $latest_entries->table_header_icon = 'assignment'; |
|---|
| 1164 | $latest_entries->table_headings = array(array('heading'=> __('Form','nex-forms'), 'user_func'=>'NEXForms_get_title','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'),/*'page',*/array('heading'=>__('Submitted','nex-forms'), 'user_func'=>'NEXForms_time_elapsed_string','user_func_args_1'=>'date_time', 'user_func_args_2'=>'wap_nex_forms'),array('heading'=>__('Data Summary','nex-forms'), 'user_func'=>'NEXForms_get_entry_data_preview','user_func_args_1'=>'Id')); |
|---|
| 1165 | $latest_entries->show_headings=true; |
|---|
| 1166 | $latest_entries->search_params = array('Id','form_data'); |
|---|
| 1167 | $latest_entries->checkout = $dashboard->checkout; |
|---|
| 1168 | $latest_entries->show_delete = true; |
|---|
| 1169 | $latest_entries->show_paging = false; |
|---|
| 1170 | $latest_entries->show_search = false; |
|---|
| 1171 | $latest_entries->color_adapt = true; |
|---|
| 1172 | |
|---|
| 1173 | $latest_entries->show_more_link = array('link'=> get_admin_url().'admin.php?page=nex-forms-page-submissions','text'=>'Show all form entries'); |
|---|
| 1174 | |
|---|
| 1175 | |
|---|
| 1176 | $output .= '<div class="nex_forms_admin_page_wrapper">'; |
|---|
| 1177 | $output .= $nf_function->new_form_setup($dashboard->checkout); |
|---|
| 1178 | $output .= '<div class="hidden">'; |
|---|
| 1179 | $output .= $dashboard->dashboard_menu('Dashboard'); |
|---|
| 1180 | $output .= '</div>'; |
|---|
| 1181 | |
|---|
| 1182 | |
|---|
| 1183 | if(!is_array(get_option('7103891'))) |
|---|
| 1184 | { |
|---|
| 1185 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 1186 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 1187 | |
|---|
| 1188 | if(is_array($response->errors)) |
|---|
| 1189 | { |
|---|
| 1190 | foreach($response->errors as $error_type => $error) |
|---|
| 1191 | { |
|---|
| 1192 | NEXForms_clean_echo( '<br /><br /><div class="alert alert-danger"><strong>WP ERROR: </strong>'.strtoupper($error_type).' - '.$error[0].'<br />NEX-Forms can not verify your license as a result of this error. Please as your Hosting Provider to resolve this error. <a href="https://www.google.com/search?q='.$error[0].'" target="_blank">Here are some helpfull articles for your Host</a> </div><br /><br /> '); |
|---|
| 1193 | } |
|---|
| 1194 | } |
|---|
| 1195 | else |
|---|
| 1196 | { |
|---|
| 1197 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 1198 | } |
|---|
| 1199 | } |
|---|
| 1200 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 1201 | |
|---|
| 1202 | |
|---|
| 1203 | $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' ); |
|---|
| 1204 | $output .= '<div id="nex_forms_wpnonce" style="display:none;">'.$nonce_url.'</div>'; |
|---|
| 1205 | |
|---|
| 1206 | $output .= '<div id="dashboard_panel" class="dashboard_panel">'; |
|---|
| 1207 | |
|---|
| 1208 | |
|---|
| 1209 | |
|---|
| 1210 | |
|---|
| 1211 | |
|---|
| 1212 | $output .= $dashboard->new_menu('dashboard'); |
|---|
| 1213 | |
|---|
| 1214 | |
|---|
| 1215 | |
|---|
| 1216 | if(!$dashboard->checkout) |
|---|
| 1217 | { |
|---|
| 1218 | $output .= '<div class="col-sm-3">'; |
|---|
| 1219 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 1220 | |
|---|
| 1221 | $output .= $dashboard->license_setup(); |
|---|
| 1222 | $output .= '</div>'; |
|---|
| 1223 | $output .= '</div>'; |
|---|
| 1224 | //NEX-Forms is not registered and as such some key features will be disabled. To activate these features you will need to upgrade to the pro-version |
|---|
| 1225 | /*$output .= '<div class="col-sm-3">'; |
|---|
| 1226 | $output .= '<div class="license_reg"> |
|---|
| 1227 | |
|---|
| 1228 | <div class="dashboard-box database_table">'; |
|---|
| 1229 | $output .= '<div class="dashboard-box-header aa_bg_main"><div class="table_title font_color_1 "><span class="label label-danger"><span class="fa fa-info"></span></span> NEX-Forms is NOT Registered </div></div> |
|---|
| 1230 | |
|---|
| 1231 | |
|---|
| 1232 | <div class="dashboard-box-content"> |
|---|
| 1233 | Currently, your NEX-Forms installation is not registered, which means some key features are disabled. To unlock these features and to gain FREE access to all premium add-ons you need to <a href="https://1.envato.market/zQ6de" target="_blank"><strong>upgrade to the pro-version</strong></a> |
|---|
| 1234 | <div class="call-to-action"> |
|---|
| 1235 | |
|---|
| 1236 | |
|---|
| 1237 | |
|---|
| 1238 | <a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" class="col-2 register-now"> |
|---|
| 1239 | <div class="dashboard-box database_table wap_nex_forms new-forms"> |
|---|
| 1240 | I already own a license.<br />Regiter NEX-Forms now |
|---|
| 1241 | </div> |
|---|
| 1242 | </a> |
|---|
| 1243 | |
|---|
| 1244 | <a href="https://1.envato.market/6vWmb" target="_blank" class="col-2 buy-now"> |
|---|
| 1245 | <div class="dashboard-box database_table wap_nex_forms new-forms"> |
|---|
| 1246 | Buy NEX-Forms now |
|---|
| 1247 | </div> |
|---|
| 1248 | </a> |
|---|
| 1249 | </div> |
|---|
| 1250 | </div> |
|---|
| 1251 | </div> |
|---|
| 1252 | |
|---|
| 1253 | </div>'; |
|---|
| 1254 | $output .= '</div>';*/ |
|---|
| 1255 | |
|---|
| 1256 | $output .= '<div class="col-sm-2">'; |
|---|
| 1257 | |
|---|
| 1258 | //$output .= '<button id="upload_form" class="form-control btn blue waves-effect waves-light import_form">'.__('Import Form','nex-forms').'</button>'; |
|---|
| 1259 | $output .= '<div class="dashboard-box database_table create_new_form wap_nex_forms new-forms">'; |
|---|
| 1260 | $output .= '<div class=""> |
|---|
| 1261 | |
|---|
| 1262 | <span class="icon fas fa-solid fa-file-circle-plus"></span><br /> |
|---|
| 1263 | |
|---|
| 1264 | '.__('Add a New Form','nex-forms').' |
|---|
| 1265 | |
|---|
| 1266 | </div> |
|---|
| 1267 | </div>'; |
|---|
| 1268 | |
|---|
| 1269 | |
|---|
| 1270 | $output .= '<div class="dashboard-box database_table create_new_form create-template wap_nex_forms new-forms">'; |
|---|
| 1271 | $output .= '<div class=""> |
|---|
| 1272 | |
|---|
| 1273 | <span class="icon fas fa-file-invoice"></span><br /> |
|---|
| 1274 | '.__('Load Form Template','nex-forms').' |
|---|
| 1275 | |
|---|
| 1276 | |
|---|
| 1277 | |
|---|
| 1278 | </div></div>'; |
|---|
| 1279 | |
|---|
| 1280 | $output .= '<div class="dashboard-box database_table create_new_form do-tut wap_nex_forms new-forms">'; |
|---|
| 1281 | $output .= '<div class=""> |
|---|
| 1282 | |
|---|
| 1283 | <span class="icon fas fa-graduation-cap"></span><br /> |
|---|
| 1284 | '.__('Tutorials','nex-forms').' |
|---|
| 1285 | |
|---|
| 1286 | |
|---|
| 1287 | |
|---|
| 1288 | </div></div></div>'; |
|---|
| 1289 | |
|---|
| 1290 | |
|---|
| 1291 | |
|---|
| 1292 | $output .= '<div class="col-sm-7">'; |
|---|
| 1293 | $output .= $saved_forms->print_record_table(); |
|---|
| 1294 | $output .= '</div>'; |
|---|
| 1295 | $output .= '</div>'; |
|---|
| 1296 | |
|---|
| 1297 | NEXForms_clean_echo( $output); |
|---|
| 1298 | return; |
|---|
| 1299 | } |
|---|
| 1300 | |
|---|
| 1301 | $output .= '<div class="col-sm-2">'; |
|---|
| 1302 | |
|---|
| 1303 | //$output .= '<button id="upload_form" class="form-control btn blue waves-effect waves-light import_form">'.__('Import Form','nex-forms').'</button>'; |
|---|
| 1304 | $output .= '<div class="dashboard-box database_table create_new_form wap_nex_forms new-forms">'; |
|---|
| 1305 | $output .= '<div class=""> |
|---|
| 1306 | |
|---|
| 1307 | <span class="icon fas fa-solid fa-file-circle-plus"></span><br /> |
|---|
| 1308 | |
|---|
| 1309 | '.__('Add a New Form','nex-forms').' |
|---|
| 1310 | |
|---|
| 1311 | </div> |
|---|
| 1312 | </div>'; |
|---|
| 1313 | |
|---|
| 1314 | |
|---|
| 1315 | $output .= '<div class="dashboard-box database_table create_new_form create-template wap_nex_forms new-forms">'; |
|---|
| 1316 | $output .= '<div class=""> |
|---|
| 1317 | |
|---|
| 1318 | <span class="icon fas fa-file-invoice"></span><br /> |
|---|
| 1319 | '.__('Load Form Template','nex-forms').' |
|---|
| 1320 | |
|---|
| 1321 | |
|---|
| 1322 | |
|---|
| 1323 | </div></div>'; |
|---|
| 1324 | |
|---|
| 1325 | $output .= '<div class="dashboard-box database_table create_new_form do-tut wap_nex_forms new-forms">'; |
|---|
| 1326 | $output .= '<div class=""> |
|---|
| 1327 | |
|---|
| 1328 | <span class="icon fas fa-graduation-cap"></span><br /> |
|---|
| 1329 | '.__('Tutorials','nex-forms').' |
|---|
| 1330 | |
|---|
| 1331 | |
|---|
| 1332 | |
|---|
| 1333 | </div></div>'; |
|---|
| 1334 | |
|---|
| 1335 | |
|---|
| 1336 | $output .= '<div id="upload_form" class="dashboard-box database_table import_form wap_nex_forms new-forms">'; |
|---|
| 1337 | $output .= '<div class=""> |
|---|
| 1338 | |
|---|
| 1339 | <span class="icon fas fa-file-import"></span><br /> |
|---|
| 1340 | '.__('Import Form','nex-forms').' |
|---|
| 1341 | |
|---|
| 1342 | |
|---|
| 1343 | |
|---|
| 1344 | </div>'; |
|---|
| 1345 | |
|---|
| 1346 | |
|---|
| 1347 | /*$output .= '<div class="dashboard-box-header aa_bg_main"><div class="table_title font_color_1 ">New Form</div></div> |
|---|
| 1348 | |
|---|
| 1349 | |
|---|
| 1350 | <div class="dashboard-box-new"> |
|---|
| 1351 | '; |
|---|
| 1352 | |
|---|
| 1353 | |
|---|
| 1354 | |
|---|
| 1355 | // |
|---|
| 1356 | |
|---|
| 1357 | |
|---|
| 1358 | $output .= '<form class="new_nex_form" name="new_nex_form" id="new_nex_form" method="post" action="'.admin_url('admin-ajax.php').'">'; |
|---|
| 1359 | |
|---|
| 1360 | //$output .= '<h5><strong>'.__('Create a new Blank Form','nex-forms').'</strong></h5>'; |
|---|
| 1361 | |
|---|
| 1362 | $nonce_url = wp_create_nonce( 'nf_admin_new_form_actions' ); |
|---|
| 1363 | $output .= '<input name="nex_forms_wpnonce" type="hidden" value="'.$nonce_url.'">'; |
|---|
| 1364 | |
|---|
| 1365 | $output .= '<input name="title" id="form_title" placeholder="'.__('Enter new Form Title','nex-forms').'" class="form-control" type="text">'; |
|---|
| 1366 | |
|---|
| 1367 | $output .= '<button type="submit" class="form-control submit_new_form btn blue waves-effect waves-light">'.__('Create','nex-forms').'</button>'; |
|---|
| 1368 | |
|---|
| 1369 | $output .= '</form>'; |
|---|
| 1370 | |
|---|
| 1371 | $output .= '</div>';*/ |
|---|
| 1372 | $output .= '</div>'; |
|---|
| 1373 | $output .= '</div>'; |
|---|
| 1374 | |
|---|
| 1375 | $output .= '<div class="col-sm-10">'; |
|---|
| 1376 | $output .= $saved_forms->print_record_table(); |
|---|
| 1377 | $output .= '</div>'; |
|---|
| 1378 | |
|---|
| 1379 | |
|---|
| 1380 | |
|---|
| 1381 | |
|---|
| 1382 | |
|---|
| 1383 | |
|---|
| 1384 | $output .= '</div>'; |
|---|
| 1385 | |
|---|
| 1386 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 1387 | |
|---|
| 1388 | $output .= '<div class="col-sm-5">'; |
|---|
| 1389 | $output .= $dashboard->form_analytics($print_chart='summary'); |
|---|
| 1390 | $output .= '</div>'; |
|---|
| 1391 | |
|---|
| 1392 | $output .= '<div class="col-sm-7">'; |
|---|
| 1393 | $output .= $latest_entries->print_record_table(); |
|---|
| 1394 | $output .= '</div>'; |
|---|
| 1395 | |
|---|
| 1396 | //$output .= '<div class="col-sm-6">'; |
|---|
| 1397 | // $output .= $latest_entries->print_form_entry(); |
|---|
| 1398 | //$output .= '</div>'; |
|---|
| 1399 | $output .= '</div>'; |
|---|
| 1400 | |
|---|
| 1401 | $output .= '</div>'; |
|---|
| 1402 | $output .= '</div>'; |
|---|
| 1403 | $output .= '</div>'; //nex_forms_admin_page_wrapper |
|---|
| 1404 | |
|---|
| 1405 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|---|
| 1406 | $dashboard->remove_unwanted_styles(); |
|---|
| 1407 | |
|---|
| 1408 | } |
|---|
| 1409 | |
|---|
| 1410 | |
|---|
| 1411 | |
|---|
| 1412 | |
|---|
| 1413 | function NEXForms_reporting_page_new(){ |
|---|
| 1414 | |
|---|
| 1415 | global $wpdb; |
|---|
| 1416 | $theme = wp_get_theme(); |
|---|
| 1417 | $output = ''; |
|---|
| 1418 | |
|---|
| 1419 | $nf_function = new NEXForms_functions(); |
|---|
| 1420 | |
|---|
| 1421 | $config = new NEXForms5_Config(); |
|---|
| 1422 | |
|---|
| 1423 | $dashboard = new NEXForms_dashboard(); |
|---|
| 1424 | $dashboard->dashboard_checkout(); |
|---|
| 1425 | $dashboard->color_adapt = true; |
|---|
| 1426 | |
|---|
| 1427 | //MY FORMS |
|---|
| 1428 | $saved_forms = new NEXForms_dashboard(); |
|---|
| 1429 | $saved_forms->table = 'wap_nex_forms_reports'; |
|---|
| 1430 | $saved_forms->table_header = 'Saved Reports'; |
|---|
| 1431 | $saved_forms->table_header_icon = 'insert_drive_file'; |
|---|
| 1432 | $saved_forms->table_headings = array('Id', array('heading'=>__('title','nex-forms'), 'user_func'=>'link_report_title', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id','sort_by'=>'title'), array('heading'=> __('Reporting Form','nex-forms'), 'user_func'=>'NEXForms_get_title3','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms','sort_by'=>'nex_forms_Id'), array('heading'=>__('Total Records','nex-forms'), 'user_func'=>'get_total_report_records', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'db_table'), array('heading'=>__('Last Update','nex-forms'), 'user_func'=>'report_last_update', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'date_time','sort_by'=>'date_time'), array('heading'=>'Export CSV', 'user_func'=>'quick_report_csv', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'), array('heading'=>'Export PDF', 'user_func'=>'quick_report_pdf', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'), array('heading'=>'View/Edit', 'user_func'=>'link_report_title2', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id')); |
|---|
| 1433 | $saved_forms->show_headings=true; |
|---|
| 1434 | $saved_forms->extra_classes = 'my-forms chart-selection'; |
|---|
| 1435 | $saved_forms->search_params = array('Id','title'); |
|---|
| 1436 | $saved_forms->checkout = $dashboard->checkout; |
|---|
| 1437 | $saved_forms->color_adapt = true; |
|---|
| 1438 | $saved_forms->show_delete = true; |
|---|
| 1439 | |
|---|
| 1440 | |
|---|
| 1441 | $output .= '<div class="nex_forms_admin_page_wrapper">'; |
|---|
| 1442 | $output .= NEXForms_new_report_setup(); |
|---|
| 1443 | $output .= '<div class="hidden">'; |
|---|
| 1444 | $output .= $dashboard->dashboard_menu('Dashboard'); |
|---|
| 1445 | $output .= '</div>'; |
|---|
| 1446 | |
|---|
| 1447 | |
|---|
| 1448 | if(!is_array(get_option('7103891'))) |
|---|
| 1449 | { |
|---|
| 1450 | $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0); |
|---|
| 1451 | $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params)); |
|---|
| 1452 | |
|---|
| 1453 | if(is_array($response->errors)) |
|---|
| 1454 | { |
|---|
| 1455 | foreach($response->errors as $error_type => $error) |
|---|
| 1456 | { |
|---|
| 1457 | NEXForms_clean_echo( '<br /><br /><div class="alert alert-danger"><strong>WP ERROR: </strong>'.strtoupper($error_type).' - '.$error[0].'<br />NEX-Forms can not verify your license as a result of this error. Please as your Hosting Provider to resolve this error. <a href="https://www.google.com/search?q='.$error[0].'" target="_blank">Here are some helpfull articles for your Host</a> </div><br /><br /> '); |
|---|
| 1458 | } |
|---|
| 1459 | } |
|---|
| 1460 | else |
|---|
| 1461 | { |
|---|
| 1462 | update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y")))); |
|---|
| 1463 | } |
|---|
| 1464 | } |
|---|
| 1465 | update_option('nf_activated',$dashboard->checkout); |
|---|
| 1466 | |
|---|
| 1467 | |
|---|
| 1468 | $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' ); |
|---|
| 1469 | $output .= '<div id="nex_forms_wpnonce" style="display:none;">'.$nonce_url.'</div>'; |
|---|
| 1470 | |
|---|
| 1471 | $output .= '<div id="dashboard_panel" class="dashboard_panel nf_reporting">'; |
|---|
| 1472 | $output .= $dashboard->new_menu('dashboard'); |
|---|
| 1473 | $output .= '<div class="col-sm-2">'; |
|---|
| 1474 | |
|---|
| 1475 | $output .= '<div class="dashboard-box database_table create_new_form new_report wap_nex_forms new-forms">'; |
|---|
| 1476 | $output .= '<div class=""><span class="icon fas fa-database"></span><br />'.__('Create a New Report','nex-forms').'</div></div>'; |
|---|
| 1477 | $output .= '</div>'; |
|---|
| 1478 | |
|---|
| 1479 | $output .= '<div class="col-sm-10">'; |
|---|
| 1480 | $output .= $saved_forms->print_record_table(); |
|---|
| 1481 | $output .= '</div>'; |
|---|
| 1482 | |
|---|
| 1483 | $output .= '</div>'; |
|---|
| 1484 | $output .= '</div>'; |
|---|
| 1485 | $output .= '</div>'; |
|---|
| 1486 | $output .= '</div>'; //nex_forms_admin_page_wrapper |
|---|
| 1487 | |
|---|
| 1488 | NEXForms_clean_echo( $output); |
|---|
| 1489 | $dashboard->remove_unwanted_styles(); |
|---|
| 1490 | |
|---|
| 1491 | } |
|---|
| 1492 | |
|---|
| 1493 | |
|---|
| 1494 | |
|---|
| 1495 | function NEXForms_new_report_setup(){ |
|---|
| 1496 | |
|---|
| 1497 | $output = ''; |
|---|
| 1498 | |
|---|
| 1499 | |
|---|
| 1500 | global $wpdb; |
|---|
| 1501 | $dashboard = new NEXForms_dashboard(); |
|---|
| 1502 | $dashboard->dashboard_checkout(); |
|---|
| 1503 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 1504 | |
|---|
| 1505 | |
|---|
| 1506 | |
|---|
| 1507 | |
|---|
| 1508 | $nonce_url = wp_create_nonce( 'nf_admin_new_form_actions' ); |
|---|
| 1509 | $output .= '<div id="new_form_setup" class="modal animated fadeInDown">'; |
|---|
| 1510 | //HEADER |
|---|
| 1511 | //$theme = wp_get_theme(); |
|---|
| 1512 | |
|---|
| 1513 | $output .= '<div class="modal-header aa_bg_main">'; |
|---|
| 1514 | $output .= '<div class="modal-close back-to-dash reporting"><span class="fas fa-arrow-left"></span></div><h4><div class="report-bc">'.__('New Report','nex-forms').'</div> - <div class="sub-heading"></div><div class="report-name"></div></h4>'; |
|---|
| 1515 | $output .= '<i class="modal-action modal-close"><i class="fa fa-close"></i></i>'; |
|---|
| 1516 | $output .= '</div>'; |
|---|
| 1517 | //CONTENT |
|---|
| 1518 | $output .= '<div class="modal-content">'; |
|---|
| 1519 | |
|---|
| 1520 | $output .= '<div class="new-report-container" >'; |
|---|
| 1521 | $output .= '<div class="dash-left-col">'; |
|---|
| 1522 | $output .= '<div class="new-form-sidebar2 aa_bg_sec aa_menu" >'; |
|---|
| 1523 | $output .= '<ul>'; |
|---|
| 1524 | |
|---|
| 1525 | $output .= '<li class="db_tab menu-item-has-children active"><a class="" data-panel="panel-1" data-sub-heading="'.__('1. Report Setup','nex-forms').'"><span class="top-icon fa-solid fa-wrench"></span> <span class="menu-text">'.__('Report Setup','nex-forms').'</span></a></li>'; |
|---|
| 1526 | $output .= '<li class="db_tab menu-item-has-children disabled"><a class="" data-panel="panel-2" data-sub-heading="'.__('2. Reporting Field Selection','nex-forms').'"><span class="top-icon fa-solid fa-file-circle-plus"></span> <span class="menu-text">'.__('Reporting Fields','nex-forms').'</span></a></li>'; |
|---|
| 1527 | $output .= '<li class="db_tab menu-item-has-children disabled"><a class="" data-panel="panel-3" data-sub-heading=""><span class="top-icon fa-solid fa-diagram-next"></span> <span class="menu-text">'.__('Generate Report','nex-forms').'</span></a></li>'; |
|---|
| 1528 | |
|---|
| 1529 | $output .= '<ul>'; |
|---|
| 1530 | $output .= '</div>'; |
|---|
| 1531 | $output .= '</div>'; |
|---|
| 1532 | |
|---|
| 1533 | //BLANK |
|---|
| 1534 | $output .= '<div class="rep-center-col">'; |
|---|
| 1535 | $output .= '<div class="new-form-panel ajax_loading"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></div>'; |
|---|
| 1536 | $output .= '<div class="new-form-panel ajax_error_response">'; |
|---|
| 1537 | $output .= '<div class="alert alert-danger">'.__('Sorry, something went wrong while reading the import file. Please try MANUAL IMPORT instead.','nex-forms').'</div>'; |
|---|
| 1538 | $output .= '</div>'; |
|---|
| 1539 | $output .= '<input name="title2" id="form_title" placeholder="'.__('Enter new Form Title','nex-forms').'" class="hidden" type="text">'; |
|---|
| 1540 | $output .= '<form class="new_nex_form_report" name="new_nex_form_report" id="new_nex_form_report" method="post" action="'.admin_url('admin-ajax.php').'">'; |
|---|
| 1541 | $output .= '<input name="nex_forms_wpnonce" type="hidden" value="'.$nonce_url.'">'; |
|---|
| 1542 | $output .= '<div class="report_steps">'; |
|---|
| 1543 | $output .= $dashboard->edit_report(); |
|---|
| 1544 | $output .= '</div>'; |
|---|
| 1545 | $output .= '</form>'; |
|---|
| 1546 | $output .= '</div>'; |
|---|
| 1547 | $output .= '</div>'; |
|---|
| 1548 | $output .= '</div>'; |
|---|
| 1549 | |
|---|
| 1550 | return $output; |
|---|
| 1551 | |
|---|
| 1552 | } |
|---|
| 1553 | |
|---|
| 1554 | if(!class_exists('NEXForms_dashboard')) |
|---|
| 1555 | { |
|---|
| 1556 | class NEXForms_dashboard{ |
|---|
| 1557 | public |
|---|
| 1558 | $table = 'wap_nex_forms', |
|---|
| 1559 | $table_header = '', |
|---|
| 1560 | $extra_classes = '', |
|---|
| 1561 | $table_header_icon = '', |
|---|
| 1562 | $additional_params = array(), |
|---|
| 1563 | $show_search = true, |
|---|
| 1564 | $search_params = array(), |
|---|
| 1565 | $build_table_dropdown = false, |
|---|
| 1566 | $table_headings = array(), |
|---|
| 1567 | $field_selection = array(), |
|---|
| 1568 | $extra_buttons = array(), |
|---|
| 1569 | $show_headings = true, |
|---|
| 1570 | $show_delete = true, |
|---|
| 1571 | $show_paging = true, |
|---|
| 1572 | $table_resize =false, |
|---|
| 1573 | $checkout = false, |
|---|
| 1574 | $client_info = 'no info', |
|---|
| 1575 | $is_report=false, |
|---|
| 1576 | $action_button, |
|---|
| 1577 | $color_adapt=false, |
|---|
| 1578 | $record_limit=10, |
|---|
| 1579 | $sortable_columns = true, |
|---|
| 1580 | $action='', |
|---|
| 1581 | $show_more_link = ''; |
|---|
| 1582 | |
|---|
| 1583 | public function __construct($table='', $table_header='', $extra_classes='', $table_header_icon='',$additional_params='', $search_params='', $table_headings='', $show_headings='', $field_selection ='', $extra_buttons ='', $checkout=false, $sortable_columns = true, $show_search=true, $show_paging=true, $show_delete=false, $is_report=false, $color_adapt=false, $table_resize=false , $record_limit=10, $action=''){ |
|---|
| 1584 | |
|---|
| 1585 | global $wpdb; |
|---|
| 1586 | |
|---|
| 1587 | |
|---|
| 1588 | |
|---|
| 1589 | add_action('wp_ajax_get_table_records', array($this,'get_table_records')); |
|---|
| 1590 | add_action('wp_ajax_do_form_entry_save', array($this,'do_form_entry_save')); |
|---|
| 1591 | add_action('wp_ajax_nf_report_get_additional_params', array($this,'report_get_additional_params')); |
|---|
| 1592 | |
|---|
| 1593 | add_action('wp_ajax_submission_report2', array($this,'submission_report2')); |
|---|
| 1594 | |
|---|
| 1595 | add_action('wp_ajax_nf_print_chart', array($this,'print_chart')); |
|---|
| 1596 | |
|---|
| 1597 | add_action('wp_ajax_nf_delete_form_entry', array($this,'delete_form_entry')); |
|---|
| 1598 | |
|---|
| 1599 | add_action('wp_ajax_nf_entries_restore', array($this,'restore_records')); |
|---|
| 1600 | |
|---|
| 1601 | add_action('wp_ajax_nf_entries_set_starred', array($this,'set_starred')); |
|---|
| 1602 | add_action('wp_ajax_nf_entries_set_read', array($this,'set_read')); |
|---|
| 1603 | |
|---|
| 1604 | add_action('wp_ajax_nf_reset_forms_menu', array($this,'entries_menu')); |
|---|
| 1605 | |
|---|
| 1606 | |
|---|
| 1607 | add_action('wp_ajax_nf_print_to_pdf', array($this,'print_to_pdf')); |
|---|
| 1608 | add_action('wp_ajax_nf_delete_pdf', array($this,'delete_pdf')); |
|---|
| 1609 | |
|---|
| 1610 | |
|---|
| 1611 | |
|---|
| 1612 | |
|---|
| 1613 | add_action('wp_ajax_nf_create_new_report', array($this,'create_report')); |
|---|
| 1614 | add_action('wp_ajax_nf_edit_report', array($this,'edit_report')); |
|---|
| 1615 | |
|---|
| 1616 | |
|---|
| 1617 | //add_action('wp_ajax_nopriv_nf_print_to_pdf', array($this,'print_to_pdf')); |
|---|
| 1618 | |
|---|
| 1619 | add_action('wp_ajax_nf_print_report_to_pdf', array($this,'print_report_to_pdf')); |
|---|
| 1620 | //add_action('wp_ajax_nopriv_nf_print_report_to_pdf', array($this,'print_report_to_pdf')); |
|---|
| 1621 | |
|---|
| 1622 | $this->table = $table; |
|---|
| 1623 | $this->table_resize = $table_resize; |
|---|
| 1624 | $this->table_header = $table_header; |
|---|
| 1625 | $this->table_header_icon = $table_header_icon; |
|---|
| 1626 | $this->additional_params = $additional_params; |
|---|
| 1627 | $this->search_params = $search_params; |
|---|
| 1628 | $this->field_selection = $field_selection; |
|---|
| 1629 | $this->table_headings = $table_headings; |
|---|
| 1630 | $this->show_headings = $show_headings; |
|---|
| 1631 | $this->show_delete = $show_delete; |
|---|
| 1632 | $this->show_paging = $show_paging; |
|---|
| 1633 | $this->extra_buttons = $extra_buttons; |
|---|
| 1634 | $this->extra_classes = $extra_classes; |
|---|
| 1635 | $this->is_report = $is_report; |
|---|
| 1636 | $this->color_adapt = $color_adapt; |
|---|
| 1637 | $this->record_limit = $record_limit; |
|---|
| 1638 | $this->action = $action; |
|---|
| 1639 | $this->sortable_columns = $sortable_columns; |
|---|
| 1640 | } |
|---|
| 1641 | |
|---|
| 1642 | public function edit_report(){ |
|---|
| 1643 | |
|---|
| 1644 | global $wpdb; |
|---|
| 1645 | $dashboard = new NEXForms_dashboard(); |
|---|
| 1646 | $dashboard->dashboard_checkout(); |
|---|
| 1647 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 1648 | $nf_function = new NEXForms_functions(); |
|---|
| 1649 | $nf_functions = new NEXForms_functions(); |
|---|
| 1650 | $report_id = (isset($_POST['report_update_id'])) ? sanitize_title($_POST['report_update_id']) : 0; |
|---|
| 1651 | $output = ''; |
|---|
| 1652 | $report_title = ''; |
|---|
| 1653 | $report_form = ''; |
|---|
| 1654 | $get_report = false; |
|---|
| 1655 | if($report_id) |
|---|
| 1656 | { |
|---|
| 1657 | $get_report = $wpdb->get_row($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id=%d',$report_id)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1658 | |
|---|
| 1659 | |
|---|
| 1660 | $report_title = $get_report->report_title; |
|---|
| 1661 | $report_form = $get_report->nex_forms_Id; |
|---|
| 1662 | $output .= '<div id="report-edit-Id" style="display:none;">'.$report_id.'</div>'; |
|---|
| 1663 | |
|---|
| 1664 | $output .= '<div id="report-status" style="display:none;">'.$get_report->status.'</div>'; |
|---|
| 1665 | } |
|---|
| 1666 | |
|---|
| 1667 | $output .= '<div class="new-report-panel new-report panel-1 active">'; |
|---|
| 1668 | $output .= '<br /><br /><div class="row">'; |
|---|
| 1669 | $output .= '<div class="col-sm-1"></div>'; |
|---|
| 1670 | $output .= '<div class="col-sm-10">'; |
|---|
| 1671 | $output .= '<div class="dashboard-box database_table wap_nex_forms"> |
|---|
| 1672 | |
|---|
| 1673 | <div class="dashboard-box-header aa_bg_main"><div class="table_title font_color_1 ">'.__('Create a new Submission Report','nex-forms').'</div></div> |
|---|
| 1674 | <div class="dashboard-box-content "> |
|---|
| 1675 | '; |
|---|
| 1676 | |
|---|
| 1677 | //$output .= '<h5><strong>'.__('Create a new Blank Form','nex-forms').'</strong></h5>'; |
|---|
| 1678 | |
|---|
| 1679 | $output .= '<div class="row">'; |
|---|
| 1680 | $output .= '<div class="col-sm-2">'; |
|---|
| 1681 | $output .= '<div class="report-setting-label">'.__('Report Title','nex-forms').'</div>'; |
|---|
| 1682 | $output .= '</div>'; |
|---|
| 1683 | $output .= '<div class="col-sm-10">'; |
|---|
| 1684 | $output .= '<input name="report_title" id="report_title" value="'.$report_title.'" maxlength="35" placeholder="'.__('Enter Report Title','nex-forms').'" class="form-control" type="text">'; |
|---|
| 1685 | $output .= '</div>'; |
|---|
| 1686 | $output .= '</div>'; |
|---|
| 1687 | |
|---|
| 1688 | $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1689 | |
|---|
| 1690 | |
|---|
| 1691 | $output .= '<div class="row">'; |
|---|
| 1692 | $output .= '<div class="col-sm-2">'; |
|---|
| 1693 | $output .= '<div class="report-setting-label">'.__('Reporting Form','nex-forms').'</div>'; |
|---|
| 1694 | $output .= '</div>'; |
|---|
| 1695 | $output .= '<div class="col-sm-10">'; |
|---|
| 1696 | |
|---|
| 1697 | $output .= '<select name="form_selection" class="form-control form_selection" data-selected="'.$report_form.'">'; |
|---|
| 1698 | $output .= '<option value="0" selected="selected">'.__('No Form Selected','nex-forms').'</option>'; |
|---|
| 1699 | foreach($forms as $form) |
|---|
| 1700 | { |
|---|
| 1701 | $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id); |
|---|
| 1702 | |
|---|
| 1703 | if($total_entries>0) |
|---|
| 1704 | $output .= '<option class="reporting_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'" value="'.$form->Id.'">'.$form->title.' - '.$total_entries.' '.__('Entries','nex-forms').'</option>'; |
|---|
| 1705 | } |
|---|
| 1706 | $output .= '</select>'; |
|---|
| 1707 | |
|---|
| 1708 | $output .= '</div>'; |
|---|
| 1709 | $output .= '</div>'; |
|---|
| 1710 | |
|---|
| 1711 | |
|---|
| 1712 | |
|---|
| 1713 | $output .= '<div class="row">'; |
|---|
| 1714 | $output .= '<div class="col-sm-2">'; |
|---|
| 1715 | |
|---|
| 1716 | |
|---|
| 1717 | |
|---|
| 1718 | |
|---|
| 1719 | $output .= '</div>'; |
|---|
| 1720 | $output .= '<div class="col-sm-10">'; |
|---|
| 1721 | $output .= '<input type="button" class="form-control create_new_report btn blue " value="SAVE">'; |
|---|
| 1722 | $output .= '</div>'; |
|---|
| 1723 | $output .= '</div>'; |
|---|
| 1724 | |
|---|
| 1725 | |
|---|
| 1726 | |
|---|
| 1727 | |
|---|
| 1728 | |
|---|
| 1729 | |
|---|
| 1730 | $output .= '</div></div>'; |
|---|
| 1731 | $output .= '</div>'; |
|---|
| 1732 | |
|---|
| 1733 | $output .= '<div class="col-sm-1"></div>'; |
|---|
| 1734 | $output .= '</div>'; |
|---|
| 1735 | $output .= '</div>'; |
|---|
| 1736 | |
|---|
| 1737 | $output .= '<div class="new-report-panel new-report panel-2">'; |
|---|
| 1738 | |
|---|
| 1739 | if($get_report) |
|---|
| 1740 | { |
|---|
| 1741 | $form_Id = $report_form; |
|---|
| 1742 | $get_form_fields = $wpdb->get_row($wpdb->prepare('SELECT title,field_details FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id=%d',sanitize_title($form_Id))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1743 | |
|---|
| 1744 | //$wpdb->show_errors(); |
|---|
| 1745 | //$wpdb->print_errors(); |
|---|
| 1746 | $set_form_fields = json_decode($get_form_fields->field_details,true); |
|---|
| 1747 | $get_report_fields = json_decode($get_report->report_fields,true); |
|---|
| 1748 | |
|---|
| 1749 | $output .= '<div class="report_field_row header">'; |
|---|
| 1750 | |
|---|
| 1751 | $output .= '<div class="col-1">'; |
|---|
| 1752 | $output .= '<input type="checkbox" name="toggel_field_selection" class="toggel_field_selection" checked="checked" value="">'; |
|---|
| 1753 | $output .= '</div>'; |
|---|
| 1754 | |
|---|
| 1755 | |
|---|
| 1756 | $output .= '<div class="col-2">'; |
|---|
| 1757 | $output .= __('Field Name','nex-forms'); |
|---|
| 1758 | $output .= '</div>'; |
|---|
| 1759 | |
|---|
| 1760 | $output .= '<div class="col-3">'; |
|---|
| 1761 | $output .= __('Database Column Name','nex-forms'); |
|---|
| 1762 | $output .= '</div>'; |
|---|
| 1763 | $output .= '</div>'; |
|---|
| 1764 | |
|---|
| 1765 | $output .= '<div class="report_field_selection">'; |
|---|
| 1766 | |
|---|
| 1767 | $output .= '<div class="report_field_row">'; |
|---|
| 1768 | $output .= '<div class="col-1">'; |
|---|
| 1769 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array('entry_id',$get_report_fields)) ? 'checked="checked"' : '').' value="entry_id">'; |
|---|
| 1770 | $output .= '</div>'; |
|---|
| 1771 | $output .= '<div class="col-2">'; |
|---|
| 1772 | $output .= 'Entry Id'; |
|---|
| 1773 | $output .= '</div>'; |
|---|
| 1774 | |
|---|
| 1775 | $output .= '<div class="col-3">'; |
|---|
| 1776 | $output .= 'entry_id'; |
|---|
| 1777 | $output .= '</div>'; |
|---|
| 1778 | $output .= '</div>'; |
|---|
| 1779 | |
|---|
| 1780 | |
|---|
| 1781 | |
|---|
| 1782 | $output .= '<div class="report_field_row">'; |
|---|
| 1783 | $output .= '<div class="col-1">'; |
|---|
| 1784 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array('date_time',$get_report_fields)) ? 'checked="checked"' : '').' value="date_time">'; |
|---|
| 1785 | $output .= '</div>'; |
|---|
| 1786 | $output .= '<div class="col-2">'; |
|---|
| 1787 | $output .= 'Date Time'; |
|---|
| 1788 | $output .= '</div>'; |
|---|
| 1789 | $output .= '<div class="col-3">'; |
|---|
| 1790 | $output .= 'date_time'; |
|---|
| 1791 | $output .= '</div>'; |
|---|
| 1792 | $output .= '</div>'; |
|---|
| 1793 | |
|---|
| 1794 | |
|---|
| 1795 | $records = $wpdb->get_results($wpdb->prepare('SELECT * FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE `nex_forms_Id`=%d ORDER BY `last_update` DESC LIMIT 500 OFFSET 0', sanitize_text_field($report_form))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1796 | |
|---|
| 1797 | |
|---|
| 1798 | foreach($records as $data) |
|---|
| 1799 | { |
|---|
| 1800 | $form_values = json_decode($data->form_data); |
|---|
| 1801 | |
|---|
| 1802 | foreach($form_values as $field) |
|---|
| 1803 | { |
|---|
| 1804 | $header_array[$field->field_name] = $nf_functions->format_column_name($field->field_name); |
|---|
| 1805 | } |
|---|
| 1806 | }; |
|---|
| 1807 | |
|---|
| 1808 | $i = 0; |
|---|
| 1809 | foreach($header_array as $key=>$field) |
|---|
| 1810 | { |
|---|
| 1811 | |
|---|
| 1812 | if($field) |
|---|
| 1813 | { |
|---|
| 1814 | //if(in_array( |
|---|
| 1815 | $output .= '<div class="report_field_row">'; |
|---|
| 1816 | |
|---|
| 1817 | $output .= '<div class="col-1">'; |
|---|
| 1818 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array($nf_functions->format_column_name(str_replace('[]','',$field)),$get_report_fields)) ? 'checked="checked"' : '').' value="'.$nf_functions->format_column_name(str_replace('[]','',$field)).'">'; |
|---|
| 1819 | $output .= '</div>'; |
|---|
| 1820 | |
|---|
| 1821 | |
|---|
| 1822 | $output .= '<div class="col-2">'; |
|---|
| 1823 | $output .= $nf_functions->unformat_name($key); |
|---|
| 1824 | $output .= '<input type="hidden" name="field_selection['.$i.'][field_name]" value="'.$nf_functions->format_column_name(str_replace('[]','',$field)).'">'; |
|---|
| 1825 | $output .= '</div>'; |
|---|
| 1826 | |
|---|
| 1827 | $output .= '<div class="col-3">'; |
|---|
| 1828 | $output .= '<input type="text" class="form-control" name="field_selection['.$i.'][col_name]" maxlength="64" value="'.$nf_functions->format_column_name(str_replace('[]','',$field)).'">'; |
|---|
| 1829 | $output .= '</div>'; |
|---|
| 1830 | $output .= '</div>'; |
|---|
| 1831 | } |
|---|
| 1832 | $i++; |
|---|
| 1833 | } |
|---|
| 1834 | |
|---|
| 1835 | |
|---|
| 1836 | |
|---|
| 1837 | /*$i = 0; |
|---|
| 1838 | foreach($set_form_fields as $key=>$field) |
|---|
| 1839 | { |
|---|
| 1840 | |
|---|
| 1841 | if($field['field_name']) |
|---|
| 1842 | { |
|---|
| 1843 | $output .= '<div class="report_field_row">'; |
|---|
| 1844 | |
|---|
| 1845 | $output .= '<div class="col-1">'; |
|---|
| 1846 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array($nf_function->format_column_name(str_replace('[]','',$field['field_name'])),$get_report_fields)) ? 'checked="checked"' : '').' value="'.$nf_function->format_column_name(str_replace('[]','',$field['field_name'])).'">'; |
|---|
| 1847 | $output .= '</div>'; |
|---|
| 1848 | |
|---|
| 1849 | |
|---|
| 1850 | $output .= '<div class="col-2">'; |
|---|
| 1851 | $output .= $nf_function->unformat_name($field['field_name']); |
|---|
| 1852 | $output .= '<input type="hidden" name="field_selection['.$i.'][field_name]" value="'.$nf_function->format_column_name(str_replace('[]','',$field['field_name'])).'">'; |
|---|
| 1853 | $output .= '</div>'; |
|---|
| 1854 | |
|---|
| 1855 | $output .= '<div class="col-3">'; |
|---|
| 1856 | $output .= '<input type="text" class="form-control" name="field_selection['.$i.'][col_name]" maxlength="64" value="'.$nf_function->format_column_name(str_replace('[]','',$field['field_name'])).'">'; |
|---|
| 1857 | $output .= '</div>'; |
|---|
| 1858 | $output .= '</div>'; |
|---|
| 1859 | } |
|---|
| 1860 | $i++; |
|---|
| 1861 | }*/ |
|---|
| 1862 | |
|---|
| 1863 | $output .= '</div>'; |
|---|
| 1864 | } |
|---|
| 1865 | |
|---|
| 1866 | $output .= '<div class="report_field_row footer">'; |
|---|
| 1867 | $output .= '<div class="">'; |
|---|
| 1868 | $output .= '<input type="button" class="form-control set_field_selection btn blue" value="Generate Report">'; |
|---|
| 1869 | $output .= '</div>'; |
|---|
| 1870 | $output .= '</div>'; |
|---|
| 1871 | $output .= '</div>'; |
|---|
| 1872 | |
|---|
| 1873 | |
|---|
| 1874 | $output .= '<div class="new-report-panel new-report panel-3">'; |
|---|
| 1875 | |
|---|
| 1876 | |
|---|
| 1877 | if($get_report) |
|---|
| 1878 | { |
|---|
| 1879 | |
|---|
| 1880 | |
|---|
| 1881 | |
|---|
| 1882 | $output .= '<div class="add_clause">'; |
|---|
| 1883 | $output .= '<a class="nf_button aa_bg_sec_btn add_new_where_clause2"><i class="fa fa-plus"></i> Add Filter </a>'; |
|---|
| 1884 | $output .= '<a class="nf_button aa_bg_sec_btn run_query_2 run_query" id="'.sanitize_text_field($report_form).'"><i class="fa fa-file-import"></i> Run Query </a>'; |
|---|
| 1885 | $output .= '<div class="close_filters"><span class="fas fa-arrow-left"></span></div>'; |
|---|
| 1886 | $output .= '</div>'; |
|---|
| 1887 | |
|---|
| 1888 | $output .= '<div class="right-col-top">'; |
|---|
| 1889 | |
|---|
| 1890 | $output .= $dashboard->report_get_additional_params(true,$report_id); |
|---|
| 1891 | |
|---|
| 1892 | $output .= '</div>'; |
|---|
| 1893 | |
|---|
| 1894 | |
|---|
| 1895 | |
|---|
| 1896 | $output .= '<div class="right-bottom">'; |
|---|
| 1897 | $output .= '</div>'; |
|---|
| 1898 | |
|---|
| 1899 | } |
|---|
| 1900 | $output .= '</div>'; |
|---|
| 1901 | |
|---|
| 1902 | |
|---|
| 1903 | $output .= '</div>'; |
|---|
| 1904 | |
|---|
| 1905 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 1906 | |
|---|
| 1907 | if($do_ajax) |
|---|
| 1908 | { |
|---|
| 1909 | NEXForms_clean_echo($output); |
|---|
| 1910 | wp_die(); |
|---|
| 1911 | } |
|---|
| 1912 | else |
|---|
| 1913 | return $output; |
|---|
| 1914 | |
|---|
| 1915 | } |
|---|
| 1916 | |
|---|
| 1917 | |
|---|
| 1918 | public function create_report(){ |
|---|
| 1919 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) { |
|---|
| 1920 | wp_die(); |
|---|
| 1921 | } |
|---|
| 1922 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 1923 | wp_die(); |
|---|
| 1924 | |
|---|
| 1925 | global $wpdb; |
|---|
| 1926 | |
|---|
| 1927 | |
|---|
| 1928 | $nf_function = new NEXForms_functions(); |
|---|
| 1929 | $nf_functions = new NEXForms_functions(); |
|---|
| 1930 | $table_name = $wpdb->prefix.'nex_forms_'.$nf_function->format_column_name(sanitize_title($_POST['report_title'])); |
|---|
| 1931 | |
|---|
| 1932 | $update_id = sanitize_title($_POST['report_update_id']); |
|---|
| 1933 | |
|---|
| 1934 | |
|---|
| 1935 | $output = ''; |
|---|
| 1936 | |
|---|
| 1937 | $tz = wp_timezone(); |
|---|
| 1938 | $set_date = new DateTime("now", $tz); |
|---|
| 1939 | |
|---|
| 1940 | if($update_id!=0) |
|---|
| 1941 | { |
|---|
| 1942 | $get_existing_table = $wpdb->get_var($wpdb->prepare('SELECT db_table FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id = %d',$update_id)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1943 | $update = $wpdb->update ( $wpdb->prefix.'wap_nex_forms_reports', array // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1944 | ( |
|---|
| 1945 | 'report_title'=>sanitize_text_field($_POST['report_title']), |
|---|
| 1946 | 'nex_forms_Id'=>sanitize_text_field($_POST['report_form']), |
|---|
| 1947 | 'db_table'=>$table_name, |
|---|
| 1948 | 'date_time' => $set_date->format('Y-m-d H:i:s'), |
|---|
| 1949 | ), array( 'Id' => $update_id) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1950 | |
|---|
| 1951 | if($get_existing_table != $table_name) |
|---|
| 1952 | { |
|---|
| 1953 | if($wpdb->get_var("show tables like '".$get_existing_table."'")) // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1954 | { |
|---|
| 1955 | $wpdb->query("RENAME TABLE `".$get_existing_table."` TO `".$table_name."`"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1956 | } |
|---|
| 1957 | } |
|---|
| 1958 | $output .= '<div id="report-edit-Id" style="display:none;">'.$update_id.'</div>'; |
|---|
| 1959 | } |
|---|
| 1960 | else |
|---|
| 1961 | { |
|---|
| 1962 | $table_exists = $wpdb->get_var($wpdb->prepare('SELECT db_table FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE db_table = %s',$table_name)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1963 | |
|---|
| 1964 | if($table_exists) |
|---|
| 1965 | { |
|---|
| 1966 | NEXForms_clean_echo( 'Report <strong>'.sanitize_text_field($_POST['report_title']).'</strong> already exists. Please choose another report title.'); |
|---|
| 1967 | wp_die(); |
|---|
| 1968 | } |
|---|
| 1969 | $insert = $wpdb->insert ( $wpdb->prefix.'wap_nex_forms_reports', array // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1970 | ( |
|---|
| 1971 | 'report_title'=>sanitize_text_field($_POST['report_title']), |
|---|
| 1972 | 'nex_forms_Id'=>sanitize_text_field($_POST['report_form']), |
|---|
| 1973 | 'db_table'=>$table_name, |
|---|
| 1974 | 'date_time' => $set_date->format('Y-m-d H:i:s'), |
|---|
| 1975 | 'status'=>2 |
|---|
| 1976 | ) ); |
|---|
| 1977 | $insert_id = $wpdb->insert_id; |
|---|
| 1978 | $output .= '<div id="report-edit-Id" style="display:none;">'.$insert_id.'</div>'; |
|---|
| 1979 | } |
|---|
| 1980 | |
|---|
| 1981 | $form_Id = sanitize_title($_POST['report_form']); |
|---|
| 1982 | $get_form_fields = $wpdb->get_row($wpdb->prepare('SELECT title,field_details FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id=%d',sanitize_title($form_Id))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 1983 | |
|---|
| 1984 | //$wpdb->show_errors(); |
|---|
| 1985 | //$wpdb->print_errors(); |
|---|
| 1986 | $set_form_fields = json_decode($get_form_fields->field_details,true); |
|---|
| 1987 | |
|---|
| 1988 | /*if(!$set_form_fields) |
|---|
| 1989 | { |
|---|
| 1990 | $output .= '<div class="erro_msg_panel alert alert-danger">'.__('This form needs to be resaved to made ready for reporting 2.0','nex-forms').'<a href="'.get_admin_url().'admin.php?page=nex-forms-builder&open_form='.$form_Id.'" class="form_title" title="Edit - '.$title.'" data-title="'.__('Edit Form','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom">'.__(' RE-SAVE ', 'nex-forms').$get_form_fields->title.' '.__('form now', 'nex-forms').'.</a></div>'; |
|---|
| 1991 | }*/ |
|---|
| 1992 | |
|---|
| 1993 | //echo '<pre>'; |
|---|
| 1994 | //print_r($set_form_fields); |
|---|
| 1995 | //echo '<pre>'; |
|---|
| 1996 | |
|---|
| 1997 | $output .= '<div class="report_field_row header">'; |
|---|
| 1998 | |
|---|
| 1999 | $output .= '<div class="col-1">'; |
|---|
| 2000 | $output .= '<input type="checkbox" name="toggel_field_selection" class="toggel_field_selection" checked="checked" value="">'; |
|---|
| 2001 | $output .= '</div>'; |
|---|
| 2002 | |
|---|
| 2003 | |
|---|
| 2004 | $output .= '<div class="col-2">'; |
|---|
| 2005 | $output .= __('Field Name','nex-forms'); |
|---|
| 2006 | $output .= '</div>'; |
|---|
| 2007 | |
|---|
| 2008 | $output .= '<div class="col-3">'; |
|---|
| 2009 | $output .= __('Database Column Name','nex-forms'); |
|---|
| 2010 | $output .= '</div>'; |
|---|
| 2011 | $output .= '</div>'; |
|---|
| 2012 | |
|---|
| 2013 | $output .= '<div class="report_field_selection">'; |
|---|
| 2014 | |
|---|
| 2015 | $records = $wpdb->get_results($wpdb->prepare('SELECT * FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE `nex_forms_Id`=%d ORDER BY `last_update` DESC LIMIT 500 OFFSET 0', sanitize_text_field($_POST['report_form']))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2016 | |
|---|
| 2017 | |
|---|
| 2018 | foreach($records as $data) |
|---|
| 2019 | { |
|---|
| 2020 | $form_values = json_decode($data->form_data); |
|---|
| 2021 | |
|---|
| 2022 | foreach($form_values as $field) |
|---|
| 2023 | { |
|---|
| 2024 | $header_array[$field->field_name] = $nf_functions->format_column_name($field->field_name); |
|---|
| 2025 | } |
|---|
| 2026 | }; |
|---|
| 2027 | //$get_submitted_fields = json_decode($records['form_data'],true); |
|---|
| 2028 | //echo '####<pre>'; |
|---|
| 2029 | //print_r($header_array); |
|---|
| 2030 | //echo '</pre>'; |
|---|
| 2031 | |
|---|
| 2032 | $field_selection = $header_array; |
|---|
| 2033 | |
|---|
| 2034 | |
|---|
| 2035 | if($update_id!=0) |
|---|
| 2036 | { |
|---|
| 2037 | $get_field_selection = $wpdb->get_var($wpdb->prepare('SELECT report_fields FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id = %d',$update_id)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2038 | |
|---|
| 2039 | $field_selection = json_decode($get_field_selection,true); |
|---|
| 2040 | |
|---|
| 2041 | } |
|---|
| 2042 | |
|---|
| 2043 | |
|---|
| 2044 | $output .= '<div class="report_field_row">'; |
|---|
| 2045 | $output .= '<div class="col-1">'; |
|---|
| 2046 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array('entry_id',$field_selection)) ? 'checked="checked"' : '').' value="entry_id">'; |
|---|
| 2047 | $output .= '</div>'; |
|---|
| 2048 | $output .= '<div class="col-2">'; |
|---|
| 2049 | $output .= 'Entry Id'; |
|---|
| 2050 | $output .= '</div>'; |
|---|
| 2051 | |
|---|
| 2052 | $output .= '<div class="col-3">'; |
|---|
| 2053 | $output .= 'entry_id'; |
|---|
| 2054 | $output .= '</div>'; |
|---|
| 2055 | $output .= '</div>'; |
|---|
| 2056 | |
|---|
| 2057 | |
|---|
| 2058 | |
|---|
| 2059 | $output .= '<div class="report_field_row">'; |
|---|
| 2060 | $output .= '<div class="col-1">'; |
|---|
| 2061 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array('date_time',$field_selection)) ? 'checked="checked"' : '').' value="date_time">'; |
|---|
| 2062 | $output .= '</div>'; |
|---|
| 2063 | $output .= '<div class="col-2">'; |
|---|
| 2064 | $output .= 'Date Time'; |
|---|
| 2065 | $output .= '</div>'; |
|---|
| 2066 | $output .= '<div class="col-3">'; |
|---|
| 2067 | $output .= 'date_time'; |
|---|
| 2068 | $output .= '</div>'; |
|---|
| 2069 | $output .= '</div>'; |
|---|
| 2070 | |
|---|
| 2071 | |
|---|
| 2072 | |
|---|
| 2073 | |
|---|
| 2074 | |
|---|
| 2075 | |
|---|
| 2076 | |
|---|
| 2077 | $i = 0; |
|---|
| 2078 | |
|---|
| 2079 | foreach($header_array as $key=>$field) |
|---|
| 2080 | { |
|---|
| 2081 | |
|---|
| 2082 | if($field) |
|---|
| 2083 | { |
|---|
| 2084 | //if(in_array( |
|---|
| 2085 | $output .= '<div class="report_field_row">'; |
|---|
| 2086 | |
|---|
| 2087 | $output .= '<div class="col-1">'; |
|---|
| 2088 | $output .= '<input type="checkbox" name="showhide_fields[]" '.((in_array($nf_functions->format_column_name(str_replace('[]','',$field)),$field_selection)) ? 'checked="checked"' : '').' value="'.$nf_function->format_column_name(str_replace('[]','',$field)).'">'; |
|---|
| 2089 | $output .= '</div>'; |
|---|
| 2090 | |
|---|
| 2091 | |
|---|
| 2092 | $output .= '<div class="col-2">'; |
|---|
| 2093 | $output .= $nf_function->unformat_name($key); |
|---|
| 2094 | $output .= '<input type="hidden" name="field_selection['.$i.'][field_name]" value="'.$nf_function->format_column_name(str_replace('[]','',$field)).'">'; |
|---|
| 2095 | $output .= '</div>'; |
|---|
| 2096 | |
|---|
| 2097 | $output .= '<div class="col-3">'; |
|---|
| 2098 | $output .= '<input type="text" class="form-control" name="field_selection['.$i.'][col_name]" maxlength="64" value="'.$nf_function->format_column_name(str_replace('[]','',$field)).'">'; |
|---|
| 2099 | $output .= '</div>'; |
|---|
| 2100 | $output .= '</div>'; |
|---|
| 2101 | } |
|---|
| 2102 | $i++; |
|---|
| 2103 | } |
|---|
| 2104 | |
|---|
| 2105 | |
|---|
| 2106 | |
|---|
| 2107 | |
|---|
| 2108 | |
|---|
| 2109 | $output .= '</div>'; |
|---|
| 2110 | |
|---|
| 2111 | $output .= '<div class="report_field_row footer">'; |
|---|
| 2112 | $output .= '<div class="">'; |
|---|
| 2113 | $output .= '<input type="button" class="form-control set_field_selection btn blue" value="Generate Report">'; |
|---|
| 2114 | $output .= '</div>'; |
|---|
| 2115 | $output .= '</div>'; |
|---|
| 2116 | |
|---|
| 2117 | NEXForms_clean_echo( $output); |
|---|
| 2118 | wp_die(); |
|---|
| 2119 | |
|---|
| 2120 | } |
|---|
| 2121 | |
|---|
| 2122 | |
|---|
| 2123 | public function entries_menu(){ |
|---|
| 2124 | |
|---|
| 2125 | global $wpdb; |
|---|
| 2126 | $output = ''; |
|---|
| 2127 | |
|---|
| 2128 | $nf_function = new NEXForms_functions(); |
|---|
| 2129 | |
|---|
| 2130 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 2131 | |
|---|
| 2132 | $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2133 | |
|---|
| 2134 | |
|---|
| 2135 | $total_all = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL'))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2136 | |
|---|
| 2137 | $additional_params = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 2138 | $total_unread = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params); |
|---|
| 2139 | |
|---|
| 2140 | $output .= '<ul class="forms_menu aa_menu">'; |
|---|
| 2141 | |
|---|
| 2142 | |
|---|
| 2143 | |
|---|
| 2144 | $output .= '<li class="form_item top_item dropable all_entries" data-form-id="0" data-folder="all_entries">'; |
|---|
| 2145 | $output .= '<a class="form_item all_entries main_item active" ><span class="menu_icon fas fa-inbox"></span><span class="form_title">'.__('Inbox','nex-forms').'</span><span class="form_entry_total"><span class="menu_badge">'.$total_all.'</span><span class="form_entry_unread">'.(($total_unread<=0) ? '' : ' ('.$total_unread.')' ).'</span></span></a>'; |
|---|
| 2146 | |
|---|
| 2147 | //$output .= '<ul class="forms_menu aa_menu aa_bg_tri">'; |
|---|
| 2148 | $output .= '</li>'; |
|---|
| 2149 | foreach($forms as $form) |
|---|
| 2150 | { |
|---|
| 2151 | $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id); |
|---|
| 2152 | |
|---|
| 2153 | $additional_params_form = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 2154 | $total_unread_form = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params_form,$form->Id); |
|---|
| 2155 | |
|---|
| 2156 | if($total_entries>0) |
|---|
| 2157 | $output .= '<li class="form_item sub_form_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'" data-folder="form_entries_'.$form->Id.'"><a class="form_item form_entries_'.$form->Id.'"><span class="form_title">'.$form->title.'</span><span class="form_entry_total"><span class="menu_badge">'.$total_entries.'</span> <span class="form_entry_unread">'.(($total_unread_form>0) ? ' ('.$total_unread_form.')' : '' ).'</span></span></a></li>'; |
|---|
| 2158 | } |
|---|
| 2159 | |
|---|
| 2160 | //$output .= '</ul>'; |
|---|
| 2161 | |
|---|
| 2162 | |
|---|
| 2163 | /*$output .= '<li class="form_item top_item dropable entry_attachment" data-folder="entry_attachment">'; |
|---|
| 2164 | $output .= '<a class="form_item entry_attachment main_item" ><span class="menu_icon fas fa-paperclip"></span><span class="form_title">'.__('Attachments','nex-forms').'</span></a>'; |
|---|
| 2165 | $output .= '</li>'; |
|---|
| 2166 | |
|---|
| 2167 | $output .= '<li class="form_item top_item dropable starred_entries" data-folder="starred_entries">'; |
|---|
| 2168 | $output .= '<a class="form_item starred_entries main_item" ><span class="menu_icon fas fa-star"></span><span class="form_title">'.__('Starred','nex-forms').'</span></a>'; |
|---|
| 2169 | $output .= '</li>';*/ |
|---|
| 2170 | |
|---|
| 2171 | $output .= '<li class="form_item top_item dropable paypal_entries" data-folder="payment_entries">'; |
|---|
| 2172 | $output .= '<a class="form_item payment_entries main_item" ><span class="menu_icon fab fa-paypal"></span><span class="form_title">'.__('PayPal Payments','nex-forms').'</span></a>'; |
|---|
| 2173 | $output .= '</li>'; |
|---|
| 2174 | //$output .= '<ul class="forms_menu aa_menu ">'; |
|---|
| 2175 | |
|---|
| 2176 | $output .= '<li class="form_item sub_form_item dropable paypal_entries_paid" data-folder="payment_entries_paid">'; |
|---|
| 2177 | $output .= '<a class="form_item form_item_sec payment_entries_paid" ><span class="menu_icon fas fa-check"></span><span class="form_title">'.__('Paid','nex-forms').'</span></a>'; |
|---|
| 2178 | $output .= '</li>'; |
|---|
| 2179 | |
|---|
| 2180 | $output .= '<li class="form_item sub_form_item dropable paypal_entries_unpaid" data-folder="payment_entries_unpaid">'; |
|---|
| 2181 | $output .= '<a class="form_item form_item_sec payment_entries_unpaid" ><span class="menu_icon fas fa-times"></span><span class="form_title">'.__('Unpaid','nex-forms').'</span></a>'; |
|---|
| 2182 | $output .= '</li>'; |
|---|
| 2183 | |
|---|
| 2184 | $output .= '<li class="form_item sub_form_item dropable paypal_entries_pending" data-folder="payment_entries_pending">'; |
|---|
| 2185 | $output .= '<a class="form_item form_item_sec payment_entries_pending" ><span class="menu_icon fas fa-sync-alt"></span><span class="form_title">'.__('Pending','nex-forms').'</span></a>'; |
|---|
| 2186 | $output .= '</li>'; |
|---|
| 2187 | |
|---|
| 2188 | //$output .= '</ul>'; |
|---|
| 2189 | |
|---|
| 2190 | |
|---|
| 2191 | /*$output .= '<li class="form_item dropable archived_entries">'; |
|---|
| 2192 | $output .= '<a class="form_item archived_entries main_item"><span class="menu_icon fas fa-archive"></span><span class="form_title">'.__('Archived','nex-forms').'</span></a>'; |
|---|
| 2193 | $output .= '</li>';*/ |
|---|
| 2194 | |
|---|
| 2195 | $output .= '<li class="form_item top_item dropable trashed_entries" data-form-id="0" data-folder="trashed_entries">'; |
|---|
| 2196 | $output .= '<a class="form_item trashed_entries main_item"><span class="menu_icon fas fa-trash"></span><span class="form_title">'.__('Trash','nex-forms').'</span></a>'; |
|---|
| 2197 | $output .= '</li>'; |
|---|
| 2198 | |
|---|
| 2199 | |
|---|
| 2200 | $output .= '</ul>'; |
|---|
| 2201 | |
|---|
| 2202 | |
|---|
| 2203 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 2204 | |
|---|
| 2205 | if($do_ajax) |
|---|
| 2206 | { |
|---|
| 2207 | NEXForms_clean_echo($output); |
|---|
| 2208 | wp_die(); |
|---|
| 2209 | } |
|---|
| 2210 | else |
|---|
| 2211 | return $output; |
|---|
| 2212 | |
|---|
| 2213 | } |
|---|
| 2214 | |
|---|
| 2215 | |
|---|
| 2216 | public function uploads_menu(){ |
|---|
| 2217 | |
|---|
| 2218 | global $wpdb; |
|---|
| 2219 | $output = ''; |
|---|
| 2220 | |
|---|
| 2221 | $nf_function = new NEXForms_functions(); |
|---|
| 2222 | |
|---|
| 2223 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 2224 | |
|---|
| 2225 | $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2226 | |
|---|
| 2227 | |
|---|
| 2228 | $total_all = $database_actions->get_total_records('wap_nex_forms_files',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL'))); |
|---|
| 2229 | |
|---|
| 2230 | |
|---|
| 2231 | $output .= '<ul class="forms_menu aa_menu">'; |
|---|
| 2232 | |
|---|
| 2233 | |
|---|
| 2234 | |
|---|
| 2235 | $output .= '<li class="form_item top_item dropable all_entries" data-form-id="0" data-folder="all_entries">'; |
|---|
| 2236 | $output .= '<a class="form_item all_entries main_item active" ><span class="menu_icon fas fa-file-upload"></span><span class="form_title">'.__('All Files','nex-forms').'</span><span class="form_entry_total"><span class="menu_badge">'.$total_all.'</span><span class="form_entry_unread">'.((isset($total_unread) && $total_unread<=0) ? '' : ' ('.((isset($total_unread)) ? $total_unread : '').')' ).'</span></span></a>'; |
|---|
| 2237 | |
|---|
| 2238 | //$output .= '<ul class="forms_menu aa_menu aa_bg_tri">'; |
|---|
| 2239 | $output .= '</li>'; |
|---|
| 2240 | foreach($forms as $form) |
|---|
| 2241 | { |
|---|
| 2242 | $total_entries = $database_actions->get_total_records('wap_nex_forms_files',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id); |
|---|
| 2243 | |
|---|
| 2244 | |
|---|
| 2245 | if($total_entries>0) |
|---|
| 2246 | $output .= '<li class="form_item sub_form_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'" data-folder="form_entries_'.$form->Id.'"><a class="form_item form_entries_'.$form->Id.'"><span class="form_title">'.$form->title.'</span><span class="form_entry_total"><span class="menu_badge">'.$total_entries.'</span></span></a></li>'; |
|---|
| 2247 | } |
|---|
| 2248 | |
|---|
| 2249 | |
|---|
| 2250 | |
|---|
| 2251 | |
|---|
| 2252 | |
|---|
| 2253 | |
|---|
| 2254 | $output .= '</ul>'; |
|---|
| 2255 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 2256 | |
|---|
| 2257 | if($do_ajax) |
|---|
| 2258 | { |
|---|
| 2259 | NEXForms_clean_echo($output); |
|---|
| 2260 | wp_die(); |
|---|
| 2261 | } |
|---|
| 2262 | else |
|---|
| 2263 | return $output; |
|---|
| 2264 | |
|---|
| 2265 | } |
|---|
| 2266 | |
|---|
| 2267 | |
|---|
| 2268 | public function reporting_menu(){ |
|---|
| 2269 | |
|---|
| 2270 | global $wpdb; |
|---|
| 2271 | $output = ''; |
|---|
| 2272 | |
|---|
| 2273 | $nf_function = new NEXForms_functions(); |
|---|
| 2274 | |
|---|
| 2275 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 2276 | |
|---|
| 2277 | $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2278 | |
|---|
| 2279 | |
|---|
| 2280 | $total_all = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL'))); |
|---|
| 2281 | |
|---|
| 2282 | $additional_params = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 2283 | $total_unread = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params); |
|---|
| 2284 | |
|---|
| 2285 | $output .= '<div class="menu_head aa_bg_sec font_color_1">Select form to create report</div>'; |
|---|
| 2286 | $output .= '<ul class="forms_menu aa_menu">'; |
|---|
| 2287 | |
|---|
| 2288 | |
|---|
| 2289 | |
|---|
| 2290 | |
|---|
| 2291 | |
|---|
| 2292 | |
|---|
| 2293 | foreach($forms as $form) |
|---|
| 2294 | { |
|---|
| 2295 | $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id); |
|---|
| 2296 | |
|---|
| 2297 | $additional_params_form = '';//array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 2298 | $total_unread_form = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params_form,$form->Id); |
|---|
| 2299 | |
|---|
| 2300 | if($total_entries>0) |
|---|
| 2301 | $output .= '<li class="reporting_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'"><a class="form_item"><span class="form_title">'.$nf_function->view_excerpt2($form->title,20).'</span><span class="form_entry_total"><span class="menu_badge">'.(($total_unread_form>0) ? ''.$total_unread_form.'' : '' ).'</span></span></a></li>'; |
|---|
| 2302 | } |
|---|
| 2303 | |
|---|
| 2304 | |
|---|
| 2305 | |
|---|
| 2306 | $output .= '</ul>'; |
|---|
| 2307 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 2308 | |
|---|
| 2309 | if($do_ajax) |
|---|
| 2310 | { |
|---|
| 2311 | NEXForms_clean_echo($output); |
|---|
| 2312 | wp_die(); |
|---|
| 2313 | } |
|---|
| 2314 | else |
|---|
| 2315 | return $output; |
|---|
| 2316 | |
|---|
| 2317 | } |
|---|
| 2318 | |
|---|
| 2319 | |
|---|
| 2320 | |
|---|
| 2321 | public function analytics_menu(){ |
|---|
| 2322 | |
|---|
| 2323 | global $wpdb; |
|---|
| 2324 | $output = ''; |
|---|
| 2325 | |
|---|
| 2326 | $nf_function = new NEXForms_functions(); |
|---|
| 2327 | |
|---|
| 2328 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 2329 | |
|---|
| 2330 | $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2331 | |
|---|
| 2332 | |
|---|
| 2333 | $total_all = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL'))); |
|---|
| 2334 | |
|---|
| 2335 | $additional_params = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 2336 | $total_unread = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params); |
|---|
| 2337 | |
|---|
| 2338 | //$output .= '<div class="menu_head aa_bg_sec font_color_1">Select form to create report</div>'; |
|---|
| 2339 | $output .= '<ul class="forms_menu aa_menu">'; |
|---|
| 2340 | |
|---|
| 2341 | |
|---|
| 2342 | |
|---|
| 2343 | $output .= '<li class="analytics_item form_id_0" data-form-id="0"><a class="form_item active"><span class="form_title">All Forms</span></a></li>'; |
|---|
| 2344 | |
|---|
| 2345 | |
|---|
| 2346 | foreach($forms as $form) |
|---|
| 2347 | { |
|---|
| 2348 | $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id); |
|---|
| 2349 | |
|---|
| 2350 | $additional_params_form = '';//array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL')); |
|---|
| 2351 | $total_unread_form = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params_form,$form->Id); |
|---|
| 2352 | |
|---|
| 2353 | //if($total_entries>0) |
|---|
| 2354 | $output .= '<li class="analytics_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'"><a class="form_item"><span class="form_title">'.$nf_function->view_excerpt2($form->title,30).'</span></a></li>'; //<span class="form_entry_total"><span class="menu_badge">'.(($total_unread_form>0) ? ''.$total_unread_form.'' : '0' ).'</span></span> |
|---|
| 2355 | } |
|---|
| 2356 | |
|---|
| 2357 | |
|---|
| 2358 | |
|---|
| 2359 | $output .= '</ul>'; |
|---|
| 2360 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 2361 | |
|---|
| 2362 | if($do_ajax) |
|---|
| 2363 | { |
|---|
| 2364 | NEXForms_clean_echo($output); |
|---|
| 2365 | wp_die(); |
|---|
| 2366 | } |
|---|
| 2367 | else |
|---|
| 2368 | return $output; |
|---|
| 2369 | |
|---|
| 2370 | } |
|---|
| 2371 | |
|---|
| 2372 | public function delete_form_entry(){ |
|---|
| 2373 | |
|---|
| 2374 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) { |
|---|
| 2375 | wp_die(); |
|---|
| 2376 | } |
|---|
| 2377 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 2378 | wp_die(); |
|---|
| 2379 | |
|---|
| 2380 | global $wpdb; |
|---|
| 2381 | |
|---|
| 2382 | $db_table = $wpdb->prepare('%s',esc_sql(sanitize_title($_POST['table']))); |
|---|
| 2383 | $db_table = str_replace('\'','',$db_table); |
|---|
| 2384 | |
|---|
| 2385 | if(!strstr($db_table, 'nex_forms')) |
|---|
| 2386 | wp_die(); |
|---|
| 2387 | |
|---|
| 2388 | |
|---|
| 2389 | if($_POST['delete_action']=='trash') |
|---|
| 2390 | { |
|---|
| 2391 | foreach($_POST['selection'] as $key=>$val) |
|---|
| 2392 | { |
|---|
| 2393 | $set_val = $wpdb->prepare('%d',esc_sql(sanitize_text_field($val))); |
|---|
| 2394 | $set_val = str_replace('\'','',$set_val); |
|---|
| 2395 | $update = $wpdb->update ( $wpdb->prefix . $db_table, array('trashed'=>'1'), array( 'Id'=>$set_val) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2396 | |
|---|
| 2397 | } |
|---|
| 2398 | } |
|---|
| 2399 | else |
|---|
| 2400 | { |
|---|
| 2401 | foreach($_POST['selection'] as $key=>$val) |
|---|
| 2402 | { |
|---|
| 2403 | $set_val = $wpdb->prepare('%d',esc_sql(sanitize_text_field($val))); |
|---|
| 2404 | $set_val = str_replace('\'','',$set_val); |
|---|
| 2405 | $delete = $wpdb->delete($wpdb->prefix. $db_table,array('Id'=>$set_val)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2406 | } |
|---|
| 2407 | } |
|---|
| 2408 | //$wpdb->show_errors(); |
|---|
| 2409 | //$wpdb->print_errors(); |
|---|
| 2410 | die(); |
|---|
| 2411 | } |
|---|
| 2412 | |
|---|
| 2413 | |
|---|
| 2414 | public function restore_records(){ |
|---|
| 2415 | |
|---|
| 2416 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) { |
|---|
| 2417 | wp_die(); |
|---|
| 2418 | } |
|---|
| 2419 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 2420 | wp_die(); |
|---|
| 2421 | |
|---|
| 2422 | global $wpdb; |
|---|
| 2423 | foreach($_POST['selection'] as $key=>$val) |
|---|
| 2424 | { |
|---|
| 2425 | $set_val = $wpdb->prepare('%d',esc_sql(sanitize_text_field($val))); |
|---|
| 2426 | $set_val = str_replace('\'','',$set_val); |
|---|
| 2427 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('trashed'=>NULL), array( 'Id' => $set_val) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2428 | NEXForms_clean_echo( $update); |
|---|
| 2429 | } |
|---|
| 2430 | |
|---|
| 2431 | wp_die(); |
|---|
| 2432 | } |
|---|
| 2433 | |
|---|
| 2434 | |
|---|
| 2435 | public function set_starred(){ |
|---|
| 2436 | |
|---|
| 2437 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) { |
|---|
| 2438 | wp_die(); |
|---|
| 2439 | } |
|---|
| 2440 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 2441 | wp_die(); |
|---|
| 2442 | |
|---|
| 2443 | global $wpdb; |
|---|
| 2444 | |
|---|
| 2445 | $set_starred = ($_POST['starred']=='1' || $_POST['starred']==1) ? 0 : 1; |
|---|
| 2446 | if($_POST['record_id']) |
|---|
| 2447 | { |
|---|
| 2448 | $record_id = $wpdb->prepare('%d',esc_sql(sanitize_text_field($_POST['record_id']))); |
|---|
| 2449 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('starred'=>$set_starred), array( 'Id' => $record_id) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2450 | } |
|---|
| 2451 | else |
|---|
| 2452 | { |
|---|
| 2453 | foreach($_POST['selection'] as $key=>$val) |
|---|
| 2454 | { |
|---|
| 2455 | $set_val = $wpdb->prepare('%d',esc_sql(sanitize_text_field($val))); |
|---|
| 2456 | $set_val = str_replace('\'','',$set_val); |
|---|
| 2457 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('starred'=>$set_starred), array( 'Id' => $set_val) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2458 | } |
|---|
| 2459 | } |
|---|
| 2460 | |
|---|
| 2461 | |
|---|
| 2462 | wp_die(); |
|---|
| 2463 | } |
|---|
| 2464 | |
|---|
| 2465 | public function set_read(){ |
|---|
| 2466 | |
|---|
| 2467 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) { |
|---|
| 2468 | wp_die(); |
|---|
| 2469 | } |
|---|
| 2470 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 2471 | wp_die(); |
|---|
| 2472 | |
|---|
| 2473 | global $wpdb; |
|---|
| 2474 | |
|---|
| 2475 | $set_read = ($_POST['read']!='1') ? NULL : 'viewed'; |
|---|
| 2476 | |
|---|
| 2477 | foreach($_POST['selection'] as $key=>$val) |
|---|
| 2478 | { |
|---|
| 2479 | $set_val = $wpdb->prepare('%d',esc_sql(sanitize_text_field($val))); |
|---|
| 2480 | $set_val = str_replace('\'','',$set_val); |
|---|
| 2481 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('viewed'=>$set_read), array( 'Id' => $set_val) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2482 | } |
|---|
| 2483 | wp_die(); |
|---|
| 2484 | } |
|---|
| 2485 | |
|---|
| 2486 | public function dashboard_checkout() |
|---|
| 2487 | { |
|---|
| 2488 | $db_action = new NEXForms_Database_Actions(); |
|---|
| 2489 | $this->checkout = $db_action->checkout(); |
|---|
| 2490 | $this->client_info = $db_action->client_info; |
|---|
| 2491 | $this->license_info = $db_action->license_info; |
|---|
| 2492 | |
|---|
| 2493 | } |
|---|
| 2494 | public function remove_unwanted_styles(){ |
|---|
| 2495 | |
|---|
| 2496 | |
|---|
| 2497 | |
|---|
| 2498 | $other_config = get_option('nex-forms-other-config'); |
|---|
| 2499 | $zero_conflict = isset($other_config['zero-con']) ? $other_config['zero-con'] : '1'; |
|---|
| 2500 | if($zero_conflict=='1') |
|---|
| 2501 | { |
|---|
| 2502 | $dashboard = new NEXForms_dashboard(); |
|---|
| 2503 | $dashboard->dashboard_checkout(); |
|---|
| 2504 | global $wp_styles; |
|---|
| 2505 | $include_style_array = array('colors','common','wp-codemirror', 'wp-theme-plugin-editor','forms','admin-menu','dashboard','list-tables','bootstrap-timepicker','jqui-timepicker','bootstrap-material-datetimepicker','nf-nouislider','nf-jquery-ui','nf-md-checkbox-radio','edit','revisions','media','themes','about','nav-menus','widgets','site-icon','l10n','wp-admin','login','install','wp-color-picker','customize-controls','customize-widgets','customize-nav-menus','press-this','ie','buttons','dashicons','open-sans','admin-bar','wp-auth-check','editor-buttons','media-views','wp-pointer','customize-preview','wp-embed-template-ie','imgareaselect','wp-jquery-ui-dialog','mediaelement','wp-mediaelement','thickbox','deprecated-media','farbtastic','jcrop','colors-fresh','nex-forms-jQuery-UI','nex-forms-font-awesome','nex-forms-bootstrap','nex-forms-fields','nex-forms-ui','nex-forms-admin-style','nex-forms-animate','nex-forms-admin-overrides','nex-forms-admin-bootstrap.colorpickersliders','nex-forms-public-admin','nex-forms-editor','nex-forms-custom-admin','nex-forms-jq-ui','nf-styles-chosen','nf-admin-color-adapt', 'nex-forms-jq-ui','nf-styles-font-menu', 'nex-forms-bootstrap-tour.min','nf-color-adapt-fresh','nf-color-adapt-light','nf-color-adapt-blue','nf-color-adapt-coffee','nf-color-adapt-ectoplasm','nf-color-adapt-midnight','nf-color-adapt-ocean','nf-color-adapt-sunrise', 'nf-color-adapt-default','nex_forms-materialize.min','nex_forms-bootstrap.min','nex_forms-dashboard','nex_forms-font-awesome-5','nex_forms-font-awesome-4-shims','nex_forms-material-icons','ion.rangeSlider','ion.rangeSlider.skinFlat','nex_forms-builder','google-roboto'); |
|---|
| 2506 | |
|---|
| 2507 | NEXForms_clean_echo( '<div class="unwanted_css_array" style="display:none;">'); |
|---|
| 2508 | foreach($wp_styles->registered as $wp_style=>$array) |
|---|
| 2509 | { |
|---|
| 2510 | if(!in_array($array->handle,$include_style_array) && !strstr($array->handle,'nex-forms')) |
|---|
| 2511 | { |
|---|
| 2512 | NEXForms_clean_echo( '<div class="unwanted_css">'.$array->handle.'-css</div>'); |
|---|
| 2513 | } |
|---|
| 2514 | } |
|---|
| 2515 | NEXForms_clean_echo( '</div>'); |
|---|
| 2516 | |
|---|
| 2517 | } |
|---|
| 2518 | |
|---|
| 2519 | } |
|---|
| 2520 | |
|---|
| 2521 | |
|---|
| 2522 | public function new_menu($page_title=''){ |
|---|
| 2523 | |
|---|
| 2524 | $config = new NEXForms5_Config(); |
|---|
| 2525 | $dashboard = new NEXForms_dashboard(); |
|---|
| 2526 | $theme = wp_get_theme(); |
|---|
| 2527 | |
|---|
| 2528 | $dashboard->dashboard_checkout(); |
|---|
| 2529 | |
|---|
| 2530 | $output = ''; |
|---|
| 2531 | $output .= '<div class="nf-header">'; |
|---|
| 2532 | $output .= '<a href="https://basixonline.net/nex-forms-wordpress-form-builder-demo/" target="_blank" class="logo"></a> |
|---|
| 2533 | |
|---|
| 2534 | <div class="version">v<strong>'.$config->plugin_version.'</strong></div> |
|---|
| 2535 | |
|---|
| 2536 | <div class="dashboard-top-menu"> |
|---|
| 2537 | <div class="item"> |
|---|
| 2538 | <a href="https://basixonline.net/nex-forms-docs/" target="_blank"><span class="fas fa-graduation-cap"></span>Documentation</a> |
|---|
| 2539 | </div> |
|---|
| 2540 | <div class="item"> |
|---|
| 2541 | <a href="https://basix.ticksy.com/" target="_blank"><span class="fas fa-life-ring"></span>Support</a> |
|---|
| 2542 | </div> |
|---|
| 2543 | '.(($page_title=="dashboard2" || $page_title=="add-ons" || !$dashboard->checkout) ? '<div class="item"> |
|---|
| 2544 | <a href="https://basixonline.net/nex-forms-free-add-ons-download/" target="_blank"><span class="fas fa-cloud-download-alt"></span>Free Add-ons Download</a> |
|---|
| 2545 | </div>' : ''); |
|---|
| 2546 | |
|---|
| 2547 | $output .= ($theme->Name=='NEX-Forms Demo' || !$dashboard->checkout) ? ' |
|---|
| 2548 | <div class="item buy-now"> |
|---|
| 2549 | <a href="https://1.envato.market/zQ6de">Buy now</a> |
|---|
| 2550 | </div>' : ''; |
|---|
| 2551 | |
|---|
| 2552 | $output .= '</div>'; |
|---|
| 2553 | |
|---|
| 2554 | $output .= '</div>'; |
|---|
| 2555 | |
|---|
| 2556 | $output .= '<div class="dash-left-col">'; |
|---|
| 2557 | $output .= '<ul class="aa_menu">'; |
|---|
| 2558 | |
|---|
| 2559 | |
|---|
| 2560 | $output .= '<li class="db_tab '.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" data-title="'.__('Dashboard','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-home"></span> <span class="menu-text">'.__('Dashboard','nex-forms').'</span></a></li>'; |
|---|
| 2561 | |
|---|
| 2562 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions" data-placement="bottom" data-title="'.__('Form Entries','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-inbox"></span> <span class="menu-text">'.__('Form Entries','nex-forms').'</span></a></li>'; |
|---|
| 2563 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-submission-reporting') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submission-reporting" data-placement="bottom" data-title="'.__('Reporting','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-submission-reporting') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-database"></span> <span class="menu-text">'.__('Reporting','nex-forms').'</span></a></li>'; |
|---|
| 2564 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" data-placement="bottom" data-title="'.__('Analytics','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-chart-bar"></span> <span class="menu-text">'.__('Analytics','nex-forms').'</span></a></li>'; |
|---|
| 2565 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-file-uploads" data-placement="bottom" data-title="'.__('File Uploads','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-file-upload"></span> <span class="menu-text">'.__('File Uploads','nex-forms').'</span></a></li>'; |
|---|
| 2566 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').'" style="position: absolute;bottom: 90px;"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" data-placement="bottom" data-title="'.__('Global Settings','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-cog"></span> <span class="menu-text">'.__('Settings','nex-forms').'</span></a></li>'; |
|---|
| 2567 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').'" style="position: absolute;bottom: 144px;"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons" data-placement="bottom" data-title="'.__('Add-ons','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-plug"></span> <span class="menu-text">'.__('Add-ons','nex-forms').'</span></a></li>'; |
|---|
| 2568 | |
|---|
| 2569 | |
|---|
| 2570 | $output .= '</ul>'; |
|---|
| 2571 | |
|---|
| 2572 | |
|---|
| 2573 | $output .= '</div>'; |
|---|
| 2574 | |
|---|
| 2575 | |
|---|
| 2576 | $output .= '<div class="dash-right-col">'; |
|---|
| 2577 | $output .= '<div class="row row_zero_margin ">'; |
|---|
| 2578 | |
|---|
| 2579 | |
|---|
| 2580 | return $output; |
|---|
| 2581 | |
|---|
| 2582 | } |
|---|
| 2583 | |
|---|
| 2584 | |
|---|
| 2585 | public function dashboard_menu($page_title){ |
|---|
| 2586 | |
|---|
| 2587 | $item = get_option('7103891'); |
|---|
| 2588 | |
|---|
| 2589 | $output = ''; |
|---|
| 2590 | $config = new NEXForms5_Config(); |
|---|
| 2591 | $nf_function = new NEXForms_Functions(); |
|---|
| 2592 | |
|---|
| 2593 | //$output .= $nf_function->new_form_setup($this->checkout); |
|---|
| 2594 | |
|---|
| 2595 | |
|---|
| 2596 | $theme = wp_get_theme(); |
|---|
| 2597 | |
|---|
| 2598 | $set_folder = isset($_REQUEST['folder']) ? sanitize_text_field($_REQUEST['folder']) : 0; |
|---|
| 2599 | $entry_id = isset($_REQUEST['entry_id']) ? sanitize_text_field($_REQUEST['entry_id']) : 0; |
|---|
| 2600 | |
|---|
| 2601 | $output .= '<div class="set_entry_id" style="display:none;">'.$entry_id.'</div>'; |
|---|
| 2602 | $output .= '<div class="set_folder" style="display:none;">'.$set_folder.'</div>'; |
|---|
| 2603 | |
|---|
| 2604 | $output .= '<div class="hidden">'; |
|---|
| 2605 | $output .= '<div id="siteurl">'.get_option('siteurl').'</div>'; |
|---|
| 2606 | $output .= '<div id="nf_dashboard_load">0</div>'; |
|---|
| 2607 | $output .= '<div id="plugins_url">'.plugins_url('/',__FILE__).'</div>'; |
|---|
| 2608 | $output .= '<div id="load_entry">'.$this->checkout.'</div>'; |
|---|
| 2609 | $output .= '<div id="current_form_id">0</div>'; |
|---|
| 2610 | $output .= '<div id="currently_viewing" style="display:none;">'.(($this->checkout) ? 'dashboard' : 'backend').'</div>'; |
|---|
| 2611 | $output .= '</div>'; |
|---|
| 2612 | |
|---|
| 2613 | $output .= '<nav class="start-page aa_bg_main">'; |
|---|
| 2614 | $output .= '<div class="nav-container prime-menu">'; |
|---|
| 2615 | |
|---|
| 2616 | $output .= '<div class="inner">'; |
|---|
| 2617 | $output .= '<ul class="navigation aa_menu">'; |
|---|
| 2618 | $output .= '<li class="logo-wrapper"><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" class="logo"> NEX-Forms </a>';// |
|---|
| 2619 | $output .= '</li>'; |
|---|
| 2620 | $output .= '</ul>'; |
|---|
| 2621 | $output .= '<ul class="navigation aa_menu db_tabs_nf">'; |
|---|
| 2622 | //$output .= '<li class=" menu-item-has-children"><a href="" class="logo create_new_form_home"></a>';// |
|---|
| 2623 | /*$output .= '<ul class="aa_menu_2">'; |
|---|
| 2624 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'active' : '').' submissions_tab"><span class="fas fa-home"></span> '.__('Dashboard','nex-forms').'</a></li>'; |
|---|
| 2625 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'active' : '').' submissions_tab"><span class="fas fa-envelope"></span> '.__('Form Entries','nex-forms').'</a></li>'; |
|---|
| 2626 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-reporting" class="'.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'active' : '').' submissions_tab"><span class="fas fa-scroll"></span> '.__('Reporting','nex-forms').'</a></li>'; |
|---|
| 2627 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'active' : '').' submissions_tab"><span class="fas fa-chart-line"></span> '.__('Analytics','nex-forms').'</a></li>'; |
|---|
| 2628 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-file-uploads" class="'.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'active' : '').' submissions_tab"><span class="fas fa-file-upload"></span> '.__('File Uploads','nex-forms').'</a></li>'; |
|---|
| 2629 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" class="'.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'active' : '').' submissions_tab"><span class="fas fa-cog"></span> '.__('Settings','nex-forms').'</a></li>'; |
|---|
| 2630 | $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons" class="'.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'active' : '').' submissions_tab"><span class="fas fa-plug"></span> '.__('Add-ons','nex-forms').'</a></li>'; |
|---|
| 2631 | $output .= '</ul>';*/ |
|---|
| 2632 | $output .= '</li>'; |
|---|
| 2633 | |
|---|
| 2634 | $output .= '<li class="db_tab '.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" data-title="'.__('Dashboard','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').' submissions_tab"><span class="fas fa-home"></span> <span class="menu-text">'.__('Dashboard','nex-forms').'</span></a></li>'; |
|---|
| 2635 | |
|---|
| 2636 | //$output .= '<li class="db_tab menu-item-has-children"><a class="create_new_form_home" data-title="'.__('Create a NEW Form','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"><span class="fas fa-file-medical"></span></a></li>'; |
|---|
| 2637 | |
|---|
| 2638 | |
|---|
| 2639 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions" data-placement="bottom" data-title="'.__('Form Entries','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-inbox"></span> <span class="menu-text">'.__('Form Entries','nex-forms').'</span></a></li>'; |
|---|
| 2640 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-reporting" data-placement="bottom" data-title="'.__('Reporting','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-database"></span> <span class="menu-text">'.__('Reporting','nex-forms').'</span></a></li>'; |
|---|
| 2641 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" data-placement="bottom" data-title="'.__('Analytics','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-chart-line"></span> <span class="menu-text">'.__('Analytics','nex-forms').'</span></a></li>'; |
|---|
| 2642 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-file-uploads" data-placement="bottom" data-title="'.__('File Uploads','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-file-upload"></span> <span class="menu-text">'.__('File Uploads','nex-forms').'</span></a></li>'; |
|---|
| 2643 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" data-placement="bottom" data-title="'.__('Global Settings','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-cog"></span> <span class="menu-text">'.__('Settings','nex-forms').'</span></a></li>'; |
|---|
| 2644 | $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons" data-placement="bottom" data-title="'.__('Add-ons','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-plug"></span> <span class="menu-text">'.__('Add-ons','nex-forms').'</span></a></li>'; |
|---|
| 2645 | |
|---|
| 2646 | |
|---|
| 2647 | $output .= ($theme->Name=='NEX-Forms Demo' || !$this->checkout) ? '<a href="https://1.envato.market/zQ6de" target="_blank" class="btn waves-effect waves-light upgrade_pro">BUY NEX-FORMS</a>' : ''; |
|---|
| 2648 | $output .= '</ul>'; |
|---|
| 2649 | //$output .= '<div class="page-title aa_font_color_default">'.$page_title.'</div>'; |
|---|
| 2650 | |
|---|
| 2651 | |
|---|
| 2652 | $output .= '<div class="nf_version font_color_1"><span class="">Version '.$config->plugin_version.'</span></div>'; |
|---|
| 2653 | |
|---|
| 2654 | $output .= '</div>'; |
|---|
| 2655 | $output .= '</div>'; |
|---|
| 2656 | $output .= '</nav>'; |
|---|
| 2657 | |
|---|
| 2658 | return $output; |
|---|
| 2659 | } |
|---|
| 2660 | |
|---|
| 2661 | public function dashboard_header(){ |
|---|
| 2662 | $item = get_option('7103891'); |
|---|
| 2663 | |
|---|
| 2664 | $output = ''; |
|---|
| 2665 | $config = new NEXForms5_Config(); |
|---|
| 2666 | $nf_function = new NEXForms_Functions(); |
|---|
| 2667 | //$builder = new NEXForms_Builder7(); |
|---|
| 2668 | |
|---|
| 2669 | $output .= $nf_function->new_form_setup($this->checkout); |
|---|
| 2670 | |
|---|
| 2671 | |
|---|
| 2672 | $theme = wp_get_theme(); |
|---|
| 2673 | $output .= '<div id="demo_site" style="display:none;">'.(($theme->Name=='NEX-Forms Demo') ? 'yes' : 'no').'</div>'; |
|---|
| 2674 | $output .= '<div id="currently_viewing" style="display:none;">'.(($this->checkout) ? 'dashboard' : 'backend').'</div>'; |
|---|
| 2675 | |
|---|
| 2676 | $output .= '<div class="row row_zero_margin">'; |
|---|
| 2677 | |
|---|
| 2678 | $output .= ' |
|---|
| 2679 | <div class="col-sm-12"> |
|---|
| 2680 | <nav class="nav-extended dashboard_nav aa_bg_main prime-menu main_nav"> |
|---|
| 2681 | |
|---|
| 2682 | <div class="nav-content aa_bg_main"> |
|---|
| 2683 | |
|---|
| 2684 | <ul class="tabs_nf aa_bg_main aa_menu">'; |
|---|
| 2685 | |
|---|
| 2686 | $output .= ' <li class="tab logo"><img src="'. plugins_url( '/admin/css/'.NF_PATH.'images/logo.png',dirname(dirname(__FILE__))).'" alt=""><span class="version_number">v '.$config->plugin_version.'</li> '; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 2687 | |
|---|
| 2688 | $output .= '<li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').'"><a class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'active' : '').' forms_tab" href="'.get_admin_url().'admin.php?page=nex-forms-dashboard"><span class="top-icon fa fas fa-home"></span><span class="menu-text">'.__('Dashboard','nex-forms').'</span></a></li> |
|---|
| 2689 | <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'active' : '').' submissions_tab"><span class="top-icon fa fas fa-envelope"></span><span class="menu-text">'.__('Submissions','nex-forms').'</span></a></li> |
|---|
| 2690 | <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'active' : '').' submissions_tab"><span class="top-icon fa fas fa-chart-line"></span><span class="menu-text">'.__('Analytics','nex-forms').'</span></a></li>'; |
|---|
| 2691 | if(function_exists('run_nf_adv_paypal') && $theme->Name!='NEX-Forms Demo') |
|---|
| 2692 | $output .= '<li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-payments') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-payments" class="payment_tab '.(($_REQUEST['page']=='nex-forms-page-payments') ? 'active' : '').'"><span class="top-icon fa fas fa-funnel-dollar"></span><span class="menu-text">'.__('Payments','nex-forms').'</span></a></li>'; |
|---|
| 2693 | |
|---|
| 2694 | |
|---|
| 2695 | |
|---|
| 2696 | $output .= ' |
|---|
| 2697 | <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-reporting" class="reporting_tab '.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'active' : '').'"><span class="top-icon fa fas fa-scroll"></span><span class="menu-text">'.__('Reporting','nex-forms').'</span></a></li> |
|---|
| 2698 | <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-attachments') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-attachments" class="file_uploads_tab '.(($_REQUEST['page']=='nex-forms-page-attachments') ? 'active' : '').'"><span class="top-icon fa fas fa-paperclip"></span><span class="menu-text">'.__('File Uploads','nex-forms').'</span></a></li> |
|---|
| 2699 | <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" class="global_settings_tab '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'active' : '').'"><span class="top-icon fa fas fa-cog"></span><span class="menu-text">'.__('Global Settings','nex-forms').'</span></a></li> |
|---|
| 2700 | <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons" class="add_ons_tab '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'active' : '').'"><span class="top-icon fa fas fa-puzzle-piece"></span><span class="menu-text">'.__('ADD-ONS','nex-forms').'</span></a></li> |
|---|
| 2701 | <li class="tab has_icon"><a href="http://basixonline.net/nex-forms-docs/" target="_blank"><span class="top-icon fa fas fa-file-export"></span><span class="menu-text">'.__('DOCS','nex-forms').'</span></a></li> |
|---|
| 2702 | '.(($theme->Name=='NEX-Forms Demo' || !$this->checkout) ? '<a href="https://1.envato.market/zQ6de" target="_blank" class="btn waves-effect waves-light upgrade_pro">BUY NEX-FORMS</a>' : '' ).' |
|---|
| 2703 | </ul> |
|---|
| 2704 | </div> |
|---|
| 2705 | </nav> |
|---|
| 2706 | </div>'; |
|---|
| 2707 | |
|---|
| 2708 | $output .= '</div>'; |
|---|
| 2709 | |
|---|
| 2710 | return $output; |
|---|
| 2711 | } |
|---|
| 2712 | |
|---|
| 2713 | public function form_analytics($print_chart=''){ |
|---|
| 2714 | |
|---|
| 2715 | global $wpdb; |
|---|
| 2716 | |
|---|
| 2717 | $output = ''; |
|---|
| 2718 | |
|---|
| 2719 | $output .= '<div class="dashboard-box form_analytics '.(($print_chart=='summary') ? 'summary_stats' : '' ).'">'; |
|---|
| 2720 | |
|---|
| 2721 | |
|---|
| 2722 | $output .= '<div class="dashboard-box-header '.(($this->color_adapt) ? 'aa_bg_main': '' ).'">'; |
|---|
| 2723 | if(($print_chart=='summary')) |
|---|
| 2724 | $output .= '<div class="table_title '.(($this->color_adapt) ? 'font_color_1': '' ).'">'.__('Form Entry Analytics for the last 7 Days','nex-forms').'</div>'; |
|---|
| 2725 | |
|---|
| 2726 | if($print_chart!='summary') |
|---|
| 2727 | { |
|---|
| 2728 | $output .= '<div class="controls">'; |
|---|
| 2729 | /*$output .= '<div class="col-xs-3">'; |
|---|
| 2730 | $output .= '<select class="form_control aa_bg_main_input" name="stats_per_form">'; |
|---|
| 2731 | $output .= '<option value="0" selected>'.__('All Forms','nex-forms').'</option>'; |
|---|
| 2732 | $get_forms = 'SELECT * FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_template<>1 AND is_form<>"preview" AND is_form<>"draft" ORDER BY Id DESC'; |
|---|
| 2733 | |
|---|
| 2734 | $forms = $wpdb->get_results($get_forms); |
|---|
| 2735 | foreach($forms as $form) |
|---|
| 2736 | $output .= '<option value="'.$form->Id.'">'.str_replace('\\','',$form->title).'</option>'; |
|---|
| 2737 | $output .= '</select>'; |
|---|
| 2738 | |
|---|
| 2739 | $output .= '</div>';*/ |
|---|
| 2740 | |
|---|
| 2741 | $output .= '<div class="col-xs-2">'; |
|---|
| 2742 | $output .= '<select class="form_control aa_bg_main_input" name="stats_per_year">'; |
|---|
| 2743 | $current_year = (int)date('Y'); |
|---|
| 2744 | $output .= '<option value="'.$current_year.'" selected>'.$current_year.'</option>'; |
|---|
| 2745 | for($i=($current_year-1);$i>=($current_year-20);$i--) |
|---|
| 2746 | { |
|---|
| 2747 | if($i>=2015) |
|---|
| 2748 | $output .= '<option value="'.$i.'">'.$i.'</option>'; |
|---|
| 2749 | } |
|---|
| 2750 | $output .= '</select>'; |
|---|
| 2751 | $output .= '</div>'; |
|---|
| 2752 | |
|---|
| 2753 | $output .= '<div class="col-xs-2">'; |
|---|
| 2754 | $output .= '<select class="form_control aa_bg_main_input" name="stats_per_month">'; |
|---|
| 2755 | $month_array = array('01'=>'January','02'=>'February','03'=>'March','04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August','09'=>'September','10'=>'October','11'=>'November','12'=>'December'); |
|---|
| 2756 | //$output .= '<option value="0">'.__('Month','nex-forms').'</option>'; |
|---|
| 2757 | $current_month = (int)date('m'); |
|---|
| 2758 | foreach($month_array as $key=>$val) |
|---|
| 2759 | { |
|---|
| 2760 | $output .= '<option value="'.$key.'" '.(($key==$current_month) ? 'selected' : '' ).'>'.$val.'</option>'; |
|---|
| 2761 | |
|---|
| 2762 | } |
|---|
| 2763 | $output .= '</select>'; |
|---|
| 2764 | $output .= '</div>'; |
|---|
| 2765 | |
|---|
| 2766 | //$output .= '<button class="btn waves-effect waves-light switch_chart" data-chart-type="global"><i class="fa fa-globe"></i></button>'; |
|---|
| 2767 | $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="radar"><i class="fa fa-spider"></i></button>'; |
|---|
| 2768 | $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="polarArea"><i class="fa fa-bullseye"></i></button>'; |
|---|
| 2769 | $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="doughnut"><i class="fa fa-pie-chart"></i></button>'; |
|---|
| 2770 | $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="bar"><i class="fa fa-bar-chart"></i></button>'; |
|---|
| 2771 | $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart active" data-chart-type="line"><i class="fa fa-line-chart"></i></button>'; |
|---|
| 2772 | |
|---|
| 2773 | |
|---|
| 2774 | $output .= '</div>'; |
|---|
| 2775 | } |
|---|
| 2776 | $output .= '</div>'; |
|---|
| 2777 | |
|---|
| 2778 | |
|---|
| 2779 | |
|---|
| 2780 | |
|---|
| 2781 | |
|---|
| 2782 | |
|---|
| 2783 | $output .= '<div class="dashboard-box-content">'; |
|---|
| 2784 | |
|---|
| 2785 | |
|---|
| 2786 | |
|---|
| 2787 | $output .= '<div class="chart-container"><div class="data_set">'.$this->print_chart($this->checkout, $print_chart).'</div> |
|---|
| 2788 | |
|---|
| 2789 | <canvas id="chart_canvas" height="196px" ></canvas> |
|---|
| 2790 | </div>'; |
|---|
| 2791 | |
|---|
| 2792 | |
|---|
| 2793 | |
|---|
| 2794 | |
|---|
| 2795 | |
|---|
| 2796 | $output .= '</div>'; |
|---|
| 2797 | |
|---|
| 2798 | if($print_chart=='summary') |
|---|
| 2799 | { |
|---|
| 2800 | $output .='<div class="chart_legend">'; |
|---|
| 2801 | $output .= '<a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" class="more_button">MORE INSIGHTS <span class="fa fa-chevron-right"></span></a>'; |
|---|
| 2802 | $output .= '</div>'; |
|---|
| 2803 | } |
|---|
| 2804 | $output .= '</div>'; |
|---|
| 2805 | |
|---|
| 2806 | return $output; |
|---|
| 2807 | } |
|---|
| 2808 | |
|---|
| 2809 | public function print_chart($args='', $chart_view=''){ |
|---|
| 2810 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 2811 | wp_die(); |
|---|
| 2812 | global $wpdb; |
|---|
| 2813 | $current_year = (int)date('Y'); |
|---|
| 2814 | |
|---|
| 2815 | $year_selected = isset($_REQUEST['year_selected']) ? $wpdb->prepare('%s',esc_sql(sanitize_text_field($_REQUEST['year_selected']))) : (int)date('Y'); |
|---|
| 2816 | $year_selected = str_replace('\'','',$year_selected); |
|---|
| 2817 | $month_selected = isset($_REQUEST['month_selected']) ? $wpdb->prepare('%s',esc_sql(sanitize_text_field($_REQUEST['month_selected']))) : (int)date('m'); |
|---|
| 2818 | $month_selected = str_replace('\'','',$month_selected); |
|---|
| 2819 | |
|---|
| 2820 | $month_array = array('1'=>__('January','nex-forms'),'2'=>__('February','nex-forms'),'3'=>__('March','nex-forms'),'4'=>__('April','nex-forms'),'5'=>__('May','nex-forms'),'6'=>__('June','nex-forms'),'7'=>__('July','nex-forms'),'8'=>__('August','nex-forms'),'9'=>__('September','nex-forms'),'10'=>__('October','nex-forms'),'11'=>__('November','nex-forms'),'12'=>__('December','nex-forms')); |
|---|
| 2821 | |
|---|
| 2822 | |
|---|
| 2823 | $today = (int)date('j'); |
|---|
| 2824 | |
|---|
| 2825 | $days_back = 1; |
|---|
| 2826 | if($chart_view=='summary') |
|---|
| 2827 | $days_back = ($today-7); |
|---|
| 2828 | |
|---|
| 2829 | |
|---|
| 2830 | if($year_selected) |
|---|
| 2831 | $current_year = $year_selected; |
|---|
| 2832 | |
|---|
| 2833 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 2834 | $nf7_functions = new NEXForms_Functions(); |
|---|
| 2835 | |
|---|
| 2836 | if($args) |
|---|
| 2837 | $checkin = $args; |
|---|
| 2838 | else |
|---|
| 2839 | $checkin = $database_actions->checkout(); |
|---|
| 2840 | |
|---|
| 2841 | $form_id = isset($_REQUEST['form_id']) ? sanitize_title($_REQUEST['form_id']) : ''; |
|---|
| 2842 | |
|---|
| 2843 | |
|---|
| 2844 | $where_str = 'Id <> 0'; |
|---|
| 2845 | |
|---|
| 2846 | if($form_id) |
|---|
| 2847 | $where_str .= ' AND nex_forms_Id = '.$form_id.' '; |
|---|
| 2848 | |
|---|
| 2849 | if($chart_view=='summary') |
|---|
| 2850 | $where_str .= ' AND date_time >= DATE(NOW()) - INTERVAL 7 DAY'; |
|---|
| 2851 | else |
|---|
| 2852 | $where_str .= ' AND Year(date_time)=Year("'.$current_year.'-'.$month_selected.'-01") AND Month(date_time)= Month("'.$current_year.'-'.$month_selected.'-01") '; |
|---|
| 2853 | |
|---|
| 2854 | |
|---|
| 2855 | $form_entries = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE '.$where_str); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2856 | |
|---|
| 2857 | $form_views = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_views WHERE '.$where_str); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2858 | |
|---|
| 2859 | $form_interactions = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_stats_interactions WHERE '.$where_str); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 2860 | |
|---|
| 2861 | |
|---|
| 2862 | |
|---|
| 2863 | $submit_array = array(); |
|---|
| 2864 | $view_array = array(); |
|---|
| 2865 | $interaction_array = array(); |
|---|
| 2866 | $submit_array_pm = array(); |
|---|
| 2867 | $view_array_pm = array(); |
|---|
| 2868 | $interaction_array_pm = array(); |
|---|
| 2869 | $country_array = array( |
|---|
| 2870 | 'AF' => __('Afghanistan','nex-forms'), |
|---|
| 2871 | 'AX' => __('Aland Islands','nex-forms'), |
|---|
| 2872 | 'AL' => __('Albania','nex-forms'), |
|---|
| 2873 | 'DZ' => __('Algeria','nex-forms'), |
|---|
| 2874 | 'AS' => __('American Samoa','nex-forms'), |
|---|
| 2875 | 'AD' => __('Andorra','nex-forms'), |
|---|
| 2876 | 'AO' => __('Angola','nex-forms'), |
|---|
| 2877 | 'AI' => __('Anguilla','nex-forms'), |
|---|
| 2878 | 'AQ' => __('Antarctica','nex-forms'), |
|---|
| 2879 | 'AG' => __('Antigua and Barbuda','nex-forms'), |
|---|
| 2880 | 'AR' => __('Argentina','nex-forms'), |
|---|
| 2881 | 'AM' => __('Armenia','nex-forms'), |
|---|
| 2882 | 'AW' => __('Aruba','nex-forms'), |
|---|
| 2883 | 'AU' => __('Australia','nex-forms'), |
|---|
| 2884 | 'AT' => __('Austria','nex-forms'), |
|---|
| 2885 | 'AZ' => __('Azerbaijan','nex-forms'), |
|---|
| 2886 | 'BS' => __('Bahamas the','nex-forms'), |
|---|
| 2887 | 'BH' => __('Bahrain','nex-forms'), |
|---|
| 2888 | 'BD' => __('Bangladesh','nex-forms'), |
|---|
| 2889 | 'BB' => __('Barbados','nex-forms'), |
|---|
| 2890 | 'BY' => __('Belarus','nex-forms'), |
|---|
| 2891 | 'BE' => __('Belgium','nex-forms'), |
|---|
| 2892 | 'BZ' => __('Belize','nex-forms'), |
|---|
| 2893 | 'BJ' => __('Benin','nex-forms'), |
|---|
| 2894 | 'BM' => __('Bermuda','nex-forms'), |
|---|
| 2895 | 'BT' => __('Bhutan','nex-forms'), |
|---|
| 2896 | 'BO' => __('Bolivia','nex-forms'), |
|---|
| 2897 | 'BA' => __('Bosnia and Herzegovina','nex-forms'), |
|---|
| 2898 | 'BW' => __('Botswana','nex-forms'), |
|---|
| 2899 | 'BV' => __('Bouvet Island (Bouvetoya)','nex-forms'), |
|---|
| 2900 | 'BR' => __('Brazil','nex-forms'), |
|---|
| 2901 | 'IO' => __('British Indian Ocean Territory (Chagos Archipelago)','nex-forms'), |
|---|
| 2902 | 'VG' => __('British Virgin Islands','nex-forms'), |
|---|
| 2903 | 'BN' => __('Brunei Darussalam','nex-forms'), |
|---|
| 2904 | 'BG' => __('Bulgaria','nex-forms'), |
|---|
| 2905 | 'BF' => __('Burkina Faso','nex-forms'), |
|---|
| 2906 | 'BI' => __('Burundi','nex-forms'), |
|---|
| 2907 | 'KH' => __('Cambodia','nex-forms'), |
|---|
| 2908 | 'CM' => __('Cameroon','nex-forms'), |
|---|
| 2909 | 'CA' => __('Canada','nex-forms'), |
|---|
| 2910 | 'CV' => __('Cape Verde','nex-forms'), |
|---|
| 2911 | 'KY' => __('Cayman Islands','nex-forms'), |
|---|
| 2912 | 'CF' => __('Central African Republic','nex-forms'), |
|---|
| 2913 | 'TD' => __('Chad','nex-forms'), |
|---|
| 2914 | 'CL' => __('Chile','nex-forms'), |
|---|
| 2915 | 'CN' => __('China','nex-forms'), |
|---|
| 2916 | 'CX' => __('Christmas Island','nex-forms'), |
|---|
| 2917 | 'CC' => __('Cocos (Keeling) Islands','nex-forms'), |
|---|
| 2918 | 'CO' => __('Colombia','nex-forms'), |
|---|
| 2919 | 'KM' => __('Comoros the','nex-forms'), |
|---|
| 2920 | 'CD' => __('Congo - Kinshasa','nex-forms'), |
|---|
| 2921 | 'CG' => __('Congo - Brazzaville','nex-forms'), |
|---|
| 2922 | 'CK' => __('Cook Islands','nex-forms'), |
|---|
| 2923 | 'CR' => __('Costa Rica','nex-forms'), |
|---|
| 2924 | 'CI' => __('CI','nex-forms'), |
|---|
| 2925 | 'HR' => __('Croatia','nex-forms'), |
|---|
| 2926 | 'CU' => __('Cuba','nex-forms'), |
|---|
| 2927 | 'CY' => __('Cyprus','nex-forms'), |
|---|
| 2928 | 'CZ' => __('Czech Republic','nex-forms'), |
|---|
| 2929 | 'DK' => __('Denmark','nex-forms'), |
|---|
| 2930 | 'DJ' => __('Djibouti','nex-forms'), |
|---|
| 2931 | 'DM' => __('Dominica','nex-forms'), |
|---|
| 2932 | 'DO' => __('Dominican Republic','nex-forms'), |
|---|
| 2933 | 'EC' => __('Ecuador','nex-forms'), |
|---|
| 2934 | 'EG' => __('Egypt','nex-forms'), |
|---|
| 2935 | 'SV' => __('El Salvador','nex-forms'), |
|---|
| 2936 | 'GQ' => __('Equatorial Guinea','nex-forms'), |
|---|
| 2937 | 'ER' => __('Eritrea','nex-forms'), |
|---|
| 2938 | 'EE' => __('Estonia','nex-forms'), |
|---|
| 2939 | 'ET' => __('Ethiopia','nex-forms'), |
|---|
| 2940 | 'FO' => __('Faroe Islands','nex-forms'), |
|---|
| 2941 | 'FK' => __('Falkland Islands (Malvinas)','nex-forms'), |
|---|
| 2942 | 'FJ' => __('Fiji the Fiji Islands','nex-forms'), |
|---|
| 2943 | 'FI' => __('Finland','nex-forms'), |
|---|
| 2944 | 'FR' => __('France','nex-forms'), |
|---|
| 2945 | 'GF' => __('French Guiana','nex-forms'), |
|---|
| 2946 | 'PF' => __('French Polynesia','nex-forms'), |
|---|
| 2947 | 'TF' => __('French Southern Territories','nex-forms'), |
|---|
| 2948 | 'GA' => __('Gabon','nex-forms'), |
|---|
| 2949 | 'GM' => __('Gambia the','nex-forms'), |
|---|
| 2950 | 'GE' => __('Georgia','nex-forms'), |
|---|
| 2951 | 'DE' => __('Germany','nex-forms'), |
|---|
| 2952 | 'GH' => __('Ghana','nex-forms'), |
|---|
| 2953 | 'GI' => __('Gibraltar','nex-forms'), |
|---|
| 2954 | 'GR' => __('Greece','nex-forms'), |
|---|
| 2955 | 'GL' => __('Greenland','nex-forms'), |
|---|
| 2956 | 'GD' => __('Grenada','nex-forms'), |
|---|
| 2957 | 'GP' => __('Guadeloupe','nex-forms'), |
|---|
| 2958 | 'GU' => __('Guam','nex-forms'), |
|---|
| 2959 | 'GT' => __('Guatemala','nex-forms'), |
|---|
| 2960 | 'GG' => __('Guernsey','nex-forms'), |
|---|
| 2961 | 'GN' => __('Guinea','nex-forms'), |
|---|
| 2962 | 'GW' => __('Guinea-Bissau','nex-forms'), |
|---|
| 2963 | 'GY' => __('Guyana','nex-forms'), |
|---|
| 2964 | 'HT' => __('Haiti','nex-forms'), |
|---|
| 2965 | 'HM' => __('Heard Island and McDonald Islands','nex-forms'), |
|---|
| 2966 | 'VA' => __('Holy See (Vatican City State)','nex-forms'), |
|---|
| 2967 | 'HN' => __('Honduras','nex-forms'), |
|---|
| 2968 | 'HK' => __('Hong Kong','nex-forms'), |
|---|
| 2969 | 'HU' => __('Hungary','nex-forms'), |
|---|
| 2970 | 'IS' => __('Iceland','nex-forms'), |
|---|
| 2971 | 'IN' => __('India','nex-forms'), |
|---|
| 2972 | 'ID' => __('Indonesia','nex-forms'), |
|---|
| 2973 | 'IR' => __('Iran','nex-forms'), |
|---|
| 2974 | 'IQ' => __('Iraq','nex-forms'), |
|---|
| 2975 | 'IE' => __('Ireland','nex-forms'), |
|---|
| 2976 | 'IM' => __('Isle of Man','nex-forms'), |
|---|
| 2977 | 'IL' => __('Israel','nex-forms'), |
|---|
| 2978 | 'IT' => __('Italy','nex-forms'), |
|---|
| 2979 | 'JM' => __('Jamaica','nex-forms'), |
|---|
| 2980 | 'JP' => __('Japan','nex-forms'), |
|---|
| 2981 | 'JE' => __('Jersey','nex-forms'), |
|---|
| 2982 | 'JO' => __('Jordan','nex-forms'), |
|---|
| 2983 | 'KZ' => __('Kazakhstan','nex-forms'), |
|---|
| 2984 | 'KE' => __('Kenya','nex-forms'), |
|---|
| 2985 | 'KI' => __('Kiribati','nex-forms'), |
|---|
| 2986 | 'KP' => __('North Korea','nex-forms'), |
|---|
| 2987 | 'KR' => __('South Korea','nex-forms'), |
|---|
| 2988 | 'KW' => __('Kuwait','nex-forms'), |
|---|
| 2989 | 'KG' => __('Kyrgyzstan','nex-forms'), |
|---|
| 2990 | 'LA' => __('Lao','nex-forms'), |
|---|
| 2991 | 'LV' => __('Latvia','nex-forms'), |
|---|
| 2992 | 'LB' => __('Lebanon','nex-forms'), |
|---|
| 2993 | 'LS' => __('Lesotho','nex-forms'), |
|---|
| 2994 | 'LR' => __('Liberia','nex-forms'), |
|---|
| 2995 | 'LY' => __('Libya','nex-forms'), |
|---|
| 2996 | 'LI' => __('Liechtenstein','nex-forms'), |
|---|
| 2997 | 'LT' => __('Lithuania','nex-forms'), |
|---|
| 2998 | 'LU' => __('Luxembourg','nex-forms'), |
|---|
| 2999 | 'MO' => __('Macao','nex-forms'), |
|---|
| 3000 | 'MK' => __('Macedonia','nex-forms'), |
|---|
| 3001 | 'MG' => __('Madagascar','nex-forms'), |
|---|
| 3002 | 'MW' => __('Malawi','nex-forms'), |
|---|
| 3003 | 'MY' => __('Malaysia','nex-forms'), |
|---|
| 3004 | 'MV' => __('Maldives','nex-forms'), |
|---|
| 3005 | 'ML' => __('Mali','nex-forms'), |
|---|
| 3006 | 'MT' => __('Malta','nex-forms'), |
|---|
| 3007 | 'MH' => __('Marshall Islands','nex-forms'), |
|---|
| 3008 | 'MQ' => __('Martinique','nex-forms'), |
|---|
| 3009 | 'MR' => __('Mauritania','nex-forms'), |
|---|
| 3010 | 'MU' => __('Mauritius','nex-forms'), |
|---|
| 3011 | 'YT' => __('Mayotte','nex-forms'), |
|---|
| 3012 | 'MX' => __('Mexico','nex-forms'), |
|---|
| 3013 | 'FM' => __('Micronesia','nex-forms'), |
|---|
| 3014 | 'MD' => __('Moldova','nex-forms'), |
|---|
| 3015 | 'MC' => __('Monaco','nex-forms'), |
|---|
| 3016 | 'MN' => __('Mongolia','nex-forms'), |
|---|
| 3017 | 'ME' => __('Montenegro','nex-forms'), |
|---|
| 3018 | 'MS' => __('Montserrat','nex-forms'), |
|---|
| 3019 | 'MA' => __('Morocco','nex-forms'), |
|---|
| 3020 | 'MZ' => __('Mozambique','nex-forms'), |
|---|
| 3021 | 'MM' => __('Myanmar','nex-forms'), |
|---|
| 3022 | 'NA' => __('Namibia','nex-forms'), |
|---|
| 3023 | 'NR' => __('Nauru','nex-forms'), |
|---|
| 3024 | 'NP' => __('Nepal','nex-forms'), |
|---|
| 3025 | 'AN' => __('Netherlands Antilles','nex-forms'), |
|---|
| 3026 | 'NL' => __('Netherlands','nex-forms'), |
|---|
| 3027 | 'NC' => __('New Caledonia','nex-forms'), |
|---|
| 3028 | 'NZ' => __('New Zealand','nex-forms'), |
|---|
| 3029 | 'NI' => __('Nicaragua','nex-forms'), |
|---|
| 3030 | 'NE' => __('Niger','nex-forms'), |
|---|
| 3031 | 'NG' => __('Nigeria','nex-forms'), |
|---|
| 3032 | 'NU' => __('Niue','nex-forms'), |
|---|
| 3033 | 'NF' => __('Norfolk Island','nex-forms'), |
|---|
| 3034 | 'MP' => __('Northern Mariana Islands','nex-forms'), |
|---|
| 3035 | 'NO' => __('Norway','nex-forms'), |
|---|
| 3036 | 'OM' => __('Oman','nex-forms'), |
|---|
| 3037 | 'PK' => __('Pakistan','nex-forms'), |
|---|
| 3038 | 'PW' => __('Palau','nex-forms'), |
|---|
| 3039 | 'PS' => __('Palestinian Territory','nex-forms'), |
|---|
| 3040 | 'PA' => __('Panama','nex-forms'), |
|---|
| 3041 | 'PG' => __('Papua New Guinea','nex-forms'), |
|---|
| 3042 | 'PY' => __('Paraguay','nex-forms'), |
|---|
| 3043 | 'PE' => __('Peru','nex-forms'), |
|---|
| 3044 | 'PH' => __('Philippines','nex-forms'), |
|---|
| 3045 | 'PN' => __('Pitcairn Islands','nex-forms'), |
|---|
| 3046 | 'PL' => __('Poland','nex-forms'), |
|---|
| 3047 | 'PT' => __('Portugal','nex-forms'), |
|---|
| 3048 | 'PR' => __('Puerto Rico','nex-forms'), |
|---|
| 3049 | 'QA' => __('Qatar','nex-forms'), |
|---|
| 3050 | |
|---|
| 3051 | |
|---|
| 3052 | 'RE' => __('Reunion','nex-forms'), |
|---|
| 3053 | 'RO' => __('Romania','nex-forms'), |
|---|
| 3054 | 'RU' => __('Russia','nex-forms'), |
|---|
| 3055 | 'RW' => __('Rwanda','nex-forms'), |
|---|
| 3056 | 'BL' => __('Saint Barthelemy','nex-forms'), |
|---|
| 3057 | 'SH' => __('Saint Helena','nex-forms'), |
|---|
| 3058 | 'KN' => __('Saint Kitts and Nevis','nex-forms'), |
|---|
| 3059 | 'LC' => __('Saint Lucia','nex-forms'), |
|---|
| 3060 | 'MF' => __('Saint Martin','nex-forms'), |
|---|
| 3061 | 'PM' => __('Saint Pierre and Miquelon','nex-forms'), |
|---|
| 3062 | 'VC' => __('Saint Vincent and the Grenadines','nex-forms'), |
|---|
| 3063 | 'WS' => __('Samoa','nex-forms'), |
|---|
| 3064 | 'SM' => __('San Marino','nex-forms'), |
|---|
| 3065 | 'ST' => __('Sao Tome and Principe','nex-forms'), |
|---|
| 3066 | 'SA' => __('Saudi Arabia','nex-forms'), |
|---|
| 3067 | 'SN' => __('Senegal','nex-forms'), |
|---|
| 3068 | 'RS' => __('Serbia','nex-forms'), |
|---|
| 3069 | 'SC' => __('Seychelles','nex-forms'), |
|---|
| 3070 | 'SL' => __('Sierra Leone','nex-forms'), |
|---|
| 3071 | 'SG' => __('Singapore','nex-forms'), |
|---|
| 3072 | 'SS' => __('SS','nex-forms'), |
|---|
| 3073 | 'SK' => __('Slovakia (Slovak Republic)','nex-forms'), |
|---|
| 3074 | 'SI' => __('Slovenia','nex-forms'), |
|---|
| 3075 | 'SB' => __('Solomon Islands','nex-forms'), |
|---|
| 3076 | 'SO' => __('Somalia, Somali Republic','nex-forms'), |
|---|
| 3077 | 'ZA' => __('South Africa','nex-forms'), |
|---|
| 3078 | 'GS' => __('South Georgia and the South Sandwich Islands','nex-forms'), |
|---|
| 3079 | 'ES' => __('Spain','nex-forms'), |
|---|
| 3080 | 'LK' => __('Sri Lanka','nex-forms'), |
|---|
| 3081 | 'SD' => __('Sudan','nex-forms'), |
|---|
| 3082 | 'SR' => __('Suriname','nex-forms'), |
|---|
| 3083 | 'SJ' => __('SJ','nex-forms'), |
|---|
| 3084 | 'SZ' => __('Swaziland','nex-forms'), |
|---|
| 3085 | 'SE' => __('Sweden','nex-forms'), |
|---|
| 3086 | 'CH' => __('Switzerland, Swiss Confederation','nex-forms'), |
|---|
| 3087 | 'SY' => __('Syrian Arab Republic','nex-forms'), |
|---|
| 3088 | 'TW' => __('Taiwan','nex-forms'), |
|---|
| 3089 | 'TJ' => __('Tajikistan','nex-forms'), |
|---|
| 3090 | 'TZ' => __('Tanzania','nex-forms'), |
|---|
| 3091 | 'TH' => __('Thailand','nex-forms'), |
|---|
| 3092 | 'TL' => __('Timor-Leste','nex-forms'), |
|---|
| 3093 | 'TG' => __('Togo','nex-forms'), |
|---|
| 3094 | 'TK' => __('Tokelau','nex-forms'), |
|---|
| 3095 | 'TO' => __('Tonga','nex-forms'), |
|---|
| 3096 | 'TT' => __('Trinidad and Tobago','nex-forms'), |
|---|
| 3097 | 'TN' => __('Tunisia','nex-forms'), |
|---|
| 3098 | 'TR' => __('Turkey','nex-forms'), |
|---|
| 3099 | 'TM' => __('Turkmenistan','nex-forms'), |
|---|
| 3100 | 'TC' => __('Turks and Caicos Islands','nex-forms'), |
|---|
| 3101 | 'TV' => __('Tuvalu','nex-forms'), |
|---|
| 3102 | 'UG' => __('Uganda','nex-forms'), |
|---|
| 3103 | 'UA' => __('Ukraine','nex-forms'), |
|---|
| 3104 | 'AE' => __('United Arab Emirates','nex-forms'), |
|---|
| 3105 | 'GB' => __('United Kingdom','nex-forms'), |
|---|
| 3106 | 'US' => __('United States','nex-forms'), |
|---|
| 3107 | 'UM' => __('United States Minor Outlying Islands','nex-forms'), |
|---|
| 3108 | 'VI' => __('United States Virgin Islands','nex-forms'), |
|---|
| 3109 | 'UY' => __('Uruguay','nex-forms'), |
|---|
| 3110 | 'UZ' => __('Uzbekistan','nex-forms'), |
|---|
| 3111 | 'VU' => __('Vanuatu','nex-forms'), |
|---|
| 3112 | 'VE' => __('Venezuela','nex-forms'), |
|---|
| 3113 | 'VN' => __('Vietnam','nex-forms'), |
|---|
| 3114 | 'WF' => __('Wallis and Futuna','nex-forms'), |
|---|
| 3115 | 'EH' => __('Western Sahara','nex-forms'), |
|---|
| 3116 | 'YE' => __('Yemen','nex-forms'), |
|---|
| 3117 | 'ZM' => __('Zambia','nex-forms'), |
|---|
| 3118 | 'ZW' => __('Zimbabwe','nex-forms') |
|---|
| 3119 | ); |
|---|
| 3120 | $total_form_entries = 0; |
|---|
| 3121 | $total_form_views = 0; |
|---|
| 3122 | $total_form_interactions = 0; |
|---|
| 3123 | $set_form_views = 0; |
|---|
| 3124 | $set_form_interactions = 0; |
|---|
| 3125 | $set_form_entries = 0; |
|---|
| 3126 | |
|---|
| 3127 | $days_in_month = ''; |
|---|
| 3128 | if($month_selected && $month_selected!='0') |
|---|
| 3129 | { |
|---|
| 3130 | if(function_exists('cal_days_in_month')){ |
|---|
| 3131 | $days_in_month = cal_days_in_month(CAL_GREGORIAN, (int)$month_selected, $current_year); |
|---|
| 3132 | } |
|---|
| 3133 | else |
|---|
| 3134 | $days_in_month = 31; |
|---|
| 3135 | } |
|---|
| 3136 | if($chart_view=='summary') |
|---|
| 3137 | $days_in_month = $today; |
|---|
| 3138 | for($m=1;$m<=12;$m++) |
|---|
| 3139 | { |
|---|
| 3140 | $submit_array[$m] = 0; |
|---|
| 3141 | $view_array[$m] = 0; |
|---|
| 3142 | $interaction_array[$m] = 0; |
|---|
| 3143 | } |
|---|
| 3144 | for($d=1;$d<=$days_in_month;$d++) |
|---|
| 3145 | { |
|---|
| 3146 | $submit_array_pm[$d] = 0; |
|---|
| 3147 | $view_array_pm[$d] = 0; |
|---|
| 3148 | $interaction_array_pm[$d] = 0; |
|---|
| 3149 | } |
|---|
| 3150 | |
|---|
| 3151 | $array_countries = array(); |
|---|
| 3152 | foreach($country_array as $key=>$val) |
|---|
| 3153 | $array_countries[$key] = 0; |
|---|
| 3154 | |
|---|
| 3155 | foreach($form_entries as $form_entry) |
|---|
| 3156 | { |
|---|
| 3157 | |
|---|
| 3158 | $year = substr($form_entry->date_time,0,4); |
|---|
| 3159 | $month = (int)substr($form_entry->date_time,5,2); |
|---|
| 3160 | $day = (int)substr($form_entry->date_time,8,2); |
|---|
| 3161 | |
|---|
| 3162 | if($current_year==$year) |
|---|
| 3163 | { |
|---|
| 3164 | if($month_selected && $month_selected!='0') |
|---|
| 3165 | { |
|---|
| 3166 | if($month==$month_selected) |
|---|
| 3167 | { |
|---|
| 3168 | |
|---|
| 3169 | $total_form_entries++; |
|---|
| 3170 | |
|---|
| 3171 | if($form_entry->country!='') |
|---|
| 3172 | $array_countries[$form_entry->country]++; |
|---|
| 3173 | |
|---|
| 3174 | |
|---|
| 3175 | |
|---|
| 3176 | for($d=1;$d<=$days_in_month;$d++) |
|---|
| 3177 | { |
|---|
| 3178 | if($day==$d) |
|---|
| 3179 | { |
|---|
| 3180 | $submit_array_pm[$d]++; |
|---|
| 3181 | } |
|---|
| 3182 | } |
|---|
| 3183 | } |
|---|
| 3184 | } |
|---|
| 3185 | else |
|---|
| 3186 | { |
|---|
| 3187 | for($m=1;$m<=12;$m++) |
|---|
| 3188 | { |
|---|
| 3189 | if($month==$m) |
|---|
| 3190 | { |
|---|
| 3191 | $submit_array[$m]++; |
|---|
| 3192 | $total_form_entries++; |
|---|
| 3193 | if($form_entry->country!='') |
|---|
| 3194 | $array_countries[$form_entry->country]++; |
|---|
| 3195 | |
|---|
| 3196 | |
|---|
| 3197 | } |
|---|
| 3198 | } |
|---|
| 3199 | } |
|---|
| 3200 | } |
|---|
| 3201 | } |
|---|
| 3202 | foreach($form_views as $view) |
|---|
| 3203 | { |
|---|
| 3204 | $date = date('Y-m-d h:i:s',$view->time_viewed); |
|---|
| 3205 | $year = substr($date,0,4); |
|---|
| 3206 | $month = (int)substr($date,5,2); |
|---|
| 3207 | $day = (int)substr($date,8,2); |
|---|
| 3208 | |
|---|
| 3209 | if($current_year==$year) |
|---|
| 3210 | { |
|---|
| 3211 | if($month_selected && $month_selected!='0') |
|---|
| 3212 | { |
|---|
| 3213 | if($month==$month_selected) |
|---|
| 3214 | { |
|---|
| 3215 | $total_form_views++; |
|---|
| 3216 | for($dv=1;$dv<=$days_in_month;$dv++) |
|---|
| 3217 | { |
|---|
| 3218 | if($day==$dv) |
|---|
| 3219 | $view_array_pm[$dv]++; |
|---|
| 3220 | } |
|---|
| 3221 | } |
|---|
| 3222 | } |
|---|
| 3223 | else |
|---|
| 3224 | { |
|---|
| 3225 | for($mv=1;$mv<=12;$mv++) |
|---|
| 3226 | { |
|---|
| 3227 | if($month==$mv) |
|---|
| 3228 | { |
|---|
| 3229 | $view_array[$mv]++; |
|---|
| 3230 | $total_form_views++; |
|---|
| 3231 | } |
|---|
| 3232 | } |
|---|
| 3233 | } |
|---|
| 3234 | } |
|---|
| 3235 | } |
|---|
| 3236 | |
|---|
| 3237 | foreach($form_interactions as $interaction) |
|---|
| 3238 | { |
|---|
| 3239 | |
|---|
| 3240 | $date = date('Y-m-d h:i:s',$interaction->time_interacted); |
|---|
| 3241 | $year = substr($date,0,4); |
|---|
| 3242 | $month = (int)substr($date,5,2); |
|---|
| 3243 | $day = (int)substr($date,8,2); |
|---|
| 3244 | |
|---|
| 3245 | if($current_year==$year) |
|---|
| 3246 | { |
|---|
| 3247 | if($month_selected && $month_selected!='0') |
|---|
| 3248 | { |
|---|
| 3249 | if($month==$month_selected) |
|---|
| 3250 | { |
|---|
| 3251 | $total_form_interactions++; |
|---|
| 3252 | for($dv=1;$dv<=$days_in_month;$dv++) |
|---|
| 3253 | { |
|---|
| 3254 | if($day==$dv) |
|---|
| 3255 | $interaction_array_pm[$dv]++; |
|---|
| 3256 | } |
|---|
| 3257 | } |
|---|
| 3258 | } |
|---|
| 3259 | else |
|---|
| 3260 | { |
|---|
| 3261 | for($mv=1;$mv<=12;$mv++) |
|---|
| 3262 | { |
|---|
| 3263 | if($month==$mv) |
|---|
| 3264 | { |
|---|
| 3265 | $interaction_array[$mv]++; |
|---|
| 3266 | $total_form_interactions++; |
|---|
| 3267 | } |
|---|
| 3268 | } |
|---|
| 3269 | } |
|---|
| 3270 | } |
|---|
| 3271 | } |
|---|
| 3272 | $output = ''; |
|---|
| 3273 | |
|---|
| 3274 | if(!$checkin) |
|---|
| 3275 | { |
|---|
| 3276 | for($m=1;$m<=12;$m++) |
|---|
| 3277 | { |
|---|
| 3278 | $submit_array[$m] = 0; |
|---|
| 3279 | $interaction_array[$m] = 0; |
|---|
| 3280 | $view_array[$m] = 0; |
|---|
| 3281 | } |
|---|
| 3282 | |
|---|
| 3283 | for($dv=1;$dv<=$days_in_month;$dv++) |
|---|
| 3284 | { |
|---|
| 3285 | $submit_array_pm[$dv] = 0; |
|---|
| 3286 | $interaction_array_pm[$dv] = 0; |
|---|
| 3287 | $view_array_pm[$dv] = 0; |
|---|
| 3288 | } |
|---|
| 3289 | } |
|---|
| 3290 | |
|---|
| 3291 | |
|---|
| 3292 | |
|---|
| 3293 | $output.= '<div class="row stats aa_bg_sec">'; |
|---|
| 3294 | if(!$checkin) |
|---|
| 3295 | { |
|---|
| 3296 | $total_form_views=0; |
|---|
| 3297 | //$output.= '<div class="alert alert-danger" style="width:95%"><strong>'.__('Plugin NOT Registered!</strong> The below <strong>data is randomized</strong>! To view actual data go to Global Settings above and register the plugin.','nex-forms').'</div>'; |
|---|
| 3298 | } |
|---|
| 3299 | |
|---|
| 3300 | |
|---|
| 3301 | $output.= '<div class="col-xs-3" ><span class="big_txt">'.(($checkin) ? $total_form_views : $set_form_views).'</span> <label style="cursor:default;color:#60a1e1;">'.__('Views','nex-forms').'</label> </div>'; |
|---|
| 3302 | $output.= '<div class="col-xs-3" ><span class="big_txt">'.(($checkin) ? $total_form_interactions : $set_form_interactions).'</span> <label style="cursor:default;color:#8BC34A;">'.__('Interactions','nex-forms').'</label> </div>'; |
|---|
| 3303 | $output.= '<div class="col-xs-3" ><span class="big_txt">'.(($checkin) ? $total_form_entries : $set_form_entries).'</span> <label style="cursor:default;color:#F57C00;">'.__('Submissions','nex-forms').'</label> </div>'; |
|---|
| 3304 | |
|---|
| 3305 | if($total_form_entries==0 || $total_form_views==0) |
|---|
| 3306 | $output.= '<div class="col-xs-3" ><span class="big_txt">0%</span> <label style="cursor:default;">Conversion</label> </div>'; |
|---|
| 3307 | else |
|---|
| 3308 | $output.= '<div class="col-xs-3" ><span class="big_txt">'.round((($total_form_entries/$total_form_views)*100),2).'%</span> <label>Conversion</label> </div>'; |
|---|
| 3309 | |
|---|
| 3310 | |
|---|
| 3311 | |
|---|
| 3312 | $output.= '</div>'; |
|---|
| 3313 | |
|---|
| 3314 | $get_countries = $nf7_functions->code_to_country('',1); |
|---|
| 3315 | $opacity = 0.1; |
|---|
| 3316 | $chart_type = isset($_REQUEST['chart_type']) ? sanitize_text_field($_REQUEST['chart_type']) : ''; |
|---|
| 3317 | if($chart_type=='global') |
|---|
| 3318 | { |
|---|
| 3319 | |
|---|
| 3320 | $output .= '<script type="text/javascript"> |
|---|
| 3321 | google.charts.load(\'current\', {\'packages\':[\'geochart\']}); |
|---|
| 3322 | google.charts.setOnLoadCallback(drawRegionsMap); |
|---|
| 3323 | |
|---|
| 3324 | function drawRegionsMap() { |
|---|
| 3325 | |
|---|
| 3326 | var data = google.visualization.arrayToDataTable([ |
|---|
| 3327 | [\'Country\', \'Submissions\'], |
|---|
| 3328 | |
|---|
| 3329 | '; |
|---|
| 3330 | if($checkin) |
|---|
| 3331 | { |
|---|
| 3332 | foreach($array_countries as $key=>$value) |
|---|
| 3333 | { |
|---|
| 3334 | if(is_int($value)) |
|---|
| 3335 | $output .= '[\''.$nf7_functions->code_to_country($key).'\', '.$value.'],'; |
|---|
| 3336 | |
|---|
| 3337 | } |
|---|
| 3338 | } |
|---|
| 3339 | else |
|---|
| 3340 | { |
|---|
| 3341 | foreach($get_countries as $key=>$val) |
|---|
| 3342 | $output .= '["'.str_replace('"','',$val).'", '.rand(0,150).'],'; |
|---|
| 3343 | } |
|---|
| 3344 | $output .= ' |
|---|
| 3345 | ]); |
|---|
| 3346 | |
|---|
| 3347 | var options = {}; |
|---|
| 3348 | |
|---|
| 3349 | var gchart = new google.visualization.GeoChart(document.getElementById(\'regions_div\')); |
|---|
| 3350 | |
|---|
| 3351 | gchart.draw(data, options); |
|---|
| 3352 | } |
|---|
| 3353 | </script>'; |
|---|
| 3354 | $output .= '<div id="regions_div" style="width: 900px; height: 500px;"></div>'; |
|---|
| 3355 | } |
|---|
| 3356 | if($chart_type=='bar') |
|---|
| 3357 | $opacity = 0.2; |
|---|
| 3358 | |
|---|
| 3359 | if($chart_type=='doughnut' || $chart_type=='polarArea') |
|---|
| 3360 | { |
|---|
| 3361 | $opacity = 0.3; |
|---|
| 3362 | $output .= '<script> |
|---|
| 3363 | randomScalingFactor = function(){ return Math.round(Math.random()*100)}; |
|---|
| 3364 | |
|---|
| 3365 | var lineChartData = { |
|---|
| 3366 | labels: [ |
|---|
| 3367 | "'.__('Views','nex-forms').'", |
|---|
| 3368 | "'.__('Interactions','nex-forms').'", |
|---|
| 3369 | "'.__('Submissions','nex-forms').'" |
|---|
| 3370 | ], |
|---|
| 3371 | datasets: [ |
|---|
| 3372 | { |
|---|
| 3373 | data: ['.(($checkin) ? $total_form_views : $set_form_views).', '.(($checkin) ? $total_form_interactions : $set_form_interactions).', '.(($checkin) ? $total_form_entries : $set_form_entries).'], |
|---|
| 3374 | backgroundColor: [ |
|---|
| 3375 | "'.NEXForms5_hex2RGB('#1976D2',true,',',$opacity).'", |
|---|
| 3376 | "'.NEXForms5_hex2RGB('#8BC34A',true,',',$opacity).'", |
|---|
| 3377 | "'.NEXForms5_hex2RGB('#F57C00',true,',',$opacity).'" |
|---|
| 3378 | ], |
|---|
| 3379 | hoverBackgroundColor: [ |
|---|
| 3380 | "#1976D2", |
|---|
| 3381 | "#8BC34A", |
|---|
| 3382 | "#F57C00" |
|---|
| 3383 | ], |
|---|
| 3384 | borderColor : [ |
|---|
| 3385 | "#fff", |
|---|
| 3386 | "#fff", |
|---|
| 3387 | "#fff" |
|---|
| 3388 | ], |
|---|
| 3389 | |
|---|
| 3390 | }] |
|---|
| 3391 | } |
|---|
| 3392 | </script>'; |
|---|
| 3393 | } |
|---|
| 3394 | else |
|---|
| 3395 | { |
|---|
| 3396 | $echo =''; |
|---|
| 3397 | if($month_selected && $month_selected!='0') |
|---|
| 3398 | { |
|---|
| 3399 | for($d=0;$d<=$days_in_month;$d++) |
|---|
| 3400 | { |
|---|
| 3401 | $echo .= '"'.$d.'"'; |
|---|
| 3402 | if($d<$days_in_month) |
|---|
| 3403 | $echo .= ','; |
|---|
| 3404 | } |
|---|
| 3405 | } |
|---|
| 3406 | else |
|---|
| 3407 | { |
|---|
| 3408 | foreach($month_array as $month) |
|---|
| 3409 | { |
|---|
| 3410 | $echo .= '"'.$month.'"'; |
|---|
| 3411 | if($stop_count<12) |
|---|
| 3412 | $echo .= ','; |
|---|
| 3413 | $stop_count++; |
|---|
| 3414 | } |
|---|
| 3415 | } |
|---|
| 3416 | |
|---|
| 3417 | $output.= '<script> |
|---|
| 3418 | randomScalingFactor = function(){ return Math.round(Math.random()*100)}; |
|---|
| 3419 | lineChartData = { |
|---|
| 3420 | labels : ['; |
|---|
| 3421 | $stop_count = 1; |
|---|
| 3422 | if($month_selected && $month_selected!='0') |
|---|
| 3423 | { |
|---|
| 3424 | for($d=$days_back;$d<=$days_in_month;$d++) |
|---|
| 3425 | { |
|---|
| 3426 | $output.= '"'.$d.'"'; |
|---|
| 3427 | if($d<$days_in_month) |
|---|
| 3428 | $output.= ','; |
|---|
| 3429 | } |
|---|
| 3430 | } |
|---|
| 3431 | else |
|---|
| 3432 | { |
|---|
| 3433 | foreach($month_array as $month) |
|---|
| 3434 | { |
|---|
| 3435 | $output.= '"'.$month.'"'; |
|---|
| 3436 | if($stop_count<12) |
|---|
| 3437 | $output.= ','; |
|---|
| 3438 | $stop_count++; |
|---|
| 3439 | } |
|---|
| 3440 | } |
|---|
| 3441 | $output.= '], |
|---|
| 3442 | datasets : [ |
|---|
| 3443 | { |
|---|
| 3444 | label: "'.__('Form Views','nex-forms').'", |
|---|
| 3445 | backgroundColor : "'.NEXForms5_hex2RGB('#1976d2',true,',',$opacity).'", |
|---|
| 3446 | borderColor : "#1976d2", |
|---|
| 3447 | borderWidth : 1, |
|---|
| 3448 | pointBackgroundColor : "#1976d2", |
|---|
| 3449 | pointHoverBorderWidth : 5, |
|---|
| 3450 | fill:true, |
|---|
| 3451 | data : [ |
|---|
| 3452 | '; |
|---|
| 3453 | if($month_selected && $month_selected!='0') |
|---|
| 3454 | { |
|---|
| 3455 | $counter2 = 1; |
|---|
| 3456 | foreach($view_array_pm as $views) |
|---|
| 3457 | { |
|---|
| 3458 | if($counter2>=$days_back) |
|---|
| 3459 | { |
|---|
| 3460 | $output.= $views; |
|---|
| 3461 | if($counter2<$days_in_month) |
|---|
| 3462 | $output.= ','; |
|---|
| 3463 | } |
|---|
| 3464 | $counter2++; |
|---|
| 3465 | } |
|---|
| 3466 | } |
|---|
| 3467 | else |
|---|
| 3468 | { |
|---|
| 3469 | $counter2 = 1; |
|---|
| 3470 | foreach($view_array as $views) |
|---|
| 3471 | { |
|---|
| 3472 | $output.= $views; |
|---|
| 3473 | if($counter2<12) |
|---|
| 3474 | $output.= ','; |
|---|
| 3475 | $counter2++; |
|---|
| 3476 | } |
|---|
| 3477 | } |
|---|
| 3478 | $output.= ' |
|---|
| 3479 | ] |
|---|
| 3480 | }, |
|---|
| 3481 | |
|---|
| 3482 | { |
|---|
| 3483 | label: "'.__('Form Interactions','nex-forms').'", |
|---|
| 3484 | backgroundColor : "'.NEXForms5_hex2RGB('#8BC34A',true,',',$opacity).'", |
|---|
| 3485 | borderColor : "#8BC34A", |
|---|
| 3486 | borderWidth : 1, |
|---|
| 3487 | pointBackgroundColor : "#8BC34A", |
|---|
| 3488 | pointHoverBorderWidth : 5, |
|---|
| 3489 | fill:true, |
|---|
| 3490 | data : [ |
|---|
| 3491 | '; |
|---|
| 3492 | if($month_selected && $month_selected!='0') |
|---|
| 3493 | { |
|---|
| 3494 | $counter3 = 1; |
|---|
| 3495 | foreach($interaction_array_pm as $interaction) |
|---|
| 3496 | { |
|---|
| 3497 | if($counter3>=$days_back) |
|---|
| 3498 | { |
|---|
| 3499 | $output.= $interaction; |
|---|
| 3500 | if($counter3<$days_in_month) |
|---|
| 3501 | $output.= ','; |
|---|
| 3502 | } |
|---|
| 3503 | $counter3++; |
|---|
| 3504 | |
|---|
| 3505 | } |
|---|
| 3506 | } |
|---|
| 3507 | else |
|---|
| 3508 | { |
|---|
| 3509 | $counter3 = 1; |
|---|
| 3510 | foreach($interaction_array as $interaction) |
|---|
| 3511 | { |
|---|
| 3512 | $output.= $interaction; |
|---|
| 3513 | if($counter3<12) |
|---|
| 3514 | $output.= ','; |
|---|
| 3515 | $counter3++; |
|---|
| 3516 | } |
|---|
| 3517 | } |
|---|
| 3518 | $output.= ' |
|---|
| 3519 | ] |
|---|
| 3520 | }, |
|---|
| 3521 | { |
|---|
| 3522 | label: "'.__('Form Entries','nex-forms').'", |
|---|
| 3523 | backgroundColor : "'.NEXForms5_hex2RGB('#F57C00',true,',',$opacity).'", |
|---|
| 3524 | borderColor : "#F57C00", |
|---|
| 3525 | borderWidth : 1, |
|---|
| 3526 | pointBackgroundColor : "#F57C00", |
|---|
| 3527 | pointHoverBorderWidth : 5, |
|---|
| 3528 | fill:true, |
|---|
| 3529 | data : [ |
|---|
| 3530 | '; |
|---|
| 3531 | if($month_selected && $month_selected!='0') |
|---|
| 3532 | { |
|---|
| 3533 | $counter = 1; |
|---|
| 3534 | foreach($submit_array_pm as $submissions) |
|---|
| 3535 | { |
|---|
| 3536 | if($counter>=$days_back) |
|---|
| 3537 | { |
|---|
| 3538 | $output.= $submissions; |
|---|
| 3539 | if($counter<$days_in_month) |
|---|
| 3540 | $output.= ','; |
|---|
| 3541 | } |
|---|
| 3542 | $counter++; |
|---|
| 3543 | |
|---|
| 3544 | } |
|---|
| 3545 | } |
|---|
| 3546 | else |
|---|
| 3547 | { |
|---|
| 3548 | $counter = 1; |
|---|
| 3549 | foreach($submit_array as $submissions) |
|---|
| 3550 | { |
|---|
| 3551 | $output.= $submissions; |
|---|
| 3552 | if($counter<12) |
|---|
| 3553 | $output.= ','; |
|---|
| 3554 | $counter++; |
|---|
| 3555 | } |
|---|
| 3556 | } |
|---|
| 3557 | $output.= ' |
|---|
| 3558 | ] |
|---|
| 3559 | } |
|---|
| 3560 | ] |
|---|
| 3561 | } |
|---|
| 3562 | </script> |
|---|
| 3563 | '; |
|---|
| 3564 | } |
|---|
| 3565 | $ajax = isset($_REQUEST['ajax']) ? sanitize_text_field($_REQUEST['ajax']) : ''; |
|---|
| 3566 | if($ajax) |
|---|
| 3567 | { |
|---|
| 3568 | NEXForms_clean_echo( $output); |
|---|
| 3569 | die(); |
|---|
| 3570 | } |
|---|
| 3571 | else |
|---|
| 3572 | return $output; |
|---|
| 3573 | } |
|---|
| 3574 | |
|---|
| 3575 | |
|---|
| 3576 | public function print_record_table(){ |
|---|
| 3577 | |
|---|
| 3578 | global $wpdb; |
|---|
| 3579 | |
|---|
| 3580 | $functions = new NEXForms_functions(); |
|---|
| 3581 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 3582 | |
|---|
| 3583 | $output = ''; |
|---|
| 3584 | |
|---|
| 3585 | $show_delete = (isset($_POST['show_delete'])) ? sanitize_text_field($_POST['show_delete']) : $this->show_delete; |
|---|
| 3586 | |
|---|
| 3587 | $output .= '<div class="dashboard-box database_table '.$this->table.' '.$this->extra_classes.'" data-table="'.$this->table.'">'; |
|---|
| 3588 | $output .= '<div class="dashboard-box-header '.(($this->color_adapt) ? 'aa_bg_main': '' ).'">'; |
|---|
| 3589 | $output .= '<div class="table_title '.(($this->color_adapt) ? 'font_color_1': '' ).' ">'; |
|---|
| 3590 | |
|---|
| 3591 | $output .= $this->table_header; |
|---|
| 3592 | |
|---|
| 3593 | //if($this->action_button) |
|---|
| 3594 | // $output .= '<a class="btn-floating btn-large waves-effect waves-light blue"><i class="material-icons">'.$this->action_button.'</i></a>'; |
|---|
| 3595 | //else |
|---|
| 3596 | // $output .= '<i class="material-icons header-icon">'.$this->table_header_icon.'</i><span class="header_text '.(($this->action_button) ? 'has_action_button' : '' ).'">'.$this->table_header.'</span>'; |
|---|
| 3597 | //<span class="header_text '.(($this->action_button) ? 'has_action_button' : '' ).'">'.$this->table_header.'</span> |
|---|
| 3598 | $output .= '</div>'; |
|---|
| 3599 | if($this->show_search) |
|---|
| 3600 | { |
|---|
| 3601 | $output .= ' <div class="search_box"> |
|---|
| 3602 | <div class="input-field"> |
|---|
| 3603 | <input id="search" type="text" class="search_box aa_bg_main_input material-d" value="" placeholder="'.__('Search...','nex-forms').'" name="table_search_term"> |
|---|
| 3604 | <i class="fa fa-search do_search font_color_1"></i> |
|---|
| 3605 | <i class="fa fa-close do_search font_color_1"></i> |
|---|
| 3606 | </div> |
|---|
| 3607 | </div> |
|---|
| 3608 | '; |
|---|
| 3609 | } |
|---|
| 3610 | if(is_array($this->extra_buttons)) |
|---|
| 3611 | { |
|---|
| 3612 | $output .= '<div class="dashboard-box-header-buttons">'; |
|---|
| 3613 | foreach($this->extra_buttons as $button) |
|---|
| 3614 | { |
|---|
| 3615 | $adapt_color = 'aa_bg_main_btn'; |
|---|
| 3616 | |
|---|
| 3617 | $button_rank = isset($button['rank']) ? $button['rank'] : ''; |
|---|
| 3618 | |
|---|
| 3619 | $button_rank=='2'; |
|---|
| 3620 | $adapt_color = 'aa_bg_sec_btn'; |
|---|
| 3621 | |
|---|
| 3622 | if($button['type']=='link') |
|---|
| 3623 | $output .= '<a href="'.$button['link'].'" class="'.$button['class'].' nf_button '.$adapt_color.'" id="'.$button['id'].'">'.$button['icon'].'</a>'; |
|---|
| 3624 | else |
|---|
| 3625 | $output .= '<a href="#" class="'.$adapt_color.' '.$button['class'].' nf_button" id="'.$button['id'].'">'.$button['icon'].'</a>'; |
|---|
| 3626 | } |
|---|
| 3627 | $output .= '</div>'; |
|---|
| 3628 | } |
|---|
| 3629 | |
|---|
| 3630 | if($this->build_table_dropdown) |
|---|
| 3631 | { |
|---|
| 3632 | $output .= '<select class="form-control table_dropdown" name="'.$this->build_table_dropdown.'">'; |
|---|
| 3633 | $output .= '<option value="0" selected>'.__('--- Select Form ---','nex-forms').'</option>'; |
|---|
| 3634 | $get_forms = 'SELECT * FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_template<>1 AND is_form<>"preview" AND is_form<>"draft" ORDER BY Id DESC'; |
|---|
| 3635 | $forms = $wpdb->get_results($get_forms); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 3636 | foreach($forms as $form) |
|---|
| 3637 | $output .= '<option value="'.$form->Id.'">'.$database_actions->get_total_records($this->table,'',$form->Id).' - '.$form->title.'</option>'; |
|---|
| 3638 | $output .= '</select>'; |
|---|
| 3639 | } |
|---|
| 3640 | $output .= '</div>'; |
|---|
| 3641 | $output .= '<div class="dashboard-box-content zero_padding">'; |
|---|
| 3642 | |
|---|
| 3643 | $output .= '<table class="'.(($this->table_resize) ? 'fixed_headers' : '').'">'; //highlight |
|---|
| 3644 | if($this->show_headings) |
|---|
| 3645 | { |
|---|
| 3646 | $output .= '<thead>'; |
|---|
| 3647 | $output .= '<tr>'; |
|---|
| 3648 | $output .= '<th class="batch-actions"> |
|---|
| 3649 | <input id="rs-check-all" name="check-all" value="check-all" type="checkbox"> |
|---|
| 3650 | </th>'; |
|---|
| 3651 | foreach($this->table_headings as $key=>$val) |
|---|
| 3652 | { |
|---|
| 3653 | if(is_array($val)) |
|---|
| 3654 | { |
|---|
| 3655 | if(array_key_exists('heading',$val)) |
|---|
| 3656 | $output .= '<th class="db-table-head '.((isset($val['set_class'])) ? $val['set_class'] : '').' '.$functions->format_name($val['heading']).' '.((isset($val['sort_by']) && $this->sortable_columns) ? 'sortable' : '' ).'" '.((isset($val['sort_by'])) ? 'data-sort-by="'.$val['sort_by'].'"' : '' ).'>'.$functions->unformat_records_name($val['heading']).'</th>'; |
|---|
| 3657 | if(array_key_exists('icon',$val)) |
|---|
| 3658 | $output .= '<th class="db-table-head '.((isset($val['set_class'])) ? $val['set_class'] : '').' '.((isset($val['sort_by']) && $this->sortable_columns) ? 'sortable' : '' ).'" '.(($val['sort_by']) ? 'data-sort-by="'.((isset($val['sort_by'])) ? $val['sort_by'] : '').'"' : '' ).'><span class="'.$val['icon'].'"></span></th>'; |
|---|
| 3659 | } |
|---|
| 3660 | else |
|---|
| 3661 | $output .= '<th class="db-table-head '.(($this->sortable_columns) ? 'sortable' : '' ).' '.$functions->format_name($val).'" data-sort-by="'.$functions->format_name($val).'">'.$functions->unformat_records_name($val).'</th>'; |
|---|
| 3662 | } |
|---|
| 3663 | if($show_delete) |
|---|
| 3664 | $output .= '<th class="db-table-head delete"></th>'; |
|---|
| 3665 | $output .= '</tr>'; |
|---|
| 3666 | |
|---|
| 3667 | |
|---|
| 3668 | $output .= '</thead>'; |
|---|
| 3669 | } |
|---|
| 3670 | //$output .= $functions->print_preloader('big','blue',false,'database-table-loader'); |
|---|
| 3671 | $output .= '<tbody class="'.(($this->checkout) ? 'saved_records_container' : 'saved_records_contianer').'">'.$this->get_table_records($this->additional_params, $this->search_params, $this->table_headings, $this->is_report ).'</tbody>'; |
|---|
| 3672 | |
|---|
| 3673 | $output .= '</table>'; |
|---|
| 3674 | $output .= '</div>'; |
|---|
| 3675 | $output .= '<div class="paging_wrapper">'; |
|---|
| 3676 | |
|---|
| 3677 | |
|---|
| 3678 | |
|---|
| 3679 | $output .='<input type="hidden" value="0" name="current_page" />'; |
|---|
| 3680 | |
|---|
| 3681 | $output .="<input type='hidden' value='".json_encode($this->additional_params,JSON_UNESCAPED_UNICODE)."' name='additional_params' />"; |
|---|
| 3682 | $output .="<input type='hidden' value='".json_encode($this->field_selection,JSON_UNESCAPED_UNICODE)."' name='field_selection' />"; |
|---|
| 3683 | $output .="<input type='hidden' value='".json_encode($this->search_params,JSON_UNESCAPED_UNICODE)."' name='search_params' />"; |
|---|
| 3684 | $output .="<input type='hidden' value='".json_encode($this->table_headings,JSON_UNESCAPED_UNICODE)."' name='header_params' />"; |
|---|
| 3685 | $output .="<input type='hidden' value='' name='sort_by' />"; |
|---|
| 3686 | $output .="<input type='hidden' value='DESC' name='sort_by_direction' />"; |
|---|
| 3687 | $output .="<input type='hidden' value='".$this->is_report."' name='is_report' />"; |
|---|
| 3688 | $output .="<input type='hidden' value='".$this->table."' name='database_table' />"; |
|---|
| 3689 | $output .="<input type='hidden' value='".$this->record_limit."' name='record_limit' />"; |
|---|
| 3690 | $output .="<input type='hidden' value='".$this->show_delete."' name='show_delete' />"; |
|---|
| 3691 | $output .="<input type='hidden' value='".$this->action."' name='do_action' />"; |
|---|
| 3692 | |
|---|
| 3693 | |
|---|
| 3694 | $total_record = $database_actions->get_total_records($this->table,$this->additional_params,'', $this->search_params,''); |
|---|
| 3695 | |
|---|
| 3696 | $output .= '<div class="paging">'; |
|---|
| 3697 | |
|---|
| 3698 | if($this->show_paging) |
|---|
| 3699 | { |
|---|
| 3700 | $output .= ' |
|---|
| 3701 | <span class="displaying-num"><span class="entry-count">'.$total_record.'</span> '.__('items ','nex-forms').'</span> |
|---|
| 3702 | <span class="pagination-links"> |
|---|
| 3703 | |
|---|
| 3704 | <span class="paging-input">Page <span class="current-page">1</span> '.__('of','nex-forms').' <span class="total-pages">'.(($total_record>$this->record_limit) ? round(($total_record/$this->record_limit)+1,0) : '1').'</span><span class="records_per_page"> |
|---|
| 3705 | <select name="set_record_per_page"> |
|---|
| 3706 | <option value="10" '.(($this->record_limit==10) ? 'selected="selected"' : '').'>10</option> |
|---|
| 3707 | <option value="20" '.(($this->record_limit==20) ? 'selected="selected"' : '').'>20</option> |
|---|
| 3708 | <option value="50" '.(($this->record_limit==50) ? 'selected="selected"' : '').'>50</option> |
|---|
| 3709 | <option value="100" '.(($this->record_limit==100) ? 'selected="selected"' : '').'>100</option> |
|---|
| 3710 | <option value="150" '.(($this->record_limit==150) ? 'selected="selected"' : '').'>150</option> |
|---|
| 3711 | <option value="300" '.(($this->record_limit==300) ? 'selected="selected"' : '').'>300</option> |
|---|
| 3712 | <option value="500" '.(($this->record_limit==500) ? 'selected="selected"' : '').'>500</option> |
|---|
| 3713 | <option value="1000" '.(($this->record_limit==1000) ? 'selected="selected"' : '').'>1000</option> |
|---|
| 3714 | </select> '.__('records p/page','nex-forms').'</span> |
|---|
| 3715 | |
|---|
| 3716 | <a title="'.__('Go to the first page','nex-forms').'" class="first-page iz-first-page btn waves-effect waves-light"><span class="fa fa-angle-double-left"></span></a> |
|---|
| 3717 | <a title="'.__('Go to the next page','nex-forms').'" class="iz-prev-page btn waves-effect waves-light prev-page"><span class="fa fa-angle-left"></span></a> |
|---|
| 3718 | |
|---|
| 3719 | <a title="'.__('Go to the next page','nex-forms').'" class="iz-next-page btn waves-effect waves-light next-page"><span class="fa fa-angle-right"></span></a> |
|---|
| 3720 | <a title="'.__('Go to the last page','nex-forms').'" class="iz-last-page btn waves-effect waves-light last-page"><span class="fa fa-angle-double-right"></span></a> |
|---|
| 3721 | </span> |
|---|
| 3722 | |
|---|
| 3723 | '; |
|---|
| 3724 | } |
|---|
| 3725 | if($this->show_more_link){ |
|---|
| 3726 | $output .= '<a href="'.$this->show_more_link['link'].'" class="show_more_button">'.$this->show_more_link['text'].' <span class="fa fa-chevron-right"></span></a>'; |
|---|
| 3727 | } |
|---|
| 3728 | $output .= '</div>'; |
|---|
| 3729 | |
|---|
| 3730 | $output .= '</div>'; |
|---|
| 3731 | |
|---|
| 3732 | $output .= '</div>'; |
|---|
| 3733 | |
|---|
| 3734 | return $output; |
|---|
| 3735 | } |
|---|
| 3736 | public function get_table_records($additional_params=array(), $search_params=array(), $header_params=array(), $is_report=false){ |
|---|
| 3737 | |
|---|
| 3738 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 3739 | $set_is_report = (isset($_POST['is_report'])) ? sanitize_text_field($_POST['is_report']) : $is_report; |
|---|
| 3740 | |
|---|
| 3741 | if($do_ajax) |
|---|
| 3742 | { |
|---|
| 3743 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) |
|---|
| 3744 | wp_die(); |
|---|
| 3745 | } |
|---|
| 3746 | |
|---|
| 3747 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 3748 | wp_die(); |
|---|
| 3749 | global $wpdb; |
|---|
| 3750 | |
|---|
| 3751 | |
|---|
| 3752 | $output = ''; |
|---|
| 3753 | $page_num = isset($_POST['page']) ? esc_sql(sanitize_title($_POST['page'])) : 0; |
|---|
| 3754 | $page_num = sanitize_title($page_num); |
|---|
| 3755 | |
|---|
| 3756 | $page_num = isset($_POST['page']) ? esc_sql(sanitize_title($_POST['page'])) : 0; |
|---|
| 3757 | $page_num = sanitize_title($page_num); |
|---|
| 3758 | $search_term = isset($_POST['search_term']) ? esc_sql(sanitize_title($_POST['search_term'])) : ''; |
|---|
| 3759 | $limit = 10; |
|---|
| 3760 | |
|---|
| 3761 | $nf_functions = new NEXForms_Functions(); |
|---|
| 3762 | $database_actions = new NEXForms_Database_Actions(); |
|---|
| 3763 | |
|---|
| 3764 | $header_params = (isset($_POST['header_params'])) ? sanitize_text_field($_POST['header_params']) : ''; |
|---|
| 3765 | $additional_params = (isset($_POST['additional_params'])) ? sanitize_text_field($_POST['additional_params']) : ''; |
|---|
| 3766 | $field_selection = (isset($_POST['field_selection'])) ? esc_sql(sanitize_text_field($_POST['field_selection'])) : ''; |
|---|
| 3767 | $search_params = (isset($_POST['search_params'])) ? esc_sql(sanitize_text_field($_POST['search_params'])) : ''; |
|---|
| 3768 | |
|---|
| 3769 | |
|---|
| 3770 | |
|---|
| 3771 | $do_action = (isset($_POST['do_action'])) ? esc_sql(sanitize_title($_POST['do_action'])) : $this->action; |
|---|
| 3772 | |
|---|
| 3773 | $sort_by_table = ''; |
|---|
| 3774 | |
|---|
| 3775 | if($do_action=='print_entries') |
|---|
| 3776 | { |
|---|
| 3777 | if($_POST['sort_by']=='title') |
|---|
| 3778 | $sort_by_table = $wpdb->prefix.'wap_nex_forms.'; |
|---|
| 3779 | else |
|---|
| 3780 | $sort_by_table = $wpdb->prefix.'wap_nex_forms_entries.'; |
|---|
| 3781 | } |
|---|
| 3782 | |
|---|
| 3783 | $sort_by = (isset($_POST['sort_by']) && $_POST['sort_by']!='') ? $wpdb->prepare('%s',esc_sql(sanitize_title($_POST['sort_by']))) : 'Id'; |
|---|
| 3784 | $sort_by = $sort_by_table.$sort_by; |
|---|
| 3785 | $sort_by = str_replace('\'','',$sort_by); |
|---|
| 3786 | $sort_by_direction =(isset($_POST['sort_by_direction']) && $_POST['sort_by_direction']!='') ? $wpdb->prepare('%s',esc_sql(sanitize_title($_POST['sort_by_direction']))) : 'DESC'; |
|---|
| 3787 | $sort_by_direction = str_replace('\'','',$sort_by_direction); |
|---|
| 3788 | $record_limit = (isset($_POST['record_limit'])) ? $wpdb->prepare('%d',esc_sql(sanitize_title($_POST['record_limit']))) : $wpdb->prepare('%d',esc_sql($this->record_limit)); |
|---|
| 3789 | |
|---|
| 3790 | |
|---|
| 3791 | if($header_params) |
|---|
| 3792 | { |
|---|
| 3793 | $set_header_params = isset($header_params) ? $header_params : ''; |
|---|
| 3794 | if(!is_array($set_header_params)) |
|---|
| 3795 | $header_params = json_decode(str_replace('\\','',$set_header_params),true); |
|---|
| 3796 | else |
|---|
| 3797 | $header_params = $wpdb->prepare('%s',esc_sql(sanitize_title($set_header_params))); |
|---|
| 3798 | } |
|---|
| 3799 | else |
|---|
| 3800 | $header_params = $this->table_headings; |
|---|
| 3801 | |
|---|
| 3802 | if($additional_params) |
|---|
| 3803 | { |
|---|
| 3804 | $set_params = isset($additional_params) ? $additional_params : ''; |
|---|
| 3805 | if(!is_array($set_params)) |
|---|
| 3806 | $additional_params = json_decode(str_replace('\\','',$set_params),true); |
|---|
| 3807 | else |
|---|
| 3808 | $additional_params = $wpdb->prepare('%s',esc_sql(sanitize_title($set_params))); |
|---|
| 3809 | } |
|---|
| 3810 | else |
|---|
| 3811 | $additional_params = $this->additional_params; |
|---|
| 3812 | |
|---|
| 3813 | if($field_selection) |
|---|
| 3814 | { |
|---|
| 3815 | $set_field_selection = isset($field_selection) ? $field_selection : ''; |
|---|
| 3816 | if(!is_array($set_field_selection)) |
|---|
| 3817 | $field_selection = json_decode(str_replace('\\','',$set_field_selection),true); |
|---|
| 3818 | else |
|---|
| 3819 | $field_selection = $wpdb->prepare('%s',esc_sql(sanitize_title($set_field_selection))); |
|---|
| 3820 | } |
|---|
| 3821 | else |
|---|
| 3822 | $field_selection = $this->field_selection; |
|---|
| 3823 | |
|---|
| 3824 | |
|---|
| 3825 | |
|---|
| 3826 | if($search_params) |
|---|
| 3827 | { |
|---|
| 3828 | $set_search_params = isset($search_params) ? $search_params : ''; |
|---|
| 3829 | if(!is_array($set_search_params)) |
|---|
| 3830 | $search_params = json_decode(str_replace('\\','',$set_search_params),true); |
|---|
| 3831 | else |
|---|
| 3832 | $search_params = $wpdb->prepare('%s',esc_sql(sanitize_title($set_search_params))); |
|---|
| 3833 | } |
|---|
| 3834 | else |
|---|
| 3835 | $search_params = $this->search_params; |
|---|
| 3836 | |
|---|
| 3837 | if(isset($_POST['table'])) |
|---|
| 3838 | $table = $wpdb->prepare('%s',esc_sql(sanitize_title($_POST['table']))); |
|---|
| 3839 | else |
|---|
| 3840 | $table = $wpdb->prepare('%s',$this->table); |
|---|
| 3841 | |
|---|
| 3842 | $table = str_replace('\'','',$table); |
|---|
| 3843 | |
|---|
| 3844 | $where_str = ''; |
|---|
| 3845 | $show_hide_field = (isset($_POST['showhide_fields'])) ? str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_text_field($_POST['showhide_fields'])))) : ''; |
|---|
| 3846 | |
|---|
| 3847 | $show_cols = esc_sql(sanitize_text_field($show_hide_field)); |
|---|
| 3848 | |
|---|
| 3849 | if(is_array($additional_params)) |
|---|
| 3850 | { |
|---|
| 3851 | foreach($additional_params as $clause) |
|---|
| 3852 | { |
|---|
| 3853 | $like = ''; |
|---|
| 3854 | if($clause['operator'] == 'LIKE' || $clause['operator'] == 'NOT LIKE') |
|---|
| 3855 | $like = '%'; |
|---|
| 3856 | if($clause['value']=='NULL') |
|---|
| 3857 | $where_str .= ' AND `'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($clause['column'])))).'` '.(($clause['operator']!='') ? str_replace('\'','',$wpdb->prepare('%s',$clause['operator'])) : '=').' '.str_replace('\'','',$wpdb->prepare('%s',$like.esc_sql(sanitize_text_field($clause['value'])).$like)); |
|---|
| 3858 | else |
|---|
| 3859 | $where_str .= ' AND `'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($clause['column'])))).'` '.(($clause['operator']!='') ? str_replace('\'','',$wpdb->prepare('%s',$clause['operator'])) : '=').' "'.$like.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_text_field($clause['value'])))).$like.'"'; |
|---|
| 3860 | |
|---|
| 3861 | } |
|---|
| 3862 | } |
|---|
| 3863 | |
|---|
| 3864 | $select_fields = '*'; |
|---|
| 3865 | if($is_report) |
|---|
| 3866 | { |
|---|
| 3867 | $set_field_selection = array(); |
|---|
| 3868 | $table_fields = $wpdb->get_results('SHOW FIELDS FROM '.$wpdb->prefix.$table); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 3869 | $db_cols = array(); |
|---|
| 3870 | foreach($table_fields as $col) |
|---|
| 3871 | { |
|---|
| 3872 | if($col->Field!='Id') |
|---|
| 3873 | { |
|---|
| 3874 | if(in_array($col->Field,$field_selection)) |
|---|
| 3875 | $set_field_selection[] = $col->Field; |
|---|
| 3876 | } |
|---|
| 3877 | } |
|---|
| 3878 | $diff = array_diff($field_selection,$set_field_selection); |
|---|
| 3879 | $field_selection = $set_field_selection; |
|---|
| 3880 | /*if(!empty($diff)) |
|---|
| 3881 | { |
|---|
| 3882 | foreach($diff as $no) |
|---|
| 3883 | { |
|---|
| 3884 | $unconverted_fields .= ' '.$no.','; |
|---|
| 3885 | } |
|---|
| 3886 | echo '<div class="alert alert-info">The following fields could not be converted into MySQL table columns: '.$unconverted_fields.'</div>'; |
|---|
| 3887 | // print_r($diff); |
|---|
| 3888 | //echo '</pre>'; |
|---|
| 3889 | }*/ |
|---|
| 3890 | } |
|---|
| 3891 | |
|---|
| 3892 | if(is_array($field_selection)) |
|---|
| 3893 | { |
|---|
| 3894 | $j=1; |
|---|
| 3895 | $select_fields = ''; |
|---|
| 3896 | foreach($field_selection as $field_select) |
|---|
| 3897 | { |
|---|
| 3898 | |
|---|
| 3899 | if($j<count($field_selection)) |
|---|
| 3900 | $select_fields .= '`'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($field_select)))).'`,'; |
|---|
| 3901 | else |
|---|
| 3902 | $select_fields .= '`'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($field_select)))).'`'; |
|---|
| 3903 | $j++; |
|---|
| 3904 | } |
|---|
| 3905 | } |
|---|
| 3906 | |
|---|
| 3907 | $count_search_params = 0; |
|---|
| 3908 | |
|---|
| 3909 | if(is_array($search_params)) |
|---|
| 3910 | $count_search_params = count($search_params); |
|---|
| 3911 | |
|---|
| 3912 | if(is_array($search_params) && $search_term) |
|---|
| 3913 | { |
|---|
| 3914 | if($count_search_params>1) |
|---|
| 3915 | { |
|---|
| 3916 | $where_str .= ' AND ('; |
|---|
| 3917 | $loop_count = 1; |
|---|
| 3918 | foreach($search_params as $column) |
|---|
| 3919 | { |
|---|
| 3920 | if($loop_count==1) |
|---|
| 3921 | $where_str .= '`'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($column)))).'` LIKE "%'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($search_term)))).'%" '; |
|---|
| 3922 | else |
|---|
| 3923 | $where_str .= ' OR `'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($column)))).'` LIKE "%'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($search_term)))).'%" '; |
|---|
| 3924 | |
|---|
| 3925 | $loop_count++; |
|---|
| 3926 | } |
|---|
| 3927 | $where_str .= ') '; |
|---|
| 3928 | } |
|---|
| 3929 | else |
|---|
| 3930 | { |
|---|
| 3931 | foreach($search_params as $column) |
|---|
| 3932 | { |
|---|
| 3933 | $where_str .= ' AND `'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($column)))).'` LIKE "%'.str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($search_term)))).'%" '; |
|---|
| 3934 | } |
|---|
| 3935 | } |
|---|
| 3936 | } |
|---|
| 3937 | |
|---|
| 3938 | $entry_report_id = (isset($_POST['entry_report_id'])) ? str_replace('\'','',$wpdb->prepare('%d',esc_sql(sanitize_title($_POST['entry_report_id'])))) : ''; |
|---|
| 3939 | $form_id = (isset($_POST['form_id'])) ? str_replace('\'','',$wpdb->prepare('%d',esc_sql(sanitize_title($_POST['form_id'])))) : ''; |
|---|
| 3940 | $post_table = (isset($_POST['table'])) ? str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_title($_POST['table'])))) : ''; |
|---|
| 3941 | |
|---|
| 3942 | $is_report = (isset($_POST['is_report'])) ? str_replace('\'','',$wpdb->prepare('%s',esc_sql(sanitize_text_field($_POST['is_report'])))) : $this->is_report; |
|---|
| 3943 | |
|---|
| 3944 | if($entry_report_id) |
|---|
| 3945 | { |
|---|
| 3946 | $where_str .= ' AND nex_forms_Id = '.$wpdb->prepare('%d',esc_sql(sanitize_title($entry_report_id))); |
|---|
| 3947 | $nex_forms_id = esc_sql(sanitize_title($entry_report_id)); |
|---|
| 3948 | } |
|---|
| 3949 | if($form_id) |
|---|
| 3950 | { |
|---|
| 3951 | $where_str .= ' AND nex_forms_Id = '.$wpdb->prepare('%d',esc_sql(sanitize_title($form_id))); |
|---|
| 3952 | $nex_forms_id = $wpdb->prepare('%d',esc_sql(sanitize_title($form_id))); |
|---|
| 3953 | } |
|---|
| 3954 | |
|---|
| 3955 | if($post_table) |
|---|
| 3956 | $output = '<div class="total_table_records hidden">'.$database_actions->get_total_records($table,$additional_params,$nex_forms_id, $search_params,$search_term).'</div>'; |
|---|
| 3957 | |
|---|
| 3958 | |
|---|
| 3959 | if($do_action=='print_entries') |
|---|
| 3960 | $get_records = 'SELECT '.$select_fields.', title FROM '.$wpdb->prefix.$table.', '.$wpdb->prefix.'wap_nex_forms WHERE '.$wpdb->prefix.$table.'.Id<>"" AND '.$wpdb->prefix.'wap_nex_forms.Id = '.$wpdb->prefix.$table.'.nex_forms_Id '.$where_str.' ORDER BY '.$sort_by.' '.$sort_by_direction.' LIMIT '.($page_num*$record_limit).','.$record_limit; |
|---|
| 3961 | else |
|---|
| 3962 | $get_records = 'SELECT '.$select_fields.' FROM '.$wpdb->prefix.$table.' WHERE Id<>"" '.$where_str.' ORDER BY '.$sort_by.' '.$sort_by_direction.' LIMIT '.($page_num*$record_limit).','.$record_limit; |
|---|
| 3963 | |
|---|
| 3964 | $records = $wpdb->get_results($get_records); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 3965 | |
|---|
| 3966 | $get_temp_table_details = get_option('tmp_csv_export'); |
|---|
| 3967 | update_option('tmp_csv_export',array('query'=>$get_records,'cols'=>$field_selection,'form_Id'=>$get_temp_table_details['form_Id'])); |
|---|
| 3968 | |
|---|
| 3969 | $img_ext_array = array('jpg','jpeg','png','tiff','gif','psd'); |
|---|
| 3970 | $file_ext_array = array('doc','docx','mpg','mpeg','mp3','mp4','odt','odp','ods','pdf','ppt','pptx','txt','xls','xlsx'); |
|---|
| 3971 | foreach($records as $record) |
|---|
| 3972 | { |
|---|
| 3973 | $record_val = ''; |
|---|
| 3974 | $output .= '<tr class="form_record" id="'.$record->Id.'">'; |
|---|
| 3975 | $output .= '<td class="batch-actions"><input id="rs-check-all-'.$record->Id.'" name="record[]" value="'.$record->Id.'" type="checkbox"></td>'; |
|---|
| 3976 | if($is_report) |
|---|
| 3977 | { |
|---|
| 3978 | foreach($record as $record_head=>$record_val) |
|---|
| 3979 | { |
|---|
| 3980 | if($record_head!='Id') |
|---|
| 3981 | { |
|---|
| 3982 | |
|---|
| 3983 | //$field_value = $data->field_value; |
|---|
| 3984 | $set_val = ''; |
|---|
| 3985 | if(strstr($record_val,'||')) |
|---|
| 3986 | { |
|---|
| 3987 | |
|---|
| 3988 | $get_val = explode('||',$record_val); |
|---|
| 3989 | |
|---|
| 3990 | foreach($get_val as $setkey=>$setval) |
|---|
| 3991 | { |
|---|
| 3992 | $set_val .= ''.trim($setval).','; |
|---|
| 3993 | } |
|---|
| 3994 | |
|---|
| 3995 | $record_val = $set_val; |
|---|
| 3996 | |
|---|
| 3997 | } |
|---|
| 3998 | |
|---|
| 3999 | |
|---|
| 4000 | if($nf_functions->isJson($record_val) && !is_numeric($record_val)) |
|---|
| 4001 | { |
|---|
| 4002 | $output .= '<td class="'.$val.'" style="">'; |
|---|
| 4003 | $json = json_decode($record_val,1); |
|---|
| 4004 | |
|---|
| 4005 | $output .= '<table width="100%" class="highlight inner-data-table" cellpadding="3" cellspacing="0" style="border-bottom:1px solid #ddd; border-left:1px solid #ddd; border-top:1px solid #ddd;">'; |
|---|
| 4006 | $i = 1; |
|---|
| 4007 | foreach($json as $value) |
|---|
| 4008 | { |
|---|
| 4009 | if(is_array($value) || is_object($value)) |
|---|
| 4010 | { |
|---|
| 4011 | |
|---|
| 4012 | if($i==1) |
|---|
| 4013 | { |
|---|
| 4014 | $output .= '<tr>'; |
|---|
| 4015 | foreach($value as $innerkey=>$innervalue) |
|---|
| 4016 | { |
|---|
| 4017 | if(!strstr($innerkey,'real_val__')) |
|---|
| 4018 | $output .= '<td style="border-bottom:1px solid #ddd;border-right:1px solid #ddd;"><strong>'.ucfirst($nf_functions->unformat_records_name($innerkey)).'</strong></td>'; |
|---|
| 4019 | } |
|---|
| 4020 | $output .= '</tr>'; |
|---|
| 4021 | } |
|---|
| 4022 | |
|---|
| 4023 | $output .= '<tr>'; |
|---|
| 4024 | foreach($value as $innerkey=>$innervalue) |
|---|
| 4025 | { |
|---|
| 4026 | if(array_key_exists('real_val__'.$innerkey,$value)) |
|---|
| 4027 | { |
|---|
| 4028 | $realval = 'real_val__'.$innerkey; |
|---|
| 4029 | $innervalue = $val->$realval; |
|---|
| 4030 | |
|---|
| 4031 | } |
|---|
| 4032 | if(!strstr($innerkey,'real_val__')) |
|---|
| 4033 | { |
|---|
| 4034 | |
|---|
| 4035 | if(in_array($nf_functions->get_ext($innervalue),$img_ext_array)) |
|---|
| 4036 | $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;"><img class="materialboxed" src="'.rtrim($innervalue,', ').'" width="80px" /></td>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4037 | else |
|---|
| 4038 | $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;">'.rtrim($innervalue,', ').'</td>'; |
|---|
| 4039 | |
|---|
| 4040 | } |
|---|
| 4041 | } |
|---|
| 4042 | |
|---|
| 4043 | $output .= '</tr>'; |
|---|
| 4044 | |
|---|
| 4045 | } |
|---|
| 4046 | else |
|---|
| 4047 | $output .= ''.rtrim(esc_html(strip_tags($value)),', ').''; |
|---|
| 4048 | |
|---|
| 4049 | $i++; |
|---|
| 4050 | } |
|---|
| 4051 | |
|---|
| 4052 | $output .= '</table>'; |
|---|
| 4053 | $output .= '</td>'; |
|---|
| 4054 | } |
|---|
| 4055 | else if(strstr($record_val,',') && !strstr($record_val,'data:image')) |
|---|
| 4056 | { |
|---|
| 4057 | $is_array = explode(',',$record_val); |
|---|
| 4058 | $output .= '<td class="image_td '.$val.'">'; |
|---|
| 4059 | foreach($is_array as $item) |
|---|
| 4060 | { |
|---|
| 4061 | if(in_array($nf_functions->get_ext($item),$img_ext_array)) |
|---|
| 4062 | $output .= '<img class="materialboxed" width="40px" src="'.$item.'">'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4063 | else if(in_array($nf_functions->get_ext($item),$file_ext_array)) |
|---|
| 4064 | $output .= '<a class="btn file_upload_link" href="'.$item.'" target="_blank"><i class="fa fa-file"></i> '.$nf_functions->get_ext($item).'</a>'; |
|---|
| 4065 | else |
|---|
| 4066 | $output .= $item; |
|---|
| 4067 | } |
|---|
| 4068 | $output .= '</td>'; |
|---|
| 4069 | } |
|---|
| 4070 | else if(strstr($record_val,'data:image')) |
|---|
| 4071 | $output .= '<td class="'.$val.'"><img width="100px" src="'.$record_val.'" /></td>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4072 | else if(in_array($nf_functions->get_ext($record_val),$img_ext_array) && $val!='name') |
|---|
| 4073 | $output .= '<td class="'.$val.'"><img class="materialboxed" width="65px" src="'.esc_html(strip_tags($record_val)).'"></td>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4074 | else{ |
|---|
| 4075 | |
|---|
| 4076 | |
|---|
| 4077 | $output .= '<td class="report_row '.$record_val.'">'.$nf_functions->view_excerpt(esc_html(strip_tags($record_val)),30).'</td>'; |
|---|
| 4078 | } |
|---|
| 4079 | |
|---|
| 4080 | |
|---|
| 4081 | } |
|---|
| 4082 | } |
|---|
| 4083 | } |
|---|
| 4084 | else |
|---|
| 4085 | { |
|---|
| 4086 | foreach($header_params as $key=>$val) |
|---|
| 4087 | { |
|---|
| 4088 | |
|---|
| 4089 | |
|---|
| 4090 | |
|---|
| 4091 | if(is_array($val)) |
|---|
| 4092 | { |
|---|
| 4093 | $func_args_1 = (isset($val['user_func_args_1'])) ? $val['user_func_args_1'] : ''; |
|---|
| 4094 | $func_args_2 = (isset($val['user_func_args_2'])) ? $val['user_func_args_2'] : ''; |
|---|
| 4095 | $func_args_3 = (isset($val['user_func_args_3'])) ? $val['user_func_args_3'] : ''; |
|---|
| 4096 | $func_args_4 = (isset($val['user_func_args_4'])) ? $val['user_func_args_4'] : ''; |
|---|
| 4097 | $func_args_5 = (isset($val['user_func_args_5'])) ? $val['user_func_args_5'] : ''; |
|---|
| 4098 | $func_args_6 = (isset($val['user_func_args_6'])) ? $val['user_func_args_6'] : ''; |
|---|
| 4099 | |
|---|
| 4100 | |
|---|
| 4101 | if(isset($val['user_func_class'])) |
|---|
| 4102 | { |
|---|
| 4103 | $whitelist_func = NEXForms_safe_user_functions(); |
|---|
| 4104 | if(in_array($val['user_func'],$whitelist_func)) |
|---|
| 4105 | $output .= '<td class="'.$nf_functions->format_name($val['heading']).' '.((isset($val['set_class'])) ? $val['set_class'] : '').'">'.call_user_func(array($val['user_func_class'],$val['user_func']), array($record->$func_args_1, $func_args_2)).'</td>'; |
|---|
| 4106 | } |
|---|
| 4107 | else |
|---|
| 4108 | $output .= '<td class=" '.((isset($val['set_class'])) ? $val['set_class'] : '').'">'.call_user_func($val['user_func'], array($record->$func_args_1, $func_args_2)).'</td>'; |
|---|
| 4109 | } |
|---|
| 4110 | else |
|---|
| 4111 | { |
|---|
| 4112 | if($val) |
|---|
| 4113 | { |
|---|
| 4114 | |
|---|
| 4115 | if($nf_functions->isJson($record_val) && !is_numeric($record_val)) |
|---|
| 4116 | { |
|---|
| 4117 | $output .= '<td class="'.$val.'" style="overflow-x:auto;overflow-y:auto;">'; |
|---|
| 4118 | $json = json_decode($record->$val,1); |
|---|
| 4119 | |
|---|
| 4120 | $output .= '<table width="100%" class="highlight" cellpadding="3" cellspacing="0" style="border-bottom:1px solid #ddd; border-left:1px solid #ddd; border-top:1px solid #ddd;">'; |
|---|
| 4121 | $i = 1; |
|---|
| 4122 | foreach($json as $value) |
|---|
| 4123 | { |
|---|
| 4124 | if(is_array($value) || is_object($value)) |
|---|
| 4125 | { |
|---|
| 4126 | |
|---|
| 4127 | if($i==1) |
|---|
| 4128 | { |
|---|
| 4129 | $output .= '<tr>'; |
|---|
| 4130 | foreach($value as $innerkey=>$innervalue) |
|---|
| 4131 | { |
|---|
| 4132 | if(!strstr($innerkey,'real_val__')) |
|---|
| 4133 | $output .= '<td style="border-bottom:1px solid #ddd;border-right:1px solid #ddd;"><strong>'.$nf_functions->unformat_records_name($innerkey).'</strong></td>'; |
|---|
| 4134 | } |
|---|
| 4135 | $output .= '</tr>'; |
|---|
| 4136 | } |
|---|
| 4137 | |
|---|
| 4138 | $output .= '<tr>'; |
|---|
| 4139 | foreach($value as $innerkey=>$innervalue) |
|---|
| 4140 | { |
|---|
| 4141 | if(array_key_exists('real_val__'.$innerkey.'',$val)) |
|---|
| 4142 | { |
|---|
| 4143 | $realval = 'real_val__'.$innerkey; |
|---|
| 4144 | $innervalue = $val->$realval; |
|---|
| 4145 | |
|---|
| 4146 | } |
|---|
| 4147 | if(!strstr($innerkey,'real_val__')) |
|---|
| 4148 | { |
|---|
| 4149 | |
|---|
| 4150 | if(in_array($nf_functions->get_ext($innervalue),$img_ext_array)) |
|---|
| 4151 | $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;"><img class="materialboxed" src="'.rtrim($innervalue,', ').'" width="80px" /></td>';// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4152 | else |
|---|
| 4153 | $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;">'.rtrim($innervalue,', ').'</td>'; |
|---|
| 4154 | |
|---|
| 4155 | } |
|---|
| 4156 | } |
|---|
| 4157 | |
|---|
| 4158 | $output .= '</tr>'; |
|---|
| 4159 | |
|---|
| 4160 | //foreach($value as $innerkey => $innervalue) |
|---|
| 4161 | //{ |
|---|
| 4162 | //$output .= '<strong>'.$nf_functions->unformat_records_name($innerkey).'</strong>: '.$innervalue.' | '; |
|---|
| 4163 | //} |
|---|
| 4164 | //$output .= '<br />'; |
|---|
| 4165 | } |
|---|
| 4166 | else |
|---|
| 4167 | $output .= ''.rtrim(esc_html(strip_tags($value)),', ').''; |
|---|
| 4168 | |
|---|
| 4169 | $i++; |
|---|
| 4170 | } |
|---|
| 4171 | |
|---|
| 4172 | $output .= '</table>'; |
|---|
| 4173 | $output .= '</td>'; |
|---|
| 4174 | } |
|---|
| 4175 | else if(strstr($record->$val,',') && !strstr($record->$val,'data:image')) |
|---|
| 4176 | { |
|---|
| 4177 | $is_array = explode(',',$record->$val); |
|---|
| 4178 | $output .= '<td class="image_td '.$val.'">'; |
|---|
| 4179 | foreach($is_array as $item) |
|---|
| 4180 | { |
|---|
| 4181 | if(in_array($nf_functions->get_ext($item),$img_ext_array)) |
|---|
| 4182 | $output .= '<img class="materialboxed" width="65px" src="'.$item.'">'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4183 | else if(in_array($nf_functions->get_ext($item),$file_ext_array)) |
|---|
| 4184 | $output .= '<a class="btn file_upload_link" href="'.$item.'" target="_blank"><i class="fa fa-file"></i> '.$nf_functions->get_ext($item).'</a>'; |
|---|
| 4185 | else |
|---|
| 4186 | $output .= $item; |
|---|
| 4187 | } |
|---|
| 4188 | $output .= '</td>'; |
|---|
| 4189 | } |
|---|
| 4190 | else if(strstr($record->$val,'data:image')) |
|---|
| 4191 | $output .= '<td class="'.$val.'"><img width="100px" src="'.$record->$val.'" /></td>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4192 | else if(in_array($nf_functions->get_ext($record->$val),$img_ext_array) && $val!='name') |
|---|
| 4193 | $output .= '<td class="'.$val.'"><img class="materialboxed" width="65px" src="'.esc_html(strip_tags($record->$val)).'"></td>'; // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage |
|---|
| 4194 | else{ |
|---|
| 4195 | |
|---|
| 4196 | |
|---|
| 4197 | $output .= '<td class="'.$val.'">'.$nf_functions->view_excerpt(esc_html(strip_tags($record->$val)),30).'</td>'; |
|---|
| 4198 | } |
|---|
| 4199 | } |
|---|
| 4200 | else |
|---|
| 4201 | $output .= '<td> </td>'; |
|---|
| 4202 | } |
|---|
| 4203 | } |
|---|
| 4204 | |
|---|
| 4205 | //$theme = wp_get_theme(); |
|---|
| 4206 | ///if($theme->Name=='NEX-Forms Demo' && $record->Id<22) |
|---|
| 4207 | // $output .= '<td class="td_right"></td>'; |
|---|
| 4208 | //else |
|---|
| 4209 | } |
|---|
| 4210 | |
|---|
| 4211 | $show_delete = (isset($_POST['show_delete'])) ? sanitize_text_field($_POST['show_delete']) : $this->show_delete; |
|---|
| 4212 | |
|---|
| 4213 | if($show_delete) |
|---|
| 4214 | $output .= '<td class="td_right col_delete"><a class="delete"><i id="'.$record->Id.'" data-table="'.$table.'" data-placement="bottom" class="delete-record fas fa-trash" data-title="'.__('Delete','nex-forms').'" data-toggle="tooltip_bs2" title="'.__('Delete Record','nex-forms').'"></i></a></td>'; |
|---|
| 4215 | $output .= '</tr>'; |
|---|
| 4216 | } |
|---|
| 4217 | |
|---|
| 4218 | if(!$records) |
|---|
| 4219 | { |
|---|
| 4220 | $output .= '<div class="no_records"><span class="fa fa-ban"></span> <span class="result_text">No results found'.(($search_term) ? ' containing '.$search_term : '').'</span></div>'; |
|---|
| 4221 | |
|---|
| 4222 | } |
|---|
| 4223 | |
|---|
| 4224 | $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : ''; |
|---|
| 4225 | |
|---|
| 4226 | if($do_ajax) |
|---|
| 4227 | { |
|---|
| 4228 | NEXForms_clean_echo($output); |
|---|
| 4229 | wp_die(); |
|---|
| 4230 | } |
|---|
| 4231 | else |
|---|
| 4232 | return $output; |
|---|
| 4233 | |
|---|
| 4234 | |
|---|
| 4235 | } |
|---|
| 4236 | public function get_total_entries($form_Id){ |
|---|
| 4237 | global $wpdb; |
|---|
| 4238 | |
|---|
| 4239 | if(is_array($form_Id)) |
|---|
| 4240 | $set_form_id = $form_Id[0]; |
|---|
| 4241 | $total_entries = $wpdb->get_var('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id='.$set_form_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4242 | return $total_entries; |
|---|
| 4243 | } |
|---|
| 4244 | |
|---|
| 4245 | public function get_total_entries_2($form_Id){ |
|---|
| 4246 | global $wpdb; |
|---|
| 4247 | |
|---|
| 4248 | if(is_array($form_Id)) |
|---|
| 4249 | $set_form_id = $form_Id[0]; |
|---|
| 4250 | $total_entries = $wpdb->get_var('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id='.$set_form_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4251 | return ($total_entries>0) ? '<a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions&folder='.$set_form_id.'"><span class="total_entries_display menu_badge">'.$total_entries.'</span></a>' : '<span class="total_entries_display">'.$total_entries.'</span>'; |
|---|
| 4252 | } |
|---|
| 4253 | |
|---|
| 4254 | |
|---|
| 4255 | public function get_total_entries_3($id){ |
|---|
| 4256 | global $wpdb; |
|---|
| 4257 | |
|---|
| 4258 | if(is_array($id)) |
|---|
| 4259 | $id = $id[0]; |
|---|
| 4260 | $set_count = $wpdb->get_var('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id='.$id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4261 | return ($set_count>0) ? '<a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions&folder='.$id.'" ><span data-title="View Form Entries" title="View Form Entries" data-toggle="tooltip_bs2" data-placement="bottom" class="total_entries_display menu_badge">'.$set_count.'</span></a>' : '<span class="total_entries_display">'.$set_count.'</span>'; |
|---|
| 4262 | } |
|---|
| 4263 | |
|---|
| 4264 | |
|---|
| 4265 | |
|---|
| 4266 | |
|---|
| 4267 | public function duplicate_record($form_Id){ |
|---|
| 4268 | global $wpdb; |
|---|
| 4269 | |
|---|
| 4270 | if(is_array($form_Id)) |
|---|
| 4271 | $set_form_id = $form_Id[0]; |
|---|
| 4272 | |
|---|
| 4273 | return '<a id="'.$set_form_id.'" class="duplicate_record" title="'.__('Duplicate Form','nex-forms').'" ><i class="fa fa-files-o" data-title="'.__('Duplicate Form','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"></i></a>'; |
|---|
| 4274 | } |
|---|
| 4275 | |
|---|
| 4276 | public function link_form_title($form_Id){ |
|---|
| 4277 | global $wpdb; |
|---|
| 4278 | |
|---|
| 4279 | if(is_array($form_Id)) |
|---|
| 4280 | $set_form_id = $form_Id[0]; |
|---|
| 4281 | $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4282 | |
|---|
| 4283 | $title= wp_unslash($title); |
|---|
| 4284 | $title= str_replace('\"','',$title); |
|---|
| 4285 | $title= str_replace('/','',$title); |
|---|
| 4286 | $title = sanitize_text_field( $title ); |
|---|
| 4287 | |
|---|
| 4288 | |
|---|
| 4289 | return '<a href="'.get_admin_url().'admin.php?page=nex-forms-builder&open_form='.$set_form_id.'" class="edit_record" title="'.__('Edit Form','nex-forms').'"><i class="fa fa-edit" data-title="'.__('Edit Form','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"></i></a>'; |
|---|
| 4290 | } |
|---|
| 4291 | |
|---|
| 4292 | public function report_last_update($date_time){ |
|---|
| 4293 | global $wpdb; |
|---|
| 4294 | |
|---|
| 4295 | if(is_array($date_time)) |
|---|
| 4296 | $date_time = $date_time[0]; |
|---|
| 4297 | |
|---|
| 4298 | |
|---|
| 4299 | return $date_time; |
|---|
| 4300 | } |
|---|
| 4301 | public function get_total_report_records($db_table){ |
|---|
| 4302 | global $wpdb; |
|---|
| 4303 | |
|---|
| 4304 | if(is_array($db_table)) |
|---|
| 4305 | $db_table = $db_table[0]; |
|---|
| 4306 | if($wpdb->get_var("show tables like '".$db_table."'") == $db_table) // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4307 | { |
|---|
| 4308 | |
|---|
| 4309 | $total_entries = $wpdb->get_var('SELECT count(*) FROM '.$db_table); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4310 | return '<span class="total_entries_display menu_badge">'.$total_entries.'</span>'; |
|---|
| 4311 | } |
|---|
| 4312 | else |
|---|
| 4313 | { |
|---|
| 4314 | return '<span class="total_entries_display menu_badge">0</span>'; |
|---|
| 4315 | } |
|---|
| 4316 | } |
|---|
| 4317 | public function link_form_title_2($form_Id){ |
|---|
| 4318 | global $wpdb; |
|---|
| 4319 | |
|---|
| 4320 | if(is_array($form_Id)) |
|---|
| 4321 | $set_form_id = $form_Id[0]; |
|---|
| 4322 | $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4323 | |
|---|
| 4324 | $title= wp_unslash($title); |
|---|
| 4325 | $title= str_replace('\"','',$title); |
|---|
| 4326 | $title= str_replace('"','',$title); |
|---|
| 4327 | $title= str_replace("\'",'',$title); |
|---|
| 4328 | $title= str_replace("'",'',$title); |
|---|
| 4329 | $title= str_replace('/','',$title); |
|---|
| 4330 | $title = sanitize_text_field( $title ); |
|---|
| 4331 | |
|---|
| 4332 | return '<a href="'.get_admin_url().'admin.php?page=nex-forms-builder&open_form='.$set_form_id.'" class="form_title" title="Edit - '.$title.'" data-title="'.__('Edit Form','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom">'.$title.'</a>'; |
|---|
| 4333 | } |
|---|
| 4334 | |
|---|
| 4335 | public function link_report_title($report_Id){ |
|---|
| 4336 | global $wpdb; |
|---|
| 4337 | |
|---|
| 4338 | if(is_array($report_Id)) |
|---|
| 4339 | $set_report_id = $report_Id[0]; |
|---|
| 4340 | $title = $wpdb->get_var('SELECT report_title FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id='.$set_report_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4341 | |
|---|
| 4342 | $title= wp_unslash($title); |
|---|
| 4343 | $title= str_replace('\"','',$title); |
|---|
| 4344 | $title= str_replace('"','',$title); |
|---|
| 4345 | $title= str_replace("\'",'',$title); |
|---|
| 4346 | $title= str_replace("'",'',$title); |
|---|
| 4347 | $title= str_replace('/','',$title); |
|---|
| 4348 | $title = sanitize_text_field( $title ); |
|---|
| 4349 | |
|---|
| 4350 | return '<a href="#" class="form_title open_report" id="'.$set_report_id.'" title="Edit - '.$title.'" data-title="'.__('Edit Report','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom">'.$title.'</a>'; |
|---|
| 4351 | } |
|---|
| 4352 | |
|---|
| 4353 | public function link_report_title2($report_Id){ |
|---|
| 4354 | global $wpdb; |
|---|
| 4355 | |
|---|
| 4356 | if(is_array($report_Id)) |
|---|
| 4357 | $set_report_id = $report_Id[0]; |
|---|
| 4358 | $title = $wpdb->get_var('SELECT report_title FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id='.$set_report_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4359 | |
|---|
| 4360 | $title= wp_unslash($title); |
|---|
| 4361 | $title= str_replace('\"','',$title); |
|---|
| 4362 | $title= str_replace('"','',$title); |
|---|
| 4363 | $title= str_replace("\'",'',$title); |
|---|
| 4364 | $title= str_replace("'",'',$title); |
|---|
| 4365 | $title= str_replace('/','',$title); |
|---|
| 4366 | $title = sanitize_text_field( $title ); |
|---|
| 4367 | |
|---|
| 4368 | return '<a href="#" class="form_title open_report" id="'.$set_report_id.'" title="Edit - '.$title.'" data-title="'.__('Edit Report','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"><i class="fa fa-edit"></i></a>'; |
|---|
| 4369 | } |
|---|
| 4370 | |
|---|
| 4371 | public function quick_report_csv($report_Id){ |
|---|
| 4372 | global $wpdb; |
|---|
| 4373 | |
|---|
| 4374 | if(is_array($report_Id)) |
|---|
| 4375 | $set_report_id = $report_Id[0]; |
|---|
| 4376 | |
|---|
| 4377 | |
|---|
| 4378 | $report = $wpdb->get_row('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id='.$set_report_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4379 | |
|---|
| 4380 | if($report->status=='3') |
|---|
| 4381 | { |
|---|
| 4382 | return '<a href="'.admin_url().'admin.php?page=nex-forms-dashboard&export_csv=true&&report_Id='.$set_report_id.'" class="form_title open_report" id="'.$set_report_id.'" title="Edit -" data-title="'.__('Export Report to CSV (Excell)','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"><i class="fa-regular fa-file-excel"></i></a>'; |
|---|
| 4383 | } |
|---|
| 4384 | else |
|---|
| 4385 | { |
|---|
| 4386 | return '<i class="disabled fa-regular fa-file-excel"></i>'; |
|---|
| 4387 | } |
|---|
| 4388 | |
|---|
| 4389 | |
|---|
| 4390 | } |
|---|
| 4391 | |
|---|
| 4392 | public function quick_report_pdf($report_Id){ |
|---|
| 4393 | global $wpdb; |
|---|
| 4394 | |
|---|
| 4395 | if(is_array($report_Id)) |
|---|
| 4396 | $set_report_id = $report_Id[0]; |
|---|
| 4397 | |
|---|
| 4398 | $report = $wpdb->get_row('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id='.$set_report_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4399 | |
|---|
| 4400 | if($report->status=='3') |
|---|
| 4401 | { |
|---|
| 4402 | return '<a href="#" class="quickprint_report_to_pdf" id="'.$set_report_id.'" title="" data-title="'.__('Export Report to PDF','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"><i class="fa-regular fa-file-pdf"></i></a>'; |
|---|
| 4403 | } |
|---|
| 4404 | else |
|---|
| 4405 | { |
|---|
| 4406 | return '<i class="disabled fa-regular fa-file-pdf"></i>'; |
|---|
| 4407 | } |
|---|
| 4408 | |
|---|
| 4409 | } |
|---|
| 4410 | |
|---|
| 4411 | public function link_form_title_3($form_Id){ |
|---|
| 4412 | global $wpdb; |
|---|
| 4413 | |
|---|
| 4414 | if(is_array($form_Id)) |
|---|
| 4415 | $set_form_id = $form_Id[0]; |
|---|
| 4416 | $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4417 | |
|---|
| 4418 | $title= wp_unslash($title); |
|---|
| 4419 | $title= str_replace('\"','',$title); |
|---|
| 4420 | $title= str_replace('"','',$title); |
|---|
| 4421 | $title= str_replace("\'",'',$title); |
|---|
| 4422 | $title= str_replace("'",'',$title); |
|---|
| 4423 | $title= str_replace('/','',$title); |
|---|
| 4424 | $title = sanitize_text_field( $title ); |
|---|
| 4425 | |
|---|
| 4426 | return '<a href="#" id="'.$set_form_id.'" class="form_title get_form_fields" title="'.__('Generate Report','nex-forms').'" data-title="'.__('Generate Report','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom">'.$title.'</a>'; |
|---|
| 4427 | } |
|---|
| 4428 | |
|---|
| 4429 | public function get_form_shortcode($form_Id){ |
|---|
| 4430 | if(is_array($form_Id)) |
|---|
| 4431 | $set_form_id = $form_Id[0]; |
|---|
| 4432 | |
|---|
| 4433 | return '[NEXForms id="'.$set_form_id.'"]'; |
|---|
| 4434 | } |
|---|
| 4435 | |
|---|
| 4436 | |
|---|
| 4437 | public function print_export_form_link($form_Id){ |
|---|
| 4438 | global $wpdb; |
|---|
| 4439 | |
|---|
| 4440 | if(is_array($form_Id)) |
|---|
| 4441 | $set_form_id = $form_Id[0]; |
|---|
| 4442 | $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4443 | |
|---|
| 4444 | $title= wp_unslash($title); |
|---|
| 4445 | $title= str_replace('\"','',$title); |
|---|
| 4446 | $title= str_replace('/','',$title); |
|---|
| 4447 | $title = sanitize_text_field( $title ); |
|---|
| 4448 | |
|---|
| 4449 | return '<a href="'.get_option('siteurl').'/wp-admin/admin.php?page=nex-forms-dashboard&nex_forms_Id='.$set_form_id.'&export_form=true" class="export_form" title="'.__('Export Form','nex-forms').'"><i class="fa fa-cloud-download" data-title="'.__('Export Form','nex-forms').'" data-toggle="tooltip_bs2" data-placement="bottom"></i></a>'; |
|---|
| 4450 | } |
|---|
| 4451 | |
|---|
| 4452 | |
|---|
| 4453 | |
|---|
| 4454 | public function print_form_entry(){ |
|---|
| 4455 | |
|---|
| 4456 | global $wpdb; |
|---|
| 4457 | $output = ''; |
|---|
| 4458 | $output .= '<form id="form_save_form_entry" class="form_save_form_entry" name="save_form_entry" action="'.admin_url('admin-ajax.php').'" method="post" enctype="multipart/form-data">'; |
|---|
| 4459 | $output .= '<div class="dashboard-box form_entry_view">'; |
|---|
| 4460 | |
|---|
| 4461 | //<span class="header_text">'.__('Form Entry Data','nex-forms').'</span> |
|---|
| 4462 | /*$output .= '<div class="dashboard-box-header '.(($this->color_adapt) ? 'aa_bg_main' : '' ).'">'; |
|---|
| 4463 | $output .= '<div class="table_title"><i class="material-icons header-icon">assignment_turned_in</i> </div>'; |
|---|
| 4464 | |
|---|
| 4465 | |
|---|
| 4466 | $output .= '<a class="cancel_save_form_entry save_button btn waves-effect waves-light" style="display:none;"><i class="fa fa-close"></i></a>'; |
|---|
| 4467 | $output .= '<button type="submit" class="save_form_entry save_button btn waves-effect waves-light" style="display:none;">'.__('Save','nex-forms').'</button>'; |
|---|
| 4468 | |
|---|
| 4469 | $output .= '<a class="btn waves-effect waves-light print_to_pdf" disabled="disabled">'.__('PDF','nex-forms').'</a>'; |
|---|
| 4470 | $output .= '<a class="btn waves-effect waves-light print_form_entry" disabled="disabled">'.__('Print','nex-forms').'</a>'; |
|---|
| 4471 | $output .= '<a id="" class="btn waves-effect waves-light edit_form_entry" disabled="disabled">'.__('Edit','nex-forms').'</a>'; |
|---|
| 4472 | $output .= '</div>';*/ |
|---|
| 4473 | $output .= '<div class="dashboard-box-content form_entry_data">'; |
|---|
| 4474 | |
|---|
| 4475 | $output .= '<table class="highlight" id="form_entry_table"></table>';//<thead><tr><th>'.__('Field Name','nex-forms').'</th><th>'.__('Field Value','nex-forms').'</th></tr></thead> |
|---|
| 4476 | |
|---|
| 4477 | $output .= '</div>'; |
|---|
| 4478 | |
|---|
| 4479 | $output .= '</div>'; |
|---|
| 4480 | $output .= '</form>'; |
|---|
| 4481 | |
|---|
| 4482 | $output .= '<div class="form_entry_admin_email_view email_preview" style="display:none;">'; |
|---|
| 4483 | $output .= '<iframe class="admin_email_view" src=""></iframe>'; |
|---|
| 4484 | $output .= '</div>'; |
|---|
| 4485 | |
|---|
| 4486 | $output .= '<div class="form_entry_user_email_view email_preview" style="display:none;">'; |
|---|
| 4487 | $output .= '<iframe class="user_email_view" src=""></iframe>'; |
|---|
| 4488 | $output .= '</div>'; |
|---|
| 4489 | |
|---|
| 4490 | |
|---|
| 4491 | return $output; |
|---|
| 4492 | } |
|---|
| 4493 | |
|---|
| 4494 | public function do_form_entry_save(){ |
|---|
| 4495 | |
|---|
| 4496 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_do_form_entry_save' ) ) { |
|---|
| 4497 | wp_die(); |
|---|
| 4498 | } |
|---|
| 4499 | |
|---|
| 4500 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 4501 | wp_die(); |
|---|
| 4502 | global $wpdb; |
|---|
| 4503 | |
|---|
| 4504 | $edit_id = $wpdb->prepare('%d',esc_sql(sanitize_text_field($_POST['form_entry_id']))); |
|---|
| 4505 | $edit_id = str_replace('\'','',$edit_id); |
|---|
| 4506 | |
|---|
| 4507 | unset($_POST['nex_forms_wpnonce']); |
|---|
| 4508 | unset($_POST['action']); |
|---|
| 4509 | unset($_POST['submit']); |
|---|
| 4510 | unset($_POST['form_entry_id']); |
|---|
| 4511 | |
|---|
| 4512 | foreach($_POST as $key=>$val) |
|---|
| 4513 | { |
|---|
| 4514 | $data_array[] = array('field_name'=>$key,'field_value'=>sanitize_text_field($val)); |
|---|
| 4515 | } |
|---|
| 4516 | //print_r($data_array); |
|---|
| 4517 | $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries',array( // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4518 | 'form_data'=>json_encode($data_array) // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4519 | ), array( 'Id' => sanitize_title($edit_id)) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4520 | |
|---|
| 4521 | NEXForms_clean_echo( $edit_id); |
|---|
| 4522 | |
|---|
| 4523 | die(); |
|---|
| 4524 | } |
|---|
| 4525 | |
|---|
| 4526 | |
|---|
| 4527 | |
|---|
| 4528 | public function submission_report(){ |
|---|
| 4529 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 4530 | wp_die(); |
|---|
| 4531 | global $wpdb; |
|---|
| 4532 | |
|---|
| 4533 | $set_additional_params = array(); |
|---|
| 4534 | $nf_functions = new NEXForms_Functions(); |
|---|
| 4535 | |
|---|
| 4536 | if($_POST['field_selection']) |
|---|
| 4537 | { |
|---|
| 4538 | $field_selection = isset($_POST['field_selection']) ? $_POST['field_selection'] : ''; |
|---|
| 4539 | } |
|---|
| 4540 | |
|---|
| 4541 | //echo '<pre>test 1'; |
|---|
| 4542 | //print_r($field_selection); |
|---|
| 4543 | //echo '</pre>'; |
|---|
| 4544 | $records = $wpdb->get_results($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id=%d', sanitize_text_field($_POST['form_Id']))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4545 | |
|---|
| 4546 | |
|---|
| 4547 | $get_temp_table_details = get_option('tmp_csv_export'); |
|---|
| 4548 | update_option('tmp_csv_export',array('query'=>$get_temp_table_details['query'],'cols'=>$get_temp_table_details['cols'],'form_Id'=>sanitize_text_field($_POST['form_Id']))); |
|---|
| 4549 | |
|---|
| 4550 | |
|---|
| 4551 | |
|---|
| 4552 | |
|---|
| 4553 | foreach($records as $data) |
|---|
| 4554 | { |
|---|
| 4555 | $form_values = json_decode($data->form_data); |
|---|
| 4556 | |
|---|
| 4557 | $header_array['entry_Id'] = $data->Id; |
|---|
| 4558 | |
|---|
| 4559 | $header_array['date_time'] = $data->date_time; |
|---|
| 4560 | |
|---|
| 4561 | foreach($form_values as $field) |
|---|
| 4562 | { |
|---|
| 4563 | if(is_array($field_selection)) |
|---|
| 4564 | { |
|---|
| 4565 | if(in_array($field->field_name,$field_selection)) |
|---|
| 4566 | { |
|---|
| 4567 | $header_array_filters[$field->field_name] = $nf_functions->unformat_records_name($field->field_name); |
|---|
| 4568 | } |
|---|
| 4569 | } |
|---|
| 4570 | else |
|---|
| 4571 | { |
|---|
| 4572 | $header_array_filters[$field->field_name] = $nf_functions->unformat_records_name($field->field_name); |
|---|
| 4573 | } |
|---|
| 4574 | $header_array[$field->field_name] = $nf_functions->unformat_records_name($field->field_name); |
|---|
| 4575 | } |
|---|
| 4576 | }; |
|---|
| 4577 | |
|---|
| 4578 | |
|---|
| 4579 | |
|---|
| 4580 | |
|---|
| 4581 | if($wpdb->get_var("show tables like '".$wpdb->prefix."wap_nex_forms_temp_report'") == $wpdb->prefix.'wap_nex_forms_temp_report') // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4582 | { |
|---|
| 4583 | $drop_table = 'DROP TABLE '.$wpdb->prefix.'wap_nex_forms_temp_report'; // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4584 | $wpdb->query($drop_table); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4585 | } |
|---|
| 4586 | $nf_functions = new NEXForms_Functions(); |
|---|
| 4587 | |
|---|
| 4588 | $header_array2 = array_unique($header_array); |
|---|
| 4589 | $col_array_unique = array(); |
|---|
| 4590 | foreach($header_array2 as $key => $val){ |
|---|
| 4591 | if($key) |
|---|
| 4592 | $col_array_unique[$nf_functions->format_column_name($key)] = $nf_functions->format_column_name($key); |
|---|
| 4593 | } |
|---|
| 4594 | |
|---|
| 4595 | |
|---|
| 4596 | $sql .= 'CREATE TABLE `'.$wpdb->prefix.'wap_nex_forms_temp_report` ('; |
|---|
| 4597 | |
|---|
| 4598 | $sql .= '`Id` BIGINT(255) unsigned NOT NULL AUTO_INCREMENT,'; |
|---|
| 4599 | |
|---|
| 4600 | foreach($col_array_unique as $key => $val){ |
|---|
| 4601 | |
|---|
| 4602 | $col_name = $nf_functions->format_column_name($key); |
|---|
| 4603 | |
|---|
| 4604 | if($col_name!='') |
|---|
| 4605 | { |
|---|
| 4606 | if($col_name=='entry_id') |
|---|
| 4607 | $sql .= '`'.$col_name.'` BIGINT(255),'; |
|---|
| 4608 | else |
|---|
| 4609 | $sql .= '`'.$col_name.'` longtext,'; |
|---|
| 4610 | } |
|---|
| 4611 | } |
|---|
| 4612 | $sql .= 'PRIMARY KEY (`Id`) |
|---|
| 4613 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4'; |
|---|
| 4614 | |
|---|
| 4615 | $wpdb->query($sql); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4616 | |
|---|
| 4617 | |
|---|
| 4618 | |
|---|
| 4619 | $table_fields = $wpdb->get_results('SHOW FIELDS FROM '.$wpdb->prefix.'wap_nex_forms_temp_report'); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4620 | |
|---|
| 4621 | foreach($records as $data) |
|---|
| 4622 | { |
|---|
| 4623 | $form_fields = json_decode($data->form_data); |
|---|
| 4624 | |
|---|
| 4625 | $column_array = array(); |
|---|
| 4626 | |
|---|
| 4627 | $column_array['entry_Id'] = $data->Id; |
|---|
| 4628 | |
|---|
| 4629 | $column_array['date_time'] = $data->date_time; |
|---|
| 4630 | |
|---|
| 4631 | foreach($table_fields as $table_field) |
|---|
| 4632 | { |
|---|
| 4633 | foreach($form_fields as $form_field) |
|---|
| 4634 | { |
|---|
| 4635 | $form_field_name = $nf_functions->format_column_name($form_field->field_name); |
|---|
| 4636 | $table_field_col = $nf_functions->format_column_name($table_field->Field); |
|---|
| 4637 | |
|---|
| 4638 | if(is_array($form_field->field_value) || is_object($form_field->field_value)) |
|---|
| 4639 | $form_field->field_value = json_encode($form_field->field_value); |
|---|
| 4640 | |
|---|
| 4641 | if($form_field_name==$table_field_col) |
|---|
| 4642 | { |
|---|
| 4643 | $column_array[$table_field_col] = $form_field->field_value; |
|---|
| 4644 | } |
|---|
| 4645 | } |
|---|
| 4646 | } |
|---|
| 4647 | $insert = $wpdb->insert ( $wpdb->prefix . 'wap_nex_forms_temp_report' , $column_array ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4648 | $insert_id = $wpdb->insert_id; |
|---|
| 4649 | } |
|---|
| 4650 | foreach($col_array_unique as $key=>$val) |
|---|
| 4651 | { |
|---|
| 4652 | if(is_array($field_selection)) |
|---|
| 4653 | { |
|---|
| 4654 | if(in_array($key,$field_selection)) |
|---|
| 4655 | { |
|---|
| 4656 | $set_headers[$key] = $key; |
|---|
| 4657 | $set_search[$key] = $key; |
|---|
| 4658 | } |
|---|
| 4659 | } |
|---|
| 4660 | else |
|---|
| 4661 | { |
|---|
| 4662 | $set_headers[$key] = $key; |
|---|
| 4663 | $set_search[$key] = $key; |
|---|
| 4664 | } |
|---|
| 4665 | } |
|---|
| 4666 | |
|---|
| 4667 | $database = new NEXForms_Database_Actions(); |
|---|
| 4668 | |
|---|
| 4669 | $report = new NEXForms_dashboard(); |
|---|
| 4670 | $report->table = 'wap_nex_forms_temp_report'; |
|---|
| 4671 | $report->extra_classes = 'wap_nex_forms_entries'; |
|---|
| 4672 | $report->table_header = 'Report'; |
|---|
| 4673 | $report->table_resize = true; |
|---|
| 4674 | $report->table_header_icon = 'view_list'; |
|---|
| 4675 | $report->action_button = 'add'; |
|---|
| 4676 | $report->table_headings = $set_headers; |
|---|
| 4677 | $report->show_headings=true; |
|---|
| 4678 | $report->search_params = $set_search; |
|---|
| 4679 | //$report->extra_buttons = array( 'Excel'=>array('class'=>'export-csv', 'type'=>'link','link'=>admin_url().'admin.php?page=nex-forms-dashboard&export_excel=true', 'icon'=>'<span class="fa fa-file-excel"></span> '.__('Export to Excel','nex-forms').''), 'Export'=>array('class'=>'export-csv', 'type'=>'link','link'=>admin_url().'admin.php?page=nex-forms-dashboard&export_csv=true', 'icon'=>'<span class="fa fa-file-excel"></span> '.__('Export to Excel(CSV)','nex-forms').''), 'PDF'=>array('class'=>'print_report_to_pdf', 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'')); //'Report'=>array('class'=>'run_query', 'id'=>$_POST['form_Id'], 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-filter"></span> '.__('Build Report','nex-forms').''), |
|---|
| 4680 | $report->extra_buttons = array( 'Export'=>array('class'=>'export-csv', 'type'=>'link','link'=>admin_url().'admin.php?page=nex-forms-dashboard&export_csv=true', 'icon'=>'<span class="fa fa-file-excel"></span> '.__('Export to Excel(CSV)','nex-forms').''), 'PDF'=>array('class'=>'print_report_to_pdf', 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'')); //'Report'=>array('class'=>'run_query', 'id'=>$_POST['form_Id'], 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-filter"></span> '.__('Build Report','nex-forms').''), |
|---|
| 4681 | $report->checkout = $database->checkout(); |
|---|
| 4682 | $report->is_report = true; |
|---|
| 4683 | $report->show_delete = false; |
|---|
| 4684 | $report->color_adapt = true; |
|---|
| 4685 | $report->record_limit = 100; |
|---|
| 4686 | |
|---|
| 4687 | if($_POST['field_selection']) |
|---|
| 4688 | $report->field_selection = $_POST['field_selection']; |
|---|
| 4689 | $report->additional_params = $_POST['additional_params']; |
|---|
| 4690 | $output .= '<div class="right-col-top">'; |
|---|
| 4691 | |
|---|
| 4692 | $output .= '<div class="right-col-inner aa_bg_tri">'; |
|---|
| 4693 | |
|---|
| 4694 | |
|---|
| 4695 | //$output .= $report->print_form_entry(); |
|---|
| 4696 | |
|---|
| 4697 | |
|---|
| 4698 | |
|---|
| 4699 | $output .= '<div class="reporting_controls">'; |
|---|
| 4700 | |
|---|
| 4701 | $show_cols = $_POST['showhide_fields']; |
|---|
| 4702 | |
|---|
| 4703 | $output .= '<div class="col-sm-3 field_selection_col ">'; |
|---|
| 4704 | $output .= '<select name="showhide_fields[]" multiple="multiple" class="aa_multi_select field_selection_multi_select"> |
|---|
| 4705 | <option disabled="disabled">'.__('Show Fields','nex-forms').'</option> |
|---|
| 4706 | '; |
|---|
| 4707 | $show_cols = explode(',',$show_cols); |
|---|
| 4708 | $i = 0; |
|---|
| 4709 | |
|---|
| 4710 | if($_POST['field_selection']) |
|---|
| 4711 | { |
|---|
| 4712 | $field_selection = isset($_POST['field_selection']) ? $_POST['field_selection'] : ''; |
|---|
| 4713 | } |
|---|
| 4714 | //else |
|---|
| 4715 | //$field_selection = $this->field_selection; |
|---|
| 4716 | |
|---|
| 4717 | foreach($col_array_unique as $key=>$val) |
|---|
| 4718 | { |
|---|
| 4719 | if(is_array($field_selection)) |
|---|
| 4720 | { |
|---|
| 4721 | $output .= '<option value="'.$key.'" '.((in_array($key,$field_selection)) ? 'selected="selected"' : '').'> |
|---|
| 4722 | '. $nf_functions->unformat_records_name($val,30).'</option>'; |
|---|
| 4723 | } |
|---|
| 4724 | else |
|---|
| 4725 | { |
|---|
| 4726 | $output .= '<option value="'.$key.'" selected="selected"> |
|---|
| 4727 | '.$nf_functions->unformat_records_name($val,30).'</option>'; |
|---|
| 4728 | } |
|---|
| 4729 | $i++; |
|---|
| 4730 | } |
|---|
| 4731 | $output .= '</select></div>'; |
|---|
| 4732 | $output .= '<div class="col-sm-1 add_clause">'; |
|---|
| 4733 | $output .= '<a class="nf_button aa_bg_main_btn add_new_where_clause2"><i class="fa fa-filter"></i> Add filter </a>'; |
|---|
| 4734 | |
|---|
| 4735 | |
|---|
| 4736 | $output .= '<a class="nf_button aa_bg_main_btn run_query_2 run_query" id="'.sanitize_text_field($_POST['form_Id']).'"><i class="fa fa-file-import"></i> Run Query </a>'; |
|---|
| 4737 | |
|---|
| 4738 | $output .= '</div>'; |
|---|
| 4739 | |
|---|
| 4740 | $output .= '<div class="clause_container zero_padding">'; |
|---|
| 4741 | |
|---|
| 4742 | foreach($_POST['additional_params'] as $key=>$val) |
|---|
| 4743 | { |
|---|
| 4744 | |
|---|
| 4745 | $output .= '<div class="new_clause">'; |
|---|
| 4746 | $output .= '<div class="col-xs-4 zero_padding">'; |
|---|
| 4747 | $output .= '<select class="post_ajax_select aa_bg_main_input form_control" name="column"> |
|---|
| 4748 | <option value="">'.__('--- Select field ---','nex-forms').'</option>'; |
|---|
| 4749 | foreach($header_array_filters as $key2=>$val2) |
|---|
| 4750 | $output .= ' <option value="'.$key2.'" '.(($val['column']==$key2) ? 'selected="selected"' : '').'>'.$val2.'</option>'; |
|---|
| 4751 | $output .= '</select>'; |
|---|
| 4752 | $output .= '</div>'; |
|---|
| 4753 | |
|---|
| 4754 | $output .= '<div class="col-xs-3">'; |
|---|
| 4755 | $output .= ' |
|---|
| 4756 | <select class="post_ajax_select aa_bg_main_input form_control" name="operator"> |
|---|
| 4757 | <option value="=" '.(($val['operator']=='=') ? 'selected="selected"' : '').'>'.__('Equal to','nex-forms').'</option> |
|---|
| 4758 | <option value="<>" '.(($val['operator']=='<>') ? 'selected="selected"' : '').'>'.__('Not equal','nex-forms').'</option> |
|---|
| 4759 | <option value=">" '.(($val['operator']=='>') ? 'selected="selected"' : '').'>'.__('Greater than','nex-forms').'</option> |
|---|
| 4760 | <option value="<" '.(($val['operator']=='<') ? 'selected="selected"' : '').'>'.__('Less than','nex-forms').'</option> |
|---|
| 4761 | <option value="LIKE" '.(($val['operator']=='LIKE') ? 'selected="selected"' : '').'>'.__('Contains','nex-forms').'</option> |
|---|
| 4762 | <option value="NOT LIKE" '.(($val['operator']=='NOT LIKE') ? 'selected="selected"' : '').'>'.__('Does not contain','nex-forms').'</option> |
|---|
| 4763 | '; |
|---|
| 4764 | $output .= '</select>'; |
|---|
| 4765 | $output .= '</div>'; |
|---|
| 4766 | |
|---|
| 4767 | $output .= '<div class="col-xs-4 zero_padding">'; |
|---|
| 4768 | $output .= '<input name="column_value" class="form-control aa_bg_main_input" placeholder="'.__('Value','nex-forms').'" value="'.$val['value'].'">'; |
|---|
| 4769 | $output .= '</div>'; |
|---|
| 4770 | |
|---|
| 4771 | $output .= '<div class="col-xs-1 zero_padding">'; |
|---|
| 4772 | $output .= '<a class="btn remove_where_clause">X</a>'; |
|---|
| 4773 | $output .= '</div>'; |
|---|
| 4774 | $output .= '</div>'; |
|---|
| 4775 | |
|---|
| 4776 | $set_additional_params[$val['column']] = $val['value']; |
|---|
| 4777 | } |
|---|
| 4778 | |
|---|
| 4779 | $output .= '</div>'; |
|---|
| 4780 | |
|---|
| 4781 | $output .= '<div class="clause_replicator hidden">'; |
|---|
| 4782 | $output .= '<div class="col col-xs-4 zero_padding">'; |
|---|
| 4783 | $output .= ' |
|---|
| 4784 | <select class="post_ajax_select form_control aa_bg_main_input" name="column"> |
|---|
| 4785 | <option value="" selected="selected">'.__('--- Select field ---','nex-forms').'</option>'; |
|---|
| 4786 | foreach($header_array_filters as $key=>$val) |
|---|
| 4787 | $output .= ' <option value="'.$key.'">'.$val.'</option>'; |
|---|
| 4788 | $output .= '</select>'; |
|---|
| 4789 | $output .= '</div>'; |
|---|
| 4790 | |
|---|
| 4791 | $output .= '<div class="col col-xs-3">'; |
|---|
| 4792 | $output .= ' |
|---|
| 4793 | <select class="post_ajax_select form_control aa_bg_main_input" name="operator"> |
|---|
| 4794 | <option value="=">'.__('Equal to','nex-forms').'</option> |
|---|
| 4795 | <option value="<>">'.__('Not equal','nex-forms').'</option> |
|---|
| 4796 | <option value=">">'.__('Greater than','nex-forms').'</option> |
|---|
| 4797 | <option value="<">'.__('Less than','nex-forms').'</option> |
|---|
| 4798 | <option value="LIKE">'.__('Contains','nex-forms').'</option> |
|---|
| 4799 | <option value="NOT LIKE">'.__('Does not contain','nex-forms').'</option> |
|---|
| 4800 | '; |
|---|
| 4801 | $output .= '</select>'; |
|---|
| 4802 | $output .= '</div>'; |
|---|
| 4803 | |
|---|
| 4804 | $output .= '<div class="col col-xs-4 zero_padding">'; |
|---|
| 4805 | $output .= '<input name="column_value" class="form-control aa_bg_main_input" placeholder="'.__('Value','nex-forms').'">'; |
|---|
| 4806 | $output .= '</div>'; |
|---|
| 4807 | |
|---|
| 4808 | $output .= '<div class="col col-xs-1 zero_padding">'; |
|---|
| 4809 | $output .= '<a class="btn remove_where_clause">X</a>'; |
|---|
| 4810 | $output .= '</div>'; |
|---|
| 4811 | $output .= '</div>'; |
|---|
| 4812 | |
|---|
| 4813 | $output .= '</div>'; |
|---|
| 4814 | //$output .= '<a class="btn run_query hidden" id="'.$_POST['form_Id'].'"><span class="fa fa-filter"></span> '.__('Run Report','nex-forms').'</a>'; |
|---|
| 4815 | |
|---|
| 4816 | |
|---|
| 4817 | $output .= '</div>'; |
|---|
| 4818 | |
|---|
| 4819 | $output .= '</div>'; |
|---|
| 4820 | $output .= '</div>'; |
|---|
| 4821 | /*$output .= '<div class="right-mid">'; |
|---|
| 4822 | |
|---|
| 4823 | |
|---|
| 4824 | |
|---|
| 4825 | $output .= '<div class="entry_tools aa_bg_main">'; |
|---|
| 4826 | |
|---|
| 4827 | $output .= '<button type="submit" class="save_form_entry save_button button button-primary" style="display:none;">'.__('Save','nex-forms').'</button>'; |
|---|
| 4828 | $output .= '<button class="cancel_save_form_entry save_button button button-primary" style="display:none;"><i class="fa fa-close"></i></button>'; |
|---|
| 4829 | |
|---|
| 4830 | |
|---|
| 4831 | $output .= '<div class="entry_views">'; |
|---|
| 4832 | |
|---|
| 4833 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch view_form_data active" data-action="view-data" disabled="disabled"><span class="fas fa-database"></span> '.__('Entry Data','nex-forms').'</button>'; |
|---|
| 4834 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-admin-email" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>'; |
|---|
| 4835 | $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-user-email" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>'; |
|---|
| 4836 | $output .= '</div>'; |
|---|
| 4837 | |
|---|
| 4838 | $output .= '<div class="entry_actions">'; |
|---|
| 4839 | $output .= '<button class="print_to_pdf aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'</button>'; |
|---|
| 4840 | //$output .= '<button class="button no_batch do_action" data-action="print-form-entry" disabled="disabled"><span class="fas fa-print"></span> '.__('Print','nex-forms').'</button>'; |
|---|
| 4841 | $output .= '<button id="" class="edit_form_entry aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-pen-square"></span> '.__('Edit','nex-forms').'</button>'; |
|---|
| 4842 | $output .= '<button class="nf_button aa_bg_main_btn do_action" data-action="delete" disabled="disabled"><span class="fas fa-trash"></span> '.__('Delete','nex-forms').'</button>'; |
|---|
| 4843 | $output .= '</div>'; |
|---|
| 4844 | |
|---|
| 4845 | $output .= '</div>'; |
|---|
| 4846 | |
|---|
| 4847 | $output .= '</div>';*/ |
|---|
| 4848 | |
|---|
| 4849 | $output .= '<div class="right-bottom">'; |
|---|
| 4850 | $output .= $report->print_record_table(); |
|---|
| 4851 | |
|---|
| 4852 | $output .= '</div>'; |
|---|
| 4853 | NEXForms_clean_echo( $output); |
|---|
| 4854 | die(); |
|---|
| 4855 | } |
|---|
| 4856 | |
|---|
| 4857 | |
|---|
| 4858 | public function submission_report2(){ |
|---|
| 4859 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 4860 | wp_die(); |
|---|
| 4861 | global $wpdb; |
|---|
| 4862 | |
|---|
| 4863 | $set_additional_params = array(); |
|---|
| 4864 | $nf_functions = new NEXForms_Functions(); |
|---|
| 4865 | |
|---|
| 4866 | if($_POST['field_selection']) |
|---|
| 4867 | { |
|---|
| 4868 | $field_selection = isset($_POST['field_selection']) ? $_POST['field_selection'] : ''; |
|---|
| 4869 | } |
|---|
| 4870 | |
|---|
| 4871 | $refresh = isset($_POST['refresh_data']) ? true : false; |
|---|
| 4872 | |
|---|
| 4873 | $db_table = $wpdb->get_var($wpdb->prepare('SELECT db_table FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id=%d', sanitize_title($_POST['report_update_id']))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4874 | |
|---|
| 4875 | |
|---|
| 4876 | |
|---|
| 4877 | $db_table = str_replace($wpdb->prefix,'',$db_table); |
|---|
| 4878 | |
|---|
| 4879 | /*echo '<pre>'; |
|---|
| 4880 | print_r($field_selection); |
|---|
| 4881 | echo '</pre>'; */ |
|---|
| 4882 | |
|---|
| 4883 | $set_report_id = (isset($_POST['report_update_id'])) ? $wpdb->prepare('%d',esc_sql(sanitize_title($_POST['report_update_id']))) : false; |
|---|
| 4884 | |
|---|
| 4885 | $tz = wp_timezone(); |
|---|
| 4886 | $set_date = new DateTime("now", $tz); |
|---|
| 4887 | |
|---|
| 4888 | if($set_report_id) |
|---|
| 4889 | { |
|---|
| 4890 | $update = $wpdb->update ( $wpdb->prefix.'wap_nex_forms_reports', array // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4891 | ( |
|---|
| 4892 | 'report_fields'=>json_encode($field_selection), |
|---|
| 4893 | 'status'=>'3', |
|---|
| 4894 | 'date_time' => $set_date->format('Y-m-d H:i:s'), |
|---|
| 4895 | ), array( 'Id' => $set_report_id) ); |
|---|
| 4896 | |
|---|
| 4897 | } |
|---|
| 4898 | $records = $wpdb->get_results($wpdb->prepare('SELECT * FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE `nex_forms_Id`=%d ORDER BY `last_update` DESC LIMIT 500 OFFSET 0', sanitize_text_field($_POST['form_Id']))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4899 | |
|---|
| 4900 | |
|---|
| 4901 | $count_records = $wpdb->get_var($wpdb->prepare('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id=%d', sanitize_text_field($_POST['form_Id']))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4902 | |
|---|
| 4903 | |
|---|
| 4904 | $get_temp_table_details = get_option('tmp_csv_export'); |
|---|
| 4905 | update_option('tmp_csv_export',array('query'=>$get_temp_table_details['query'],'cols'=>$get_temp_table_details['cols'],'form_Id'=>sanitize_text_field($_POST['form_Id']))); |
|---|
| 4906 | |
|---|
| 4907 | |
|---|
| 4908 | |
|---|
| 4909 | |
|---|
| 4910 | foreach($records as $data) |
|---|
| 4911 | { |
|---|
| 4912 | $form_values = json_decode($data->form_data); |
|---|
| 4913 | |
|---|
| 4914 | $header_array['entry_Id'] = $data->Id; |
|---|
| 4915 | |
|---|
| 4916 | $header_array['date_time'] = $data->date_time; |
|---|
| 4917 | |
|---|
| 4918 | $header_array_filters['entry_Id'] = $data->Id; |
|---|
| 4919 | |
|---|
| 4920 | $header_array_filters['date_time'] = $data->date_time; |
|---|
| 4921 | |
|---|
| 4922 | foreach($form_values as $field) |
|---|
| 4923 | { |
|---|
| 4924 | if(is_array($field_selection)) |
|---|
| 4925 | { |
|---|
| 4926 | //echo $nf_functions->format_name($field->field_name).'<br />'; |
|---|
| 4927 | if(in_array($nf_functions->format_column_name($field->field_name),$field_selection)) |
|---|
| 4928 | { |
|---|
| 4929 | $header_array_filters[$field->field_name] = $nf_functions->format_column_name($field->field_name); |
|---|
| 4930 | } |
|---|
| 4931 | } |
|---|
| 4932 | else |
|---|
| 4933 | { |
|---|
| 4934 | $header_array_filters[$field->field_name] = $nf_functions->format_column_name($field->field_name); |
|---|
| 4935 | } |
|---|
| 4936 | $header_array[$field->field_name] = $nf_functions->format_column_name($field->field_name); |
|---|
| 4937 | } |
|---|
| 4938 | }; |
|---|
| 4939 | |
|---|
| 4940 | |
|---|
| 4941 | |
|---|
| 4942 | |
|---|
| 4943 | |
|---|
| 4944 | $nf_functions = new NEXForms_Functions(); |
|---|
| 4945 | |
|---|
| 4946 | $header_array2 = array_unique($header_array_filters); |
|---|
| 4947 | $col_array_unique = array(); |
|---|
| 4948 | foreach($header_array2 as $key => $val){ |
|---|
| 4949 | if($key) |
|---|
| 4950 | { |
|---|
| 4951 | $col_array_unique[$nf_functions->format_column_name($key)] = $nf_functions->format_column_name($key); |
|---|
| 4952 | |
|---|
| 4953 | } |
|---|
| 4954 | } |
|---|
| 4955 | |
|---|
| 4956 | |
|---|
| 4957 | /*echo '<pre>'; |
|---|
| 4958 | print_r($header_array_filters); |
|---|
| 4959 | echo '</pre>';*/ |
|---|
| 4960 | $sql = ''; |
|---|
| 4961 | if(!$refresh) |
|---|
| 4962 | { |
|---|
| 4963 | if($wpdb->get_var("show tables like '".$wpdb->prefix.$db_table."'") == $wpdb->prefix.$db_table) // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4964 | { |
|---|
| 4965 | $drop_table = 'DROP TABLE '.$wpdb->prefix.$db_table; // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4966 | $wpdb->query($drop_table); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4967 | } |
|---|
| 4968 | $charset_collate = $wpdb->get_charset_collate(); |
|---|
| 4969 | |
|---|
| 4970 | $sql .= 'CREATE TABLE `'.$wpdb->prefix.$db_table.'` ('; |
|---|
| 4971 | |
|---|
| 4972 | $sql .= '`Id` BIGINT(255) unsigned NOT NULL AUTO_INCREMENT,'; |
|---|
| 4973 | |
|---|
| 4974 | foreach($col_array_unique as $key => $val){ |
|---|
| 4975 | |
|---|
| 4976 | $col_name = $nf_functions->format_column_name($key); |
|---|
| 4977 | |
|---|
| 4978 | if($col_name!='') |
|---|
| 4979 | { |
|---|
| 4980 | if($col_name=='entry_id') |
|---|
| 4981 | $sql .= '`'.$col_name.'` BIGINT(255),'; |
|---|
| 4982 | else |
|---|
| 4983 | $sql .= '`'.$col_name.'` longtext,'; |
|---|
| 4984 | } |
|---|
| 4985 | } |
|---|
| 4986 | $sql .= 'PRIMARY KEY (`Id`) |
|---|
| 4987 | ) '.$charset_collate.';'; |
|---|
| 4988 | |
|---|
| 4989 | $wpdb->query($sql); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4990 | |
|---|
| 4991 | // echo '##########'.$sql; |
|---|
| 4992 | |
|---|
| 4993 | $table_fields = $wpdb->get_results('SHOW FIELDS FROM '.$wpdb->prefix.$db_table); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 4994 | |
|---|
| 4995 | $itteration = round(($count_records/100)+1); |
|---|
| 4996 | |
|---|
| 4997 | for($i=0;$i<=$itteration;$i++) |
|---|
| 4998 | { |
|---|
| 4999 | $records = $wpdb->get_results($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id=%d LIMIT 100 OFFSET '.($i*100).'', sanitize_text_field($_POST['form_Id']))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 5000 | |
|---|
| 5001 | foreach($records as $data) |
|---|
| 5002 | { |
|---|
| 5003 | $form_fields = json_decode($data->form_data); |
|---|
| 5004 | |
|---|
| 5005 | $column_array = array(); |
|---|
| 5006 | |
|---|
| 5007 | $column_array['entry_Id'] = $data->Id; |
|---|
| 5008 | |
|---|
| 5009 | $column_array['date_time'] = $data->date_time; |
|---|
| 5010 | |
|---|
| 5011 | foreach($table_fields as $table_field) |
|---|
| 5012 | { |
|---|
| 5013 | foreach($form_fields as $form_field) |
|---|
| 5014 | { |
|---|
| 5015 | $form_field_name = $nf_functions->format_column_name($form_field->field_name); |
|---|
| 5016 | $table_field_col = $nf_functions->format_column_name($table_field->Field); |
|---|
| 5017 | $array_field_val = ''; |
|---|
| 5018 | if(is_array($form_field->field_value) || is_object($form_field->field_value)) |
|---|
| 5019 | { |
|---|
| 5020 | foreach($form_field->field_value as $field => $val) |
|---|
| 5021 | { |
|---|
| 5022 | if (is_object($val) || is_array($val)) { |
|---|
| 5023 | $val = json_encode($val); // Convert object/array to a JSON string |
|---|
| 5024 | } |
|---|
| 5025 | $array_field_val .= $val.' - '; |
|---|
| 5026 | } |
|---|
| 5027 | $form_field->field_value = rtrim($array_field_val,' - '); |
|---|
| 5028 | } |
|---|
| 5029 | if($form_field_name==$table_field_col) |
|---|
| 5030 | { |
|---|
| 5031 | $column_array[$table_field_col] = $form_field->field_value; |
|---|
| 5032 | } |
|---|
| 5033 | } |
|---|
| 5034 | } |
|---|
| 5035 | |
|---|
| 5036 | $insert = $wpdb->insert ( $wpdb->prefix . $db_table , $column_array ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 5037 | //$insert_id = $wpdb->insert_id; |
|---|
| 5038 | } |
|---|
| 5039 | } |
|---|
| 5040 | } |
|---|
| 5041 | else |
|---|
| 5042 | { |
|---|
| 5043 | if($set_report_id) |
|---|
| 5044 | { |
|---|
| 5045 | $update = $wpdb->update ( $wpdb->prefix.'wap_nex_forms_reports', array // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 5046 | ( |
|---|
| 5047 | 'report_params'=>json_encode($_POST['additional_params']), |
|---|
| 5048 | |
|---|
| 5049 | ), array( 'Id' => $set_report_id) ); |
|---|
| 5050 | |
|---|
| 5051 | } |
|---|
| 5052 | } |
|---|
| 5053 | |
|---|
| 5054 | |
|---|
| 5055 | foreach($col_array_unique as $key=>$val) |
|---|
| 5056 | { |
|---|
| 5057 | if(is_array($field_selection)) |
|---|
| 5058 | { |
|---|
| 5059 | if(in_array($key,$field_selection)) |
|---|
| 5060 | { |
|---|
| 5061 | $set_headers[$key] = $key; |
|---|
| 5062 | $set_search[$key] = $key; |
|---|
| 5063 | } |
|---|
| 5064 | } |
|---|
| 5065 | else |
|---|
| 5066 | { |
|---|
| 5067 | $set_headers[$key] = $key; |
|---|
| 5068 | $set_search[$key] = $key; |
|---|
| 5069 | } |
|---|
| 5070 | } |
|---|
| 5071 | |
|---|
| 5072 | $database = new NEXForms_Database_Actions(); |
|---|
| 5073 | |
|---|
| 5074 | $report = new NEXForms_dashboard(); |
|---|
| 5075 | $report->table = $db_table; |
|---|
| 5076 | $report->extra_classes = 'wap_nex_forms_entries'; |
|---|
| 5077 | $report->table_header = ''; |
|---|
| 5078 | $report->table_resize = true; |
|---|
| 5079 | $report->table_header_icon = 'view_list'; |
|---|
| 5080 | $report->action_button = 'add'; |
|---|
| 5081 | $report->table_headings = $set_headers; |
|---|
| 5082 | $report->show_headings=true; |
|---|
| 5083 | $report->search_params = $set_search; |
|---|
| 5084 | $report->extra_buttons = array( 'Filters'=>array('class'=>'open_reporting_filters', 'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-filter"></span> '.__('Filters','nex-forms').' <span class="total_filters"></span>'), 'Export'=>array('class'=>'export-csv', 'type'=>'link','link'=>admin_url().'admin.php?page=nex-forms-dashboard&export_csv=true&report_Id='.$set_report_id, 'icon'=>'<span class="fa fa-file-excel"></span> '.__('Export to Excel(CSV)','nex-forms').''), 'PDF'=>array('class'=>'print_report_to_pdf', 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'')); //'Report'=>array('class'=>'run_query', 'id'=>$_POST['form_Id'], 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-filter"></span> '.__('Build Report','nex-forms').''), |
|---|
| 5085 | $report->checkout = $database->checkout(); |
|---|
| 5086 | $report->is_report = true; |
|---|
| 5087 | $report->show_delete = false; |
|---|
| 5088 | $report->color_adapt = true; |
|---|
| 5089 | $report->record_limit = 100; |
|---|
| 5090 | |
|---|
| 5091 | |
|---|
| 5092 | $set_field_selection = array(); |
|---|
| 5093 | |
|---|
| 5094 | $db_cols = array(); |
|---|
| 5095 | foreach($table_fields as $col) |
|---|
| 5096 | { |
|---|
| 5097 | if($col->Field!='Id') |
|---|
| 5098 | { |
|---|
| 5099 | if(in_array($col->Field,$field_selection)) |
|---|
| 5100 | $set_field_selection[] = $col->Field; |
|---|
| 5101 | } |
|---|
| 5102 | } |
|---|
| 5103 | $field_selection = $set_field_selection; |
|---|
| 5104 | if(!empty($diff)) |
|---|
| 5105 | { |
|---|
| 5106 | foreach($diff as $no) |
|---|
| 5107 | { |
|---|
| 5108 | $unconverted_fields .= ' '.$no.','; |
|---|
| 5109 | } |
|---|
| 5110 | NEXForms_clean_echo( '<div class="alert alert-info">The following fields could not be converted into MySQL table columns: '.$unconverted_fields.'</div>'); |
|---|
| 5111 | // print_r($diff); |
|---|
| 5112 | //echo '</pre>'; |
|---|
| 5113 | } |
|---|
| 5114 | |
|---|
| 5115 | |
|---|
| 5116 | if($_POST['field_selection']) |
|---|
| 5117 | $report->field_selection = $field_selection; |
|---|
| 5118 | |
|---|
| 5119 | $report->additional_params = $_POST['additional_params']; |
|---|
| 5120 | |
|---|
| 5121 | $output .= '<div class="add_clause">'; |
|---|
| 5122 | $output .= '<a class="nf_button aa_bg_sec_btn add_new_where_clause2"><i class="fa fa-plus"></i> Add Filter </a>'; |
|---|
| 5123 | $output .= '<a class="nf_button aa_bg_sec_btn run_query_2 run_query" id="'.sanitize_text_field($_POST['form_Id']).'"><i class="fa fa-file-import"></i> Run Query </a>'; |
|---|
| 5124 | $output .= '<div class="close_filters"><span class="fas fa-arrow-left"></span></div>'; |
|---|
| 5125 | $output .= '</div>'; |
|---|
| 5126 | |
|---|
| 5127 | $output .= '<div class="right-col-top">'; |
|---|
| 5128 | $output .= '</div>'; |
|---|
| 5129 | /*echo '<pre>'; |
|---|
| 5130 | print_r($field_selection); |
|---|
| 5131 | echo '</pre>';*/ |
|---|
| 5132 | |
|---|
| 5133 | |
|---|
| 5134 | if($_POST['field_selection']) |
|---|
| 5135 | $report->field_selection = $_POST['field_selection']; |
|---|
| 5136 | $report->additional_params = $_POST['additional_params']; |
|---|
| 5137 | |
|---|
| 5138 | |
|---|
| 5139 | |
|---|
| 5140 | |
|---|
| 5141 | |
|---|
| 5142 | |
|---|
| 5143 | |
|---|
| 5144 | $output .= '<div class="right-bottom">'; |
|---|
| 5145 | |
|---|
| 5146 | |
|---|
| 5147 | if(!$database->checkout()) |
|---|
| 5148 | { |
|---|
| 5149 | $output .= '<div class="alert alert-danger" style="margin:20px;">Please register this plugin to view submission reports. Go to global settings above and follow registration procedure.</div>' ; |
|---|
| 5150 | } |
|---|
| 5151 | else |
|---|
| 5152 | { |
|---|
| 5153 | $output .= $report->print_record_table(); |
|---|
| 5154 | } |
|---|
| 5155 | $output .= '</div>'; |
|---|
| 5156 | |
|---|
| 5157 | NEXForms_clean_echo( $output); |
|---|
| 5158 | wp_die(); |
|---|
| 5159 | } |
|---|
| 5160 | |
|---|
| 5161 | public function report_get_additional_params($return = false, $update_id = 0) |
|---|
| 5162 | { |
|---|
| 5163 | |
|---|
| 5164 | $nf_functions = new NEXForms_Functions(); |
|---|
| 5165 | global $wpdb; |
|---|
| 5166 | $output = ''; |
|---|
| 5167 | |
|---|
| 5168 | $set_update_id = ($update_id) ? $update_id : sanitize_title($_POST['report_update_id']); |
|---|
| 5169 | |
|---|
| 5170 | $report = $wpdb->get_row($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_reports WHERE Id=%d', $set_update_id)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery |
|---|
| 5171 | |
|---|
| 5172 | $additional_params = ($set_update_id) ? json_decode($report->report_params,true) : $_POST['additional_params']; |
|---|
| 5173 | |
|---|
| 5174 | |
|---|
| 5175 | $header_array_filters = json_decode($report->report_fields,true); |
|---|
| 5176 | |
|---|
| 5177 | |
|---|
| 5178 | /* echo '<pre>'; |
|---|
| 5179 | print_r($header_array_filters); |
|---|
| 5180 | echo '</pre>';*/ |
|---|
| 5181 | |
|---|
| 5182 | $output .= '<div class="right-col-inner aa_bg_tri">'; |
|---|
| 5183 | |
|---|
| 5184 | |
|---|
| 5185 | $output .= '<div class="reporting_controls">'; |
|---|
| 5186 | |
|---|
| 5187 | |
|---|
| 5188 | |
|---|
| 5189 | |
|---|
| 5190 | $output .= '<div class="clause_container col-sm-12">'; |
|---|
| 5191 | if(isset($additional_params)) |
|---|
| 5192 | { |
|---|
| 5193 | foreach($additional_params as $key=>$val) |
|---|
| 5194 | { |
|---|
| 5195 | |
|---|
| 5196 | $output .= '<div class="new_clause">'; |
|---|
| 5197 | $output .= '<div class="col-xs-4 zero_padding">'; |
|---|
| 5198 | $output .= '<select class="post_ajax_select aa_bg_main_input form_control" name="column"> |
|---|
| 5199 | <option value="">'.__('--- Select field ---','nex-forms').'</option>'; |
|---|
| 5200 | foreach($header_array_filters as $key2=>$val2) |
|---|
| 5201 | $output .= ' <option value="'.$val2.'" '.(($val['column']==$val2) ? 'selected="selected"' : '').'>'.$nf_functions->unformat_name($val2).'</option>'; |
|---|
| 5202 | $output .= '</select>'; |
|---|
| 5203 | $output .= '</div>'; |
|---|
| 5204 | |
|---|
| 5205 | $output .= '<div class="col-xs-3">'; |
|---|
| 5206 | $output .= ' |
|---|
| 5207 | <select class="post_ajax_select aa_bg_main_input form_control" name="operator"> |
|---|
| 5208 | <option value="=" '.(($val['operator']=='=') ? 'selected="selected"' : '').'>'.__('Equal to','nex-forms').'</option> |
|---|
| 5209 | <option value="<>" '.(($val['operator']=='<>') ? 'selected="selected"' : '').'>'.__('Not equal','nex-forms').'</option> |
|---|
| 5210 | <option value=">" '.(($val['operator']=='>') ? 'selected="selected"' : '').'>'.__('Greater than','nex-forms').'</option> |
|---|
| 5211 | <option value="<" '.(($val['operator']=='<') ? 'selected="selected"' : '').'>'.__('Less than','nex-forms').'</option> |
|---|
| 5212 | <option value="LIKE" '.(($val['operator']=='LIKE') ? 'selected="selected"' : '').'>'.__('Contains','nex-forms').'</option> |
|---|
| 5213 | <option value="NOT LIKE" '.(($val['operator']=='NOT LIKE') ? 'selected="selected"' : '').'>'.__('Does not contain','nex-forms').'</option> |
|---|
| 5214 | '; |
|---|
| 5215 | $output .= '</select>'; |
|---|
| 5216 | $output .= '</div>'; |
|---|
| 5217 | |
|---|
| 5218 | $output .= '<div class="col-xs-4 zero_padding">'; |
|---|
| 5219 | $output .= '<input name="column_value" class="form-control aa_bg_main_input" placeholder="'.__('Value','nex-forms').'" value="'.$val['value'].'">'; |
|---|
| 5220 | $output .= '</div>'; |
|---|
| 5221 | |
|---|
| 5222 | $output .= '<div class="col-xs-1 zero_padding">'; |
|---|
| 5223 | $output .= '<a class="btn remove_where_clause">X</a>'; |
|---|
| 5224 | $output .= '</div>'; |
|---|
| 5225 | $output .= '</div>'; |
|---|
| 5226 | |
|---|
| 5227 | $set_additional_params[$val['column']] = $val['value']; |
|---|
| 5228 | } |
|---|
| 5229 | } |
|---|
| 5230 | |
|---|
| 5231 | $output .= '</div>'; |
|---|
| 5232 | |
|---|
| 5233 | |
|---|
| 5234 | $output .= '<div class="clause_replicator hidden">'; |
|---|
| 5235 | $output .= '<div class="col col-xs-4 zero_padding">'; |
|---|
| 5236 | $output .= '<select class="post_ajax_select form_control aa_bg_main_input" name="column"> |
|---|
| 5237 | <option value="" selected="selected">'.__('--- Select field ---','nex-forms').'</option>'; |
|---|
| 5238 | foreach($header_array_filters as $key=>$val) |
|---|
| 5239 | $output .= ' <option value="'.$val.'">'.$nf_functions->unformat_name($val).'</option>'; |
|---|
| 5240 | $output .= '</select>'; |
|---|
| 5241 | $output .= '</div>'; |
|---|
| 5242 | |
|---|
| 5243 | $output .= '<div class="col col-xs-3">'; |
|---|
| 5244 | $output .= ' |
|---|
| 5245 | <select class="post_ajax_select form_control aa_bg_main_input" name="operator"> |
|---|
| 5246 | <option value="=">'.__('Equal to','nex-forms').'</option> |
|---|
| 5247 | <option value="<>">'.__('Not equal','nex-forms').'</option> |
|---|
| 5248 | <option value=">">'.__('Greater than','nex-forms').'</option> |
|---|
| 5249 | <option value="<">'.__('Less than','nex-forms').'</option> |
|---|
| 5250 | <option value="LIKE">'.__('Contains','nex-forms').'</option> |
|---|
| 5251 | <option value="NOT LIKE">'.__('Does not contain','nex-forms').'</option> |
|---|
| 5252 | '; |
|---|
| 5253 | $output .= '</select>'; |
|---|
| 5254 | $output .= '</div>'; |
|---|
| 5255 | |
|---|
| 5256 | $output .= '<div class="col col-xs-4 zero_padding">'; |
|---|
| 5257 | $output .= '<input name="column_value" class="form-control aa_bg_main_input" placeholder="'.__('Value','nex-forms').'">'; |
|---|
| 5258 | $output .= '</div>'; |
|---|
| 5259 | |
|---|
| 5260 | $output .= '<div class="col col-xs-1 zero_padding">'; |
|---|
| 5261 | $output .= '<a class="btn remove_where_clause">X</a>'; |
|---|
| 5262 | $output .= '</div>'; |
|---|
| 5263 | $output .= '</div>'; |
|---|
| 5264 | |
|---|
| 5265 | $output .= '</div>'; |
|---|
| 5266 | |
|---|
| 5267 | |
|---|
| 5268 | $output .= '</div>'; |
|---|
| 5269 | |
|---|
| 5270 | $output .= '</div>'; |
|---|
| 5271 | |
|---|
| 5272 | |
|---|
| 5273 | if($return) |
|---|
| 5274 | return $output; |
|---|
| 5275 | else |
|---|
| 5276 | { |
|---|
| 5277 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|---|
| 5278 | wp_die(); |
|---|
| 5279 | } |
|---|
| 5280 | } |
|---|
| 5281 | |
|---|
| 5282 | |
|---|
| 5283 | public function print_to_pdf() |
|---|
| 5284 | { |
|---|
| 5285 | //if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 5286 | // wp_die(); |
|---|
| 5287 | if (function_exists('NEXForms_export_to_PDF')) |
|---|
| 5288 | { |
|---|
| 5289 | NEXForms_clean_echo( NEXForms_export_to_PDF(sanitize_text_field($_POST['form_entry_Id']), true, true)); |
|---|
| 5290 | } |
|---|
| 5291 | else |
|---|
| 5292 | { |
|---|
| 5293 | NEXForms_clean_echo( 'not installed'); |
|---|
| 5294 | die(); |
|---|
| 5295 | } |
|---|
| 5296 | } |
|---|
| 5297 | |
|---|
| 5298 | public function delete_pdf() |
|---|
| 5299 | { |
|---|
| 5300 | |
|---|
| 5301 | if ( !wp_verify_nonce( $_REQUEST['nex_forms_wpnonce'], 'nf_admin_dashboard_actions' ) ) { |
|---|
| 5302 | wp_die(); |
|---|
| 5303 | } |
|---|
| 5304 | |
|---|
| 5305 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 5306 | wp_die(); |
|---|
| 5307 | |
|---|
| 5308 | $upload_path = wp_upload_dir(); |
|---|
| 5309 | $set_uploads_dir = $upload_path['path']; |
|---|
| 5310 | |
|---|
| 5311 | unlink($upload_path['baseurl'].$upload_path['subdir'].'/form_entry.pdf'); |
|---|
| 5312 | unlink($set_uploads_dir.'/form_entry.pdf'); |
|---|
| 5313 | |
|---|
| 5314 | unlink($upload_path['baseurl'].$upload_path['subdir'].'/submission_report.pdf'); |
|---|
| 5315 | unlink($set_uploads_dir.'/submission_report.pdf'); |
|---|
| 5316 | |
|---|
| 5317 | die(); |
|---|
| 5318 | |
|---|
| 5319 | } |
|---|
| 5320 | |
|---|
| 5321 | |
|---|
| 5322 | public function print_report_to_pdf() |
|---|
| 5323 | { |
|---|
| 5324 | if(!current_user_can( NF_USER_LEVEL )) |
|---|
| 5325 | wp_die(); |
|---|
| 5326 | if (function_exists('NEXForms_report_to_PDF')) |
|---|
| 5327 | { |
|---|
| 5328 | NEXForms_clean_echo( NEXForms_report_to_PDF(sanitize_title($_POST['report_Id']))); |
|---|
| 5329 | } |
|---|
| 5330 | else |
|---|
| 5331 | { |
|---|
| 5332 | NEXForms_clean_echo( 'not installed'); |
|---|
| 5333 | die(); |
|---|
| 5334 | } |
|---|
| 5335 | } |
|---|
| 5336 | |
|---|
| 5337 | |
|---|
| 5338 | public function email_setup(){ |
|---|
| 5339 | $email_config = get_option('nex-forms-email-config'); |
|---|
| 5340 | $output = ''; |
|---|
| 5341 | $theme = wp_get_theme(); |
|---|
| 5342 | $output .= '<div class="dashboard-box global_settings">'; |
|---|
| 5343 | $output .= '<div class="dashboard-box-header aa_bg_main">'; |
|---|
| 5344 | $output .= '<div class="table_title"><i class="material-icons header-icon">drafts</i><span class="header_text ">'.__('Mailer Config','nex-forms').'</span></div>'; |
|---|
| 5345 | $output .= '</div>'; |
|---|
| 5346 | |
|---|
| 5347 | $output .= '<div class="dashboard-box-content">'; |
|---|
| 5348 | $output .= '<form name="email_config" id="email_config" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 5349 | |
|---|
| 5350 | |
|---|
| 5351 | <div class="row"> |
|---|
| 5352 | <div class="col-sm-4">'.__('Email Format','nex-forms').'</div> |
|---|
| 5353 | <div class="col-sm-8"> |
|---|
| 5354 | <input type="radio" '.(($email_config['email_content']=='html' || !$email_config['email_content']) ? 'checked="checked"' : '').' name="email_content" value="html" id="html" class="with-gap"><label for="html">HTML</label> |
|---|
| 5355 | <input type="radio" '.(($email_config['email_content']=='pt') ? 'checked="checked"' : '').' name="email_content" value="pt" id="pt" class="with-gap"><label for="pt">Plain Text</label> |
|---|
| 5356 | </div> |
|---|
| 5357 | </div> |
|---|
| 5358 | |
|---|
| 5359 | <div class="row"> |
|---|
| 5360 | <div class="col-sm-4">'.__('Mailing Method','nex-forms').'</div> |
|---|
| 5361 | <div class="col-sm-8"> |
|---|
| 5362 | <input type="radio" '.((!$email_config['email_method'] || $email_config['email_method']=='php_mailer') ? 'checked="checked"' : '').' name="email_method" value="php_mailer" id="php_mailer" class="with-gap"><label for="php_mailer">PHP Mailer</label><br /> |
|---|
| 5363 | <input type="radio" '.(($email_config['email_method']=='wp_mailer' || $email_config['email_method']=='api') ? 'checked="checked"' : '').' name="email_method" value="wp_mailer" id="wp_mailer" class="with-gap"><label for="wp_mailer">WP Mail</label><br /> |
|---|
| 5364 | <input type="radio" '.(($email_config['email_method']=='php') ? 'checked="checked"' : '').' name="email_method" value="php" id="php" class="with-gap"><label for="php">Normal PHP</label><br /> |
|---|
| 5365 | <input type="radio" '.(($email_config['email_method']=='smtp') ? 'checked="checked"' : '').' name="email_method" value="smtp" id="smtp" class="with-gap"><label for="smtp">SMTP</label><br /> |
|---|
| 5366 | |
|---|
| 5367 | </div> |
|---|
| 5368 | </div> |
|---|
| 5369 | |
|---|
| 5370 | <div class="smtp_settings" '.(($email_config['email_method']!='smtp') ? 'style="display:none;"' : '').'> |
|---|
| 5371 | <h5>'.__('SMTP Setup','nex-forms').'</h5> |
|---|
| 5372 | <div class="row"> |
|---|
| 5373 | <div class="col-sm-4">'.__('Host','nex-forms').'</div> |
|---|
| 5374 | <div class="col-sm-8"> |
|---|
| 5375 | <input class="form-control" type="text" name="smtp_host" placeholder="'.__('eg: mail.gmail.com','nex-forms').'" value="'.$email_config['smtp_host'].'"> |
|---|
| 5376 | </div> |
|---|
| 5377 | </div> |
|---|
| 5378 | |
|---|
| 5379 | <div class="row"> |
|---|
| 5380 | <div class="col-sm-4">'.__('Port','nex-forms').'</div> |
|---|
| 5381 | <div class="col-sm-8"> |
|---|
| 5382 | <input class="form-control" type="text" name="mail_port" placeholder="'.__('likely to be 25, 465 or 587','nex-forms').'" value="'.$email_config['mail_port'].'"> |
|---|
| 5383 | </div> |
|---|
| 5384 | </div> |
|---|
| 5385 | |
|---|
| 5386 | <div class="row"> |
|---|
| 5387 | <div class="col-sm-4">'.__('Security','nex-forms').'</div> |
|---|
| 5388 | <div class="col-sm-8"> |
|---|
| 5389 | <input type="radio" '.(($email_config['email_smtp_secure']=='0' || !$email_config['email_smtp_secure']) ? 'checked="checked"' : '').' name="email_smtp_secure" value="0" id="none" class="with-gap"><label for="none">'.__('None','nex-forms').'</label> |
|---|
| 5390 | <input type="radio" '.(($email_config['email_smtp_secure']=='ssl') ? 'checked="checked"' : '').' name="email_smtp_secure" value="ssl" id="ssl" class="with-gap"><label for="ssl">SSL</label> |
|---|
| 5391 | <input type="radio" '.(($email_config['email_smtp_secure']=='tls') ? 'checked="checked"' : '').' name="email_smtp_secure" value="tls" id="tls" class="with-gap"><label for="tls">TLS</label> |
|---|
| 5392 | </div> |
|---|
| 5393 | </div> |
|---|
| 5394 | |
|---|
| 5395 | <div class="row"> |
|---|
| 5396 | <div class="col-sm-4">'.__('Authentication','nex-forms').'</div> |
|---|
| 5397 | <div class="col-sm-8"> |
|---|
| 5398 | <input type="radio" '.(($email_config['smtp_auth']=='1') ? 'checked="checked"' : '').' name="smtp_auth" value="1" id="auth_yes" class="with-gap"><label for="auth_yes">Use Authentication</label> |
|---|
| 5399 | <input type="radio" '.(($email_config['smtp_auth']=='0') ? 'checked="checked"' : '').' name="smtp_auth" value="0" id="auth_no" class="with-gap"><label for="auth_no">No Authentication</label> |
|---|
| 5400 | </div> |
|---|
| 5401 | </div> |
|---|
| 5402 | |
|---|
| 5403 | </div> |
|---|
| 5404 | |
|---|
| 5405 | <div class="smtp_auth_settings" '.(($email_config['email_method']!='smtp' || $email_config['smtp_auth']!='1') ? 'style="display:none;"' : '').'> |
|---|
| 5406 | <h5>'.__('SMTP Authentication','nex-forms').'</h5> |
|---|
| 5407 | <div class="row"> |
|---|
| 5408 | <div class="col-sm-4">'.__('Username','nex-forms').'</div> |
|---|
| 5409 | <div class="col-sm-8"> |
|---|
| 5410 | <input class="form-control" type="text" name="set_smtp_user" value="'.$email_config['set_smtp_user'].'"> |
|---|
| 5411 | </div> |
|---|
| 5412 | </div> |
|---|
| 5413 | <div class="row"> |
|---|
| 5414 | <div class="col-sm-4">'.__('Password','nex-forms').'</div> |
|---|
| 5415 | <div class="col-sm-8"> |
|---|
| 5416 | <input class="form-control" type="password" name="set_smtp_pass" value="'.$email_config['set_smtp_pass'].'"> |
|---|
| 5417 | </div> |
|---|
| 5418 | </div> |
|---|
| 5419 | </div> |
|---|
| 5420 | |
|---|
| 5421 | |
|---|
| 5422 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save Mailer Config','nex-forms').' </button> |
|---|
| 5423 | <div style="clear:both;"></div> |
|---|
| 5424 | |
|---|
| 5425 | |
|---|
| 5426 | |
|---|
| 5427 | |
|---|
| 5428 | </form></div>'; |
|---|
| 5429 | |
|---|
| 5430 | $output .= '<div class="dashboard-box-footer"> |
|---|
| 5431 | <input type="text" class="form-control" name="test_email_address" value="" placeholder="'.__('Enter Email Address','nex-forms').'"> |
|---|
| 5432 | |
|---|
| 5433 | <div class="btn blue waves-effect waves-light send_test_email full_width">'.__('Send Test Email','nex-forms').'</div> |
|---|
| 5434 | <div style="clear:both"></div> |
|---|
| 5435 | </div></div>'; |
|---|
| 5436 | return $output; |
|---|
| 5437 | } |
|---|
| 5438 | |
|---|
| 5439 | |
|---|
| 5440 | public function email_subscriptions_setup(){ |
|---|
| 5441 | |
|---|
| 5442 | $output = ''; |
|---|
| 5443 | $output .= '<div class="dashboard-box global_settings ">'; |
|---|
| 5444 | $output .= '<div class="dashboard-box-header aa_bg_main">'; |
|---|
| 5445 | $output .= '<div class="table_title"><i class="material-icons header-icon contact_mail">contact_mail</i><span class="header_text ">'.__('Email Subscriptions Setup','nex-forms').'</span></div>'; |
|---|
| 5446 | $output .= ' |
|---|
| 5447 | <nav class="nav-extended dashboard_nav dashboard-box-nav"> |
|---|
| 5448 | <div class="nav-content aa_bg_sec"> |
|---|
| 5449 | <ul class="tabs_nf tabs_nf-transparent sec-menu aa_menu"> |
|---|
| 5450 | <li class="tab"><a class="active" href="#mail_chimp">'.__('MailChimp','nex-forms').'</a></li> |
|---|
| 5451 | <li class="tab"><a href="#get_response">'.__('GetResponse','nex-forms').'</a></li> |
|---|
| 5452 | </ul> |
|---|
| 5453 | </div> |
|---|
| 5454 | </nav>'; |
|---|
| 5455 | $output .= '</div>'; |
|---|
| 5456 | |
|---|
| 5457 | $output .= '<div class="dashboard-box-content">'; |
|---|
| 5458 | $output .= '<div id="mail_chimp">'; |
|---|
| 5459 | $output .= $this->print_mailchimp_setup(); |
|---|
| 5460 | $output .= '</div>'; |
|---|
| 5461 | |
|---|
| 5462 | $output .= '<div id="get_response" style="display:none;">'; |
|---|
| 5463 | $output .= $this->print_getresponse_setup(); |
|---|
| 5464 | $output .= '</div>'; |
|---|
| 5465 | |
|---|
| 5466 | $output .= '</div>'; |
|---|
| 5467 | $output .= '</div>'; |
|---|
| 5468 | return $output; |
|---|
| 5469 | } |
|---|
| 5470 | |
|---|
| 5471 | public function print_mailchimp_setup(){ |
|---|
| 5472 | |
|---|
| 5473 | $output = ''; |
|---|
| 5474 | $theme = wp_get_theme(); |
|---|
| 5475 | $output .= ' |
|---|
| 5476 | <form name="mail_chimp_setup" id="mail_chimp_setup" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 5477 | <div class="row"> |
|---|
| 5478 | <div class="col-sm-4">'.__('Mailchimp API key','nex-forms').'</div> |
|---|
| 5479 | <div class="col-sm-8"> |
|---|
| 5480 | <input class="form-control" type="text" name="mc_api" value="'.(($theme->Name=='NEX-Forms Demo') ? '••••••••••••••••••••' : get_option('nex_forms_mailchimp_api_key')).'" id="mc_api" placeholder="Enter your Mailchimp API key"> |
|---|
| 5481 | </div> |
|---|
| 5482 | </div> |
|---|
| 5483 | <div class="alert alert-info"> |
|---|
| 5484 | '.__('<strong>How to get your Mailchimp API key:</strong> |
|---|
| 5485 | <ol> |
|---|
| 5486 | <li>Login to your Mailchimp account: <a href="http://mailchimp.com/" target="_blank">mailchimp.com</a></li> |
|---|
| 5487 | <li>Click on your profile picture (top right of the screen)</li> |
|---|
| 5488 | <li>From the dropdown Click on Account</li> |
|---|
| 5489 | <li>Click on Extras->API Keys</li> |
|---|
| 5490 | <li>Copy your API key, or create a new one</li> |
|---|
| 5491 | <li>Paste your API key in the above field.</li> |
|---|
| 5492 | <li>Save</li> |
|---|
| 5493 | </ol>','nex-forms').' |
|---|
| 5494 | </div> |
|---|
| 5495 | |
|---|
| 5496 | |
|---|
| 5497 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save MailChimp API','nex-forms').' </button> |
|---|
| 5498 | <div style="clear:both"></div> |
|---|
| 5499 | </form> |
|---|
| 5500 | '; |
|---|
| 5501 | |
|---|
| 5502 | |
|---|
| 5503 | return $output; |
|---|
| 5504 | } |
|---|
| 5505 | |
|---|
| 5506 | public function print_getresponse_setup(){ |
|---|
| 5507 | |
|---|
| 5508 | $output = ''; |
|---|
| 5509 | $theme = wp_get_theme(); |
|---|
| 5510 | $output .= ' |
|---|
| 5511 | <form name="get_response_setup" id="get_response_setup" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 5512 | <div class="row"> |
|---|
| 5513 | <div class="col-sm-4">'.__('GetResponse API key','nex-forms').'</div> |
|---|
| 5514 | <div class="col-sm-8"> |
|---|
| 5515 | <input class="form-control" type="text" name="gr_api" value="'.(($theme->Name=='NEX-Forms Demo') ? '••••••••••••••••••••' : get_option('nex_forms_get_response_api_key')).'" id="gr_api" placeholder="Enter your GetResponse API key"> |
|---|
| 5516 | </div> |
|---|
| 5517 | </div> |
|---|
| 5518 | <div class="alert alert-info"> |
|---|
| 5519 | '.__('<strong>How to get your GetReponse API key:</strong> |
|---|
| 5520 | <ol> |
|---|
| 5521 | <li>Login to your GetResponse account: <a href="https://app.getresponse.com/" target="_blank">GetResponse</a></li> |
|---|
| 5522 | <li>Hover over your profile picture (top right of the screen)</li> |
|---|
| 5523 | <li>From the dropdown Click on Integrations</li> |
|---|
| 5524 | <li>Click on API & OAuth</li> |
|---|
| 5525 | <li>Copy your API key, or create a new one</li> |
|---|
| 5526 | <li>Paste your API key in the above field.</li> |
|---|
| 5527 | <li>Save</li> |
|---|
| 5528 | </ol>','nex-forms').' |
|---|
| 5529 | </div> |
|---|
| 5530 | |
|---|
| 5531 | |
|---|
| 5532 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save GetResponse API','nex-forms').' </button> |
|---|
| 5533 | <div style="clear:both"></div> |
|---|
| 5534 | </form> |
|---|
| 5535 | '; |
|---|
| 5536 | |
|---|
| 5537 | return $output; |
|---|
| 5538 | } |
|---|
| 5539 | |
|---|
| 5540 | |
|---|
| 5541 | |
|---|
| 5542 | public function wp_admin_options(){ |
|---|
| 5543 | $other_config = get_option('nex-forms-other-config'); |
|---|
| 5544 | |
|---|
| 5545 | |
|---|
| 5546 | $user_config = get_user_option('nex-forms-user-config',get_current_user_id()); |
|---|
| 5547 | |
|---|
| 5548 | $theme = wp_get_theme(); |
|---|
| 5549 | $output = ''; |
|---|
| 5550 | $output .= '<div class="dashboard-box global_settings">'; |
|---|
| 5551 | $output .= '<div class="dashboard-box-header aa_bg_main">'; |
|---|
| 5552 | $output .= '<div class="table_title"><i class="material-icons header-icon">accessibility</i><span class="header_text ">'.__('WP Admin Accessibility Options','nex-forms').'</span></div>'; |
|---|
| 5553 | $output .= '</div>'; |
|---|
| 5554 | |
|---|
| 5555 | $output .= '<div class="dashboard-box-content">'; |
|---|
| 5556 | if($theme->Name!='NEX-Forms Demo') |
|---|
| 5557 | $output .= '<form name="other_config" id="other_config" action="'.admin_url('admin-ajax.php').'" method="post">'; |
|---|
| 5558 | |
|---|
| 5559 | |
|---|
| 5560 | $output .= ' <div class="row"> |
|---|
| 5561 | <div class="col-sm-6">'.__('NEX-Forms User Level','nex-forms').'</div> |
|---|
| 5562 | <div class="col-sm-6"> |
|---|
| 5563 | |
|---|
| 5564 | <select name="set-wp-user-level" id="set-wp-user-level" class="material_select_1 form-control" style="display:block !important;"> |
|---|
| 5565 | <option '.(($other_config['set-wp-user-level']=='subscriber') ? 'selected="selected"' : '').' value="subscriber">'.__('Subscriber','nex-forms').'</option> |
|---|
| 5566 | <option '.(($other_config['set-wp-user-level']=='contributor') ? 'selected="selected"' : '').' value="contributor">'.__('Contributor','nex-forms').'</option> |
|---|
| 5567 | <option '.(($other_config['set-wp-user-level']=='author') ? 'selected="selected"' : '').' value="author">'.__('Author','nex-forms').'</option> |
|---|
| 5568 | <option '.(($other_config['set-wp-user-level']=='editor') ? 'selected="selected"' : '').' value="editor">'.__('Editor','nex-forms').'</option> |
|---|
| 5569 | <option '.(($other_config['set-wp-user-level']=='administrator' || !$other_config['set-wp-user-level']) ? 'selected="selected"' : '').' value="administrator">'.__('Administrator','nex-forms').'</option> |
|---|
| 5570 | </select> |
|---|
| 5571 | |
|---|
| 5572 | </div> |
|---|
| 5573 | </div> |
|---|
| 5574 | |
|---|
| 5575 | <div class="row"> |
|---|
| 5576 | <div class="col-sm-6">'.__('Admin Color Scheme','nex-forms').'</div> |
|---|
| 5577 | <div class="col-sm-6"> |
|---|
| 5578 | |
|---|
| 5579 | |
|---|
| 5580 | <input type="radio" class="with-gap" name="enable-color-adapt" id="enable-color-adapt-light" value="2" '.(($user_config['enable-color-adapt']=='1' || $user_config['enable-color-adapt']=='2' || !$user_config['enable-color-adapt']) ? 'checked="checked"' : '').'> |
|---|
| 5581 | <label for="enable-color-adapt-light">'.__('NEX-Forms Light','nex-forms').'</label><br /> |
|---|
| 5582 | |
|---|
| 5583 | |
|---|
| 5584 | <input type="radio" class="with-gap" name="enable-color-adapt" id="enable-color-adapt-dark" value="3" '.(($user_config['enable-color-adapt']=='3' ) ? 'checked="checked"' : '').'> |
|---|
| 5585 | <label for="enable-color-adapt-dark">'.__('NEX-Forms Dark','nex-forms').'</label><br /> |
|---|
| 5586 | |
|---|
| 5587 | <input type="radio" class="with-gap hidden" name="enable-color-adapt" id="enable-color-adapt-wp-admin" value="1" '.(($user_config['enable-color-adapt']=='1' || !$user_config['enable-color-adapt']) ? 'checked="checked"' : '').'> |
|---|
| 5588 | <label for="enable-color-adapt-wp-admin" class="hidden">'.__('WP Admin Color Scheme Adapt','nex-forms').'</label> |
|---|
| 5589 | |
|---|
| 5590 | |
|---|
| 5591 | |
|---|
| 5592 | </div> |
|---|
| 5593 | </div> |
|---|
| 5594 | |
|---|
| 5595 | <div class="row"> |
|---|
| 5596 | <div class="col-sm-6">'.__('Enable Zero Conflict Admin','nex-forms').'</div> |
|---|
| 5597 | <div class="col-sm-6"> |
|---|
| 5598 | |
|---|
| 5599 | |
|---|
| 5600 | |
|---|
| 5601 | |
|---|
| 5602 | <input type="radio" class="with-gap" name="zero-con" id="zero-con01" value="1" '.(($other_config['zero-con']=='1' || !$other_config['zero-con']) ? 'checked="checked"' : '').'> |
|---|
| 5603 | <label for="zero-con01">'.__('Yes','nex-forms').'</label> |
|---|
| 5604 | |
|---|
| 5605 | |
|---|
| 5606 | <input type="radio" class="with-gap" name="zero-con" id="zero-con02" value="0" '.(($other_config['zero-con']=='0' ) ? 'checked="checked"' : '').'> |
|---|
| 5607 | <label for="zero-con02">'.__('No (Not Recomended)','nex-forms').'</label> |
|---|
| 5608 | |
|---|
| 5609 | |
|---|
| 5610 | |
|---|
| 5611 | |
|---|
| 5612 | |
|---|
| 5613 | |
|---|
| 5614 | |
|---|
| 5615 | </div> |
|---|
| 5616 | </div> |
|---|
| 5617 | |
|---|
| 5618 | <div class="row"> |
|---|
| 5619 | <div class="col-sm-6">'.__('Enable NEX-Forms TinyMCE Button','nex-forms').'</div> |
|---|
| 5620 | <div class="col-sm-6"> |
|---|
| 5621 | |
|---|
| 5622 | |
|---|
| 5623 | |
|---|
| 5624 | |
|---|
| 5625 | <input type="radio" class="with-gap" name="enable-tinymce" id="enable-tinymce01" value="1" '.(($other_config['enable-tinymce']=='1' || !$other_config['enable-tinymce']) ? 'checked="checked"' : '').'> |
|---|
| 5626 | <label for="enable-tinymce01">'.__('Yes','nex-forms').'</label> |
|---|
| 5627 | |
|---|
| 5628 | |
|---|
| 5629 | <input type="radio" class="with-gap" name="enable-tinymce" id="enable-tinymce02" value="0" '.(($other_config['enable-tinymce']=='0' ) ? 'checked="checked"' : '').'> |
|---|
| 5630 | <label for="enable-tinymce02">'.__('No','nex-forms').'</label> |
|---|
| 5631 | |
|---|
| 5632 | |
|---|
| 5633 | |
|---|
| 5634 | |
|---|
| 5635 | |
|---|
| 5636 | |
|---|
| 5637 | |
|---|
| 5638 | </div> |
|---|
| 5639 | </div> |
|---|
| 5640 | |
|---|
| 5641 | <div class="row"> |
|---|
| 5642 | <div class="col-sm-6">'.__('Enable NEX-Forms Widget','nex-forms').'</div> |
|---|
| 5643 | <div class="col-sm-6"> |
|---|
| 5644 | |
|---|
| 5645 | |
|---|
| 5646 | |
|---|
| 5647 | <input type="radio" class="with-gap" name="enable-widget" id="enable-widget01" value="1" '.(($other_config['enable-widget']=='1' || !$other_config['enable-widget']) ? 'checked="checked"' : '').'> |
|---|
| 5648 | <label for="enable-widget01">'.__('Yes','nex-forms').'</label> |
|---|
| 5649 | |
|---|
| 5650 | |
|---|
| 5651 | <input type="radio" class="with-gap" name="enable-widget" id="enable-widget02" value="0" '.(($other_config['enable-widget']=='0' ) ? 'checked="checked"' : '').'> |
|---|
| 5652 | <label for="enable-widget02">'.__('No','nex-forms').'</label> |
|---|
| 5653 | |
|---|
| 5654 | |
|---|
| 5655 | |
|---|
| 5656 | |
|---|
| 5657 | |
|---|
| 5658 | |
|---|
| 5659 | </div> |
|---|
| 5660 | </div> |
|---|
| 5661 | |
|---|
| 5662 | |
|---|
| 5663 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save WP Admin Options','nex-forms').' </button> |
|---|
| 5664 | <div style="clear:both;"></div>'; |
|---|
| 5665 | |
|---|
| 5666 | |
|---|
| 5667 | |
|---|
| 5668 | if($theme->Name!='NEX-Forms Demo') |
|---|
| 5669 | $output .= '</form>'; |
|---|
| 5670 | |
|---|
| 5671 | $output .= '</div>'; |
|---|
| 5672 | |
|---|
| 5673 | $output .= '</div>'; |
|---|
| 5674 | return $output; |
|---|
| 5675 | } |
|---|
| 5676 | |
|---|
| 5677 | |
|---|
| 5678 | |
|---|
| 5679 | public function troubleshooting_options(){ |
|---|
| 5680 | |
|---|
| 5681 | $output = ''; |
|---|
| 5682 | $output .= '<div class="dashboard-box global_settings ">'; |
|---|
| 5683 | $output .= '<div class="dashboard-box-header aa_bg_main">'; |
|---|
| 5684 | $output .= '<div class="table_title"><i class="material-icons header-icon contact_mail">report_problem</i><span class="header_text ">'.__('Troubleshooting Options','nex-forms').'</span></div>'; |
|---|
| 5685 | $output .= ' |
|---|
| 5686 | <nav class="nav-extended dashboard_nav dashboard-box-nav"> |
|---|
| 5687 | <div class="nav-content aa_bg_sec"> |
|---|
| 5688 | <ul class="tabs_nf tabs_nf-transparent sec-menu aa_menu"> |
|---|
| 5689 | <li class="tab"><a class="active" href="#js_inc">'.__('Javascript Includes','nex-forms').'</a></li> |
|---|
| 5690 | <li class="tab"><a href="#css_inc">'.__('Stylesheet Includes','nex-forms').'</a></li> |
|---|
| 5691 | </ul> |
|---|
| 5692 | </div> |
|---|
| 5693 | </nav>'; |
|---|
| 5694 | $output .= '</div>'; |
|---|
| 5695 | |
|---|
| 5696 | $output .= '<div class="dashboard-box-content">'; |
|---|
| 5697 | $output .= '<div id="js_inc" >'; |
|---|
| 5698 | $output .= $this->print_js_inc(); |
|---|
| 5699 | $output .= '</div>'; |
|---|
| 5700 | |
|---|
| 5701 | $output .= '<div id="css_inc" style="display:none;">'; |
|---|
| 5702 | $output .= $this->print_css_inc(); |
|---|
| 5703 | $output .= '</div>'; |
|---|
| 5704 | |
|---|
| 5705 | $output .= '</div>'; |
|---|
| 5706 | $output .= '</div>'; |
|---|
| 5707 | return $output; |
|---|
| 5708 | } |
|---|
| 5709 | |
|---|
| 5710 | public function print_js_inc(){ |
|---|
| 5711 | $script_config = get_option('nex-forms-script-config'); |
|---|
| 5712 | $theme = wp_get_theme(); |
|---|
| 5713 | $output = ''; |
|---|
| 5714 | $output .= ' |
|---|
| 5715 | <form name="script_config" id="script_config" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 5716 | |
|---|
| 5717 | |
|---|
| 5718 | <div class="alert alert-info">'.__('Leave unchanged if you are not a developer with the proper know-how!','nex-forms').'</div> |
|---|
| 5719 | |
|---|
| 5720 | <div class="row"> |
|---|
| 5721 | <div class="col-sm-4">'.__('WP Core javascript','nex-forms').'</div> |
|---|
| 5722 | <div class="col-sm-8"> |
|---|
| 5723 | <input type="checkbox" '.(($script_config['inc-jquery']=='1') ? 'checked="checked"' : '').' name="inc-jquery" value="1" id="inc-jquery" ><label for="inc-jquery">jQuery </label><br /> |
|---|
| 5724 | <input type="checkbox" '.(($script_config['inc-jquery-ui-core']=='1') ? 'checked="checked"' : '').' name="inc-jquery-ui-core" value="1" id="inc-jquery-ui-core" ><label for="inc-jquery-ui-core">jQuery UI Core</label><br /> |
|---|
| 5725 | <input type="checkbox" '.(($script_config['inc-jquery-ui-autocomplete']=='1') ? 'checked="checked"' : '').' name="inc-jquery-ui-autocomplete" value="1" id="inc-jquery-ui-autocomplete" ><label for="inc-jquery-ui-autocomplete">jQuery UI Autocomplete</label><br /> |
|---|
| 5726 | <input type="checkbox" '.(($script_config['inc-jquery-ui-slider']=='1') ? 'checked="checked"' : '').' name="inc-jquery-ui-slider" value="1" id="inc-jquery-ui-slider" ><label for="inc-jquery-ui-slider">jQuery UI Slider</label><br /> |
|---|
| 5727 | <input type="checkbox" '.(($script_config['inc-jquery-form']=='1') ? 'checked="checked"' : '').' name="inc-jquery-form" value="1" id="inc-jquery-form" ><label for="inc-jquery-form">jQuery Form</label><br /> |
|---|
| 5728 | </div> |
|---|
| 5729 | </div> |
|---|
| 5730 | |
|---|
| 5731 | <div class="row"> |
|---|
| 5732 | <div class="col-sm-4">'.__('Extras','nex-forms').'</div> |
|---|
| 5733 | <div class="col-sm-8"> |
|---|
| 5734 | |
|---|
| 5735 | <input type="checkbox" '.(($script_config['inc-wow']=='1') ? 'checked="checked"' : '').' name="inc-wow" value="1" id="inc-wow" ><label for="inc-wow">Animations </label><br /> |
|---|
| 5736 | |
|---|
| 5737 | |
|---|
| 5738 | </div> |
|---|
| 5739 | </div> |
|---|
| 5740 | |
|---|
| 5741 | <div class="row"> |
|---|
| 5742 | <div class="col-sm-4">'.__('Plugin Dependent Javascript','nex-forms').'</div> |
|---|
| 5743 | <div class="col-sm-8"> |
|---|
| 5744 | <input type="checkbox" '.(($script_config['inc-bootstrap']=='1') ? 'checked="checked"' : '').' name="inc-bootstrap" value="1" id="inc-bootstrap" ><label for="inc-bootstrap">Bootstrap </label><br /> |
|---|
| 5745 | <input type="checkbox" '.(($script_config['inc-onload']=='1') ? 'checked="checked"' : '').' name="inc-onload" value="1" id="inc-onload" ><label for="inc-onload">Onload Functions </label><br /> |
|---|
| 5746 | </div> |
|---|
| 5747 | </div> |
|---|
| 5748 | |
|---|
| 5749 | |
|---|
| 5750 | |
|---|
| 5751 | |
|---|
| 5752 | |
|---|
| 5753 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save JS Inclusions','nex-forms').' </button> |
|---|
| 5754 | <div style="clear:both"></div> |
|---|
| 5755 | </form> |
|---|
| 5756 | '; |
|---|
| 5757 | |
|---|
| 5758 | return $output; |
|---|
| 5759 | } |
|---|
| 5760 | |
|---|
| 5761 | public function print_css_inc(){ |
|---|
| 5762 | $styles_config = get_option('nex-forms-style-config'); |
|---|
| 5763 | $output = ''; |
|---|
| 5764 | $theme = wp_get_theme(); |
|---|
| 5765 | $output .= ' |
|---|
| 5766 | <form name="style_config" id="style_config" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 5767 | |
|---|
| 5768 | <div class="alert alert-info">'.__('Please leave these includes if you are not a developer who knows what you are doing!','nex-forms').'</div> |
|---|
| 5769 | |
|---|
| 5770 | <div class="row"> |
|---|
| 5771 | <div class="col-sm-4">'.__('WP Core stylesheets','nex-forms').'</div> |
|---|
| 5772 | <div class="col-sm-8"> |
|---|
| 5773 | <input type="checkbox" '.(($styles_config['incstyle-jquery']=='1') ? 'checked="checked"' : '').' name="incstyle-jquery" value="1" id="incstyle-jquery" > <label for="incstyle-jquery-ui">jQuery UI</label> |
|---|
| 5774 | </div> |
|---|
| 5775 | </div> |
|---|
| 5776 | |
|---|
| 5777 | <div class="row"> |
|---|
| 5778 | <div class="col-sm-4">'.__('Other stylesheets','nex-forms').'</div> |
|---|
| 5779 | <div class="col-sm-8"> |
|---|
| 5780 | <input type="checkbox" '.(($styles_config['incstyle-bootstrap']=='1' || !array_key_exists('incstyle-bootstrap',$styles_config)) ? 'checked="checked"' : '').' name="incstyle-bootstrap" value="1" id="incstyle-bootstrap" ><label for="incstyle-bootstrap">Bootstrap</label><br /> |
|---|
| 5781 | <input type="checkbox" '.(($styles_config['incstyle-font-awesome']=='1' || !array_key_exists('incstyle-font-awesome',$styles_config)) ? 'checked="checked"' : '').' name="incstyle-font-awesome" value="1" id="incstyle-font-awesome" ><label for="incstyle-font-awesome">Font Awesome</label><br /> |
|---|
| 5782 | <input type="checkbox" '.(($styles_config['incstyle-font-awesome-v4-shims']=='1' || !array_key_exists('incstyle-font-awesome-v4-shims',$styles_config)) ? 'checked="checked"' : '').' name="incstyle-font-awesome-v4-shims" value="1" id="incstyle-font-awesome-v4-shims" ><label for="incstyle-font-awesome-v4-shims">Font Awesome v4 Shims</label><br /> |
|---|
| 5783 | <input type="checkbox" '.(($styles_config['incstyle-animations']=='1' || !array_key_exists('incstyle-animations',$styles_config)) ? 'checked="checked"' : '').' name="incstyle-animations" value="1" id="incstyle-animations" ><label for="incstyle-animations">Animations</label><br /> |
|---|
| 5784 | |
|---|
| 5785 | <input type="checkbox" '.(($styles_config['incstyle-custom']=='1') ? 'checked="checked"' : '').' name="incstyle-custom" value="1" id="incstyle-custom" ><label for="incstyle-custom">Custom NEX-Forms CSS</label> |
|---|
| 5786 | </div> |
|---|
| 5787 | </div> |
|---|
| 5788 | |
|---|
| 5789 | |
|---|
| 5790 | |
|---|
| 5791 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save CSS Inclusions','nex-forms').' </button> |
|---|
| 5792 | <div style="clear:both"></div> |
|---|
| 5793 | </form> |
|---|
| 5794 | '; |
|---|
| 5795 | |
|---|
| 5796 | return $output; |
|---|
| 5797 | } |
|---|
| 5798 | |
|---|
| 5799 | |
|---|
| 5800 | public function license_setup($args='', $client_info=''){ |
|---|
| 5801 | |
|---|
| 5802 | |
|---|
| 5803 | |
|---|
| 5804 | if(!$args) |
|---|
| 5805 | { |
|---|
| 5806 | $api_params2 = array( 'check_key' => 1,'ins_data'=>get_option('7103891')); |
|---|
| 5807 | $response2 = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout' => 30,'sslverify' => false,'body' => $api_params2) ); |
|---|
| 5808 | if(is_array($response2->errors)) |
|---|
| 5809 | { |
|---|
| 5810 | foreach($response2->errors as $error_type => $error) |
|---|
| 5811 | { |
|---|
| 5812 | NEXForms_clean_echo( '<br /><br /><div class="alert alert-danger"><strong>WP ERROR: </strong>'.strtoupper($error_type).' - '.$error[0].'<br />NEX-Forms can not verify your license as a result of this error. Please as your Hosting Provider to resolve this error. <a href="https://www.google.com/search?q='.$error[0].'" target="_blank">Here are some helpfull articles for your Host</a> </div><br /><br /> '); |
|---|
| 5813 | } |
|---|
| 5814 | } |
|---|
| 5815 | $checked = false; |
|---|
| 5816 | } |
|---|
| 5817 | else |
|---|
| 5818 | $checked = $args; |
|---|
| 5819 | |
|---|
| 5820 | $output = ''; |
|---|
| 5821 | $output .= '<div class="dashboard-box global_settings">'; |
|---|
| 5822 | $output .= '<div class="dashboard-box-header aa_bg_main">'; |
|---|
| 5823 | $output .= '<div class="table_title"><i class="material-icons header-icon">verified_user</i>'.__('NEX-Forms Registration Info','nex-forms').'</div>'; |
|---|
| 5824 | $output .= '<p class="box-info"><strong>Status:</strong> '.(($checked=='true') ? '<span class="label label-success">'.__('Registered','nex-forms').'</span>' : '<span class="label label-danger">'.__('Not Registered','nex-forms').'</span>').'</p>'; |
|---|
| 5825 | $output .= '</div>'; |
|---|
| 5826 | |
|---|
| 5827 | $output .= '<div class="dashboard-box-content activation_box">'; |
|---|
| 5828 | |
|---|
| 5829 | if($checked=='true') |
|---|
| 5830 | { |
|---|
| 5831 | $theme = wp_get_theme(); |
|---|
| 5832 | if($theme->Name=='NEX-Forms Demo') |
|---|
| 5833 | { |
|---|
| 5834 | $output .= '<div class="row">'; |
|---|
| 5835 | $output .= '<div class="col-sm-5">'; |
|---|
| 5836 | $output .= '<strong>'.__('Purchase Code','nex-forms').'</strong>'; |
|---|
| 5837 | $output .= '</div>'; |
|---|
| 5838 | $output .= '<div class="col-sm-7">'; |
|---|
| 5839 | $output .= '•••••••••••••••••••••'; |
|---|
| 5840 | $output .= '</div>'; |
|---|
| 5841 | $output .= '</div>'; |
|---|
| 5842 | $output .= '<div class="row">'; |
|---|
| 5843 | $output .= '<div class="col-sm-5">'; |
|---|
| 5844 | $output .= '<strong>'.__('Envato Username','nex-forms').'</strong>'; |
|---|
| 5845 | $output .= '</div>'; |
|---|
| 5846 | $output .= '<div class="col-sm-7">'; |
|---|
| 5847 | $output .= 'Basix'; |
|---|
| 5848 | $output .= '</div>'; |
|---|
| 5849 | $output .= '</div>'; |
|---|
| 5850 | $output .= '<div class="row">'; |
|---|
| 5851 | $output .= '<div class="col-sm-5">'; |
|---|
| 5852 | $output .= '<strong>'.__('License Type','nex-forms').'</strong>'; |
|---|
| 5853 | $output .= '</div>'; |
|---|
| 5854 | $output .= '<div class="col-sm-7">'; |
|---|
| 5855 | $output .= 'Regular'; |
|---|
| 5856 | $output .= '</div>'; |
|---|
| 5857 | $output .= '</div>'; |
|---|
| 5858 | $output .= '<div class="row">'; |
|---|
| 5859 | $output .= '<div class="col-sm-5">'; |
|---|
| 5860 | $output .= '<strong>'.__('Activated on','nex-forms').'</strong>'; |
|---|
| 5861 | $output .= '</div>'; |
|---|
| 5862 | $output .= '<div class="col-sm-7">'; |
|---|
| 5863 | $output .= 'Demo Site'; |
|---|
| 5864 | $output .= '</div>'; |
|---|
| 5865 | $output .= '</div>'; |
|---|
| 5866 | |
|---|
| 5867 | $output .= '<div class="row">'; |
|---|
| 5868 | $output .= '<div class="col-sm-12">'; |
|---|
| 5869 | $output .= ' |
|---|
| 5870 | '.__('<div class="alert alert-info">Unregistering a Puchase Code will free up the above code to be re-used on another domain. <strong>NOTE:</strong> This will make the current active site\'s registration inactive!</div> |
|---|
| 5871 | <button class="btn blue waves-effect waves-light" disabled="disabled">Unregister Puchase Code</button>','nex-forms').''; |
|---|
| 5872 | $output .= '</div>'; |
|---|
| 5873 | $output .= '</div>'; |
|---|
| 5874 | } |
|---|
| 5875 | else |
|---|
| 5876 | { |
|---|
| 5877 | $output .= '<div class="row">'; |
|---|
| 5878 | $output .= '<div class="col-sm-5">'; |
|---|
| 5879 | $output .= '<strong>'.__('Purchase Code','nex-forms').'</strong>'; |
|---|
| 5880 | $output .= '</div>'; |
|---|
| 5881 | $output .= '<div class="col-sm-7">'; |
|---|
| 5882 | if($client_info['purchase_code']) |
|---|
| 5883 | $output .= '••••••••••••••••••••••'.substr($client_info['purchase_code'],-6); |
|---|
| 5884 | else |
|---|
| 5885 | $output .= __('License not activated for this domain. Please refresh this page and enter your purchase code when prompted.','nex-forms'); |
|---|
| 5886 | $output .= '</div>'; |
|---|
| 5887 | $output .= '</div>'; |
|---|
| 5888 | $output .= '<div class="row">'; |
|---|
| 5889 | $output .= '<div class="col-sm-5">'; |
|---|
| 5890 | $output .= '<strong>'.__('Envato Username','nex-forms').'</strong>'; |
|---|
| 5891 | $output .= '</div>'; |
|---|
| 5892 | $output .= '<div class="col-sm-7">'; |
|---|
| 5893 | $output .= substr($client_info['envato_user_name'],0,1).'••••••••'.substr($client_info['envato_user_name'],-1); |
|---|
| 5894 | $output .= '</div>'; |
|---|
| 5895 | $output .= '</div>'; |
|---|
| 5896 | $output .= '<div class="row">'; |
|---|
| 5897 | $output .= '<div class="col-sm-5">'; |
|---|
| 5898 | $output .= '<strong>'.__('License Type','nex-forms').'</strong>'; |
|---|
| 5899 | $output .= '</div>'; |
|---|
| 5900 | $output .= '<div class="col-sm-7">'; |
|---|
| 5901 | $output .= $client_info['license_type']; |
|---|
| 5902 | $output .= '</div>'; |
|---|
| 5903 | $output .= '</div>'; |
|---|
| 5904 | $output .= '<div class="row">'; |
|---|
| 5905 | $output .= '<div class="col-sm-5">'; |
|---|
| 5906 | $output .= '<strong>'.__('Activated on','nex-forms').'</strong>'; |
|---|
| 5907 | $output .= '</div>'; |
|---|
| 5908 | $output .= '<div class="col-sm-7">'; |
|---|
| 5909 | $output .= $client_info['for_site']; |
|---|
| 5910 | $output .= '</div>'; |
|---|
| 5911 | $output .= '</div>'; |
|---|
| 5912 | |
|---|
| 5913 | $output .= '<div class="row">'; |
|---|
| 5914 | $output .= '<div class="col-sm-12">'; |
|---|
| 5915 | $output .= __(' |
|---|
| 5916 | <div class="alert alert-info">Unregistering a Puchase Code will free up the above code to be re-used on another domain. <strong>NOTE:</strong> This will make the current active site\'s registration inactive!</div> |
|---|
| 5917 | <button class="btn blue waves-effect waves-light deactivate_license">Unregister Puchase Code</button>','nex-forms'); |
|---|
| 5918 | $output .= '</div>'; |
|---|
| 5919 | $output .= '</div>'; |
|---|
| 5920 | } |
|---|
| 5921 | } |
|---|
| 5922 | else |
|---|
| 5923 | { |
|---|
| 5924 | $output .= __(' |
|---|
| 5925 | <div class="alert alert-info">Currently, your NEX-Forms installation is not registered, which means some key features are disabled. To unlock these features and to gain FREE access to all premium add-ons you need to <a href="https://1.envato.market/zQ6de" target="_blank"><strong>upgrade to the pro-version</strong></a></div> |
|---|
| 5926 | |
|---|
| 5927 | <input name="purchase_code" id="purchase_code" placeholder="Enter Item Purchase Code" class="form-control" type="text"> |
|---|
| 5928 | <br /> |
|---|
| 5929 | <div class="show_code_response"> |
|---|
| 5930 | <div class="alert alert-success">After your <a href="https://1.envato.market/zQ6de" target="_blank">purchase</a> you can find your purchase code from <a href="http://codecanyon.net/downloads" target="_blank"><strong>http://codecanyon.net/downloads</strong></a>. Click on Download next to NEX-Forms and then click on "License certificate & purchase code" and copy that code into the above text field and hit Register.</div> |
|---|
| 5931 | </div> |
|---|
| 5932 | |
|---|
| 5933 | <button class="btn blue waves-effect waves-light deactivate_license hidden">Unregister Puchase Code</button> |
|---|
| 5934 | <button class="btn blue waves-effect waves-light verify_purchase_code " type="button">Register</button> |
|---|
| 5935 | <div style="clear:both"></div> |
|---|
| 5936 | ','nex-forms'); |
|---|
| 5937 | } |
|---|
| 5938 | $output .= '</div>'; |
|---|
| 5939 | $output .= '</div>'; |
|---|
| 5940 | |
|---|
| 5941 | return $output; |
|---|
| 5942 | } |
|---|
| 5943 | |
|---|
| 5944 | public function preferences(){ |
|---|
| 5945 | |
|---|
| 5946 | $output = ''; |
|---|
| 5947 | $output .= '<div class="dashboard-box global_settings field_preferences">'; |
|---|
| 5948 | $output .= '<div class="dashboard-box-header aa_bg_main">'; |
|---|
| 5949 | $output .= '<div class="table_title"><i class="material-icons header-icon">favorite</i><span class="header_text ">'.__('Presets / Overall Default Preferences','nex-forms').'</span></div>'; |
|---|
| 5950 | $output .= ' |
|---|
| 5951 | <nav class="nav-extended dashboard_nav dashboard-box-nav aa_bg_sec"> |
|---|
| 5952 | <div class="nav-content aa_bg_sec"> |
|---|
| 5953 | <ul class="tabs_nf tabs_nf-transparent sec-menu aa_menu"> |
|---|
| 5954 | <li class="tab"><a class="active" href="#email_pref">'.__('Email Presets','nex-forms').'</a></li> |
|---|
| 5955 | <li class="tab"><a href="#other_pref">'.__('Form Presets','nex-forms').'</a></li> |
|---|
| 5956 | <li class="tab field_prefs"><a href="#field_pref">'.__('Field Presets','nex-forms').'</a></li> |
|---|
| 5957 | <li class="tab"><a href="#validation_pref">'.__('Validation Preset Massages','nex-forms').'</a></li> |
|---|
| 5958 | |
|---|
| 5959 | |
|---|
| 5960 | </ul> |
|---|
| 5961 | </div> |
|---|
| 5962 | </nav>'; |
|---|
| 5963 | $output .= '</div>'; |
|---|
| 5964 | |
|---|
| 5965 | $output .= '<div class="dashboard-box-content">'; |
|---|
| 5966 | //FIELD PREFERENCES |
|---|
| 5967 | |
|---|
| 5968 | $output .= '<div id="email_pref" >'; |
|---|
| 5969 | $output .= $this->print_email_pref(); |
|---|
| 5970 | $output .= '</div>'; |
|---|
| 5971 | |
|---|
| 5972 | $output .= '<div id="other_pref" style="display:none;">'; |
|---|
| 5973 | $output .= $this->print_other_pref(); |
|---|
| 5974 | $output .= '</div>'; |
|---|
| 5975 | |
|---|
| 5976 | |
|---|
| 5977 | $output .= '<div id="field_pref" style="display:none;">'; |
|---|
| 5978 | $output .= $this->print_field_pref(); |
|---|
| 5979 | $output .= '</div>'; |
|---|
| 5980 | |
|---|
| 5981 | $output .= '<div id="validation_pref" style="display:none;" >'; |
|---|
| 5982 | $output .= $this->print_validation_pref(); |
|---|
| 5983 | $output .= '</div>'; |
|---|
| 5984 | |
|---|
| 5985 | |
|---|
| 5986 | |
|---|
| 5987 | |
|---|
| 5988 | |
|---|
| 5989 | $output .= '</div>'; |
|---|
| 5990 | $output .= '</div>'; |
|---|
| 5991 | return $output; |
|---|
| 5992 | } |
|---|
| 5993 | |
|---|
| 5994 | public function print_field_pref(){ |
|---|
| 5995 | $preferences = get_option('nex-forms-preferences'); |
|---|
| 5996 | $theme = wp_get_theme(); |
|---|
| 5997 | |
|---|
| 5998 | $date_picker_lang = 'en'; |
|---|
| 5999 | |
|---|
| 6000 | $date_picker_format = 'DD/MM/YYYY'; |
|---|
| 6001 | |
|---|
| 6002 | if($preferences['field_preferences']['pref_date_picker_lang']) |
|---|
| 6003 | $date_picker_lang = $preferences['field_preferences']['pref_date_picker_lang']; |
|---|
| 6004 | |
|---|
| 6005 | if($preferences['field_preferences']['pref_date_picker_format']) |
|---|
| 6006 | $date_picker_format = $preferences['field_preferences']['pref_date_picker_format']; |
|---|
| 6007 | |
|---|
| 6008 | $output = ''; |
|---|
| 6009 | $output .= ' |
|---|
| 6010 | |
|---|
| 6011 | |
|---|
| 6012 | |
|---|
| 6013 | <form name="field-pref" id="field-pref" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 6014 | |
|---|
| 6015 | <br /><div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div> |
|---|
| 6016 | |
|---|
| 6017 | <h5>Field Labels</h5> |
|---|
| 6018 | <div class="row"> |
|---|
| 6019 | <div class="col-sm-4">'.__('Label Position','nex-forms').'</div> |
|---|
| 6020 | <div class="col-sm-8"> |
|---|
| 6021 | |
|---|
| 6022 | <input type="radio" class="with-gap" name="pref_label_align" '.((!$preferences['field_preferences']['pref_label_align'] || $preferences['field_preferences']['pref_label_align']=='top') ? 'checked="checked"' : '').' id="pref_label_align_top" value="top"> |
|---|
| 6023 | <label for="pref_label_align_top">'.__('Top','nex-forms').'</label> |
|---|
| 6024 | |
|---|
| 6025 | <input type="radio" class="with-gap" name="pref_label_align" id="pref_label_align_left" value="left" '.(($preferences['field_preferences']['pref_label_align']=='left') ? 'checked="checked"' : '').'> |
|---|
| 6026 | <label for="pref_label_align_left">'.__('Left','nex-forms').'</label> |
|---|
| 6027 | |
|---|
| 6028 | <input type="radio" class="with-gap" name="pref_label_align" id="pref_label_align_right" value="right" '.(($preferences['field_preferences']['pref_label_align']=='right') ? 'checked="checked"' : '').'> |
|---|
| 6029 | <label for="pref_label_align_right">'.__('Right','nex-forms').'</label> |
|---|
| 6030 | |
|---|
| 6031 | <input type="radio" class="with-gap" name="pref_label_align" id="pref_label_align_hidden" value="hidden" '.(($preferences['field_preferences']['pref_label_align']=='hidden') ? 'checked="checked"' : '').'> |
|---|
| 6032 | <label for="pref_label_align_hidden">'.__('Hidden','nex-forms').'</label> |
|---|
| 6033 | </div> |
|---|
| 6034 | </div> |
|---|
| 6035 | |
|---|
| 6036 | <div class="row"> |
|---|
| 6037 | <div class="col-sm-4">Label Text Alignment</div> |
|---|
| 6038 | <div class="col-sm-8"> |
|---|
| 6039 | |
|---|
| 6040 | |
|---|
| 6041 | <input type="radio" class="with-gap" name="pref_label_text_align" id="pref_label_text_align_left" value="align_left" '.((!$preferences['field_preferences']['pref_label_text_align'] || $preferences['field_preferences']['pref_label_text_align']=='align_left' || $preferences['field_preferences']['pref_label_text_align']=='align_let') ? 'checked="checked"' : '').'> |
|---|
| 6042 | <label for="pref_label_text_align_left">'.__('Left','nex-forms').'</label> |
|---|
| 6043 | |
|---|
| 6044 | <input type="radio" class="with-gap" name="pref_label_text_align" id="pref_label_text_align_right" value="align_right" '.(($preferences['field_preferences']['pref_label_text_align']=='align_right') ? 'checked="checked"' : '').'> |
|---|
| 6045 | <label for="pref_label_text_align_right">'.__('Right','nex-forms').'</label> |
|---|
| 6046 | |
|---|
| 6047 | <input type="radio" class="with-gap" name="pref_label_text_align" id="pref_label_text_align_center" value="align_center" '.(($preferences['field_preferences']['pref_label_text_align']=='align_center') ? 'checked="checked"' : '').'> |
|---|
| 6048 | <label for="pref_label_text_align_center">'.__('Center','nex-forms').'</label> |
|---|
| 6049 | </div> |
|---|
| 6050 | </div> |
|---|
| 6051 | |
|---|
| 6052 | <div class="row"> |
|---|
| 6053 | <div class="col-sm-4">Label Size</div> |
|---|
| 6054 | <div class="col-sm-8"> |
|---|
| 6055 | |
|---|
| 6056 | <input type="radio" class="with-gap" name="pref_label_size" id="pref_label_size_sm" value="text-sm" '.(($preferences['field_preferences']['pref_label_size']=='text-sm') ? 'checked="checked"' : '').'> |
|---|
| 6057 | <label for="pref_label_size_sm">'.__('Small','nex-forms').'</label> |
|---|
| 6058 | |
|---|
| 6059 | <input type="radio" class="with-gap" name="pref_label_size" id="pref_label_size_normal" value="" '.((!$preferences['field_preferences']['pref_label_size'] || $preferences['field_preferences']['pref_label_size']=='') ? 'checked="checked"' : '').'> |
|---|
| 6060 | <label for="pref_label_size_normal">'.__('Normal','nex-forms').'</label> |
|---|
| 6061 | |
|---|
| 6062 | <input type="radio" class="with-gap" name="pref_label_size" id="pref_label_size_lg" value="text-lg" '.(($preferences['field_preferences']['pref_label_size']=='text-lg') ? 'checked="checked"' : '').'> |
|---|
| 6063 | <label for="pref_label_size_lg">'.__('Large','nex-forms').'</label> |
|---|
| 6064 | </div> |
|---|
| 6065 | </div> |
|---|
| 6066 | |
|---|
| 6067 | <div class="row"> |
|---|
| 6068 | |
|---|
| 6069 | <div class="col-sm-4">Show Sublabel</div> |
|---|
| 6070 | <div class="col-sm-8"> |
|---|
| 6071 | |
|---|
| 6072 | |
|---|
| 6073 | |
|---|
| 6074 | <input type="radio" class="with-gap" name="pref_sub_label" id="pref_sub_label_01" value="on" '.(($preferences['field_preferences']['pref_sub_label']=='on') ? 'checked="checked"' : '').'> |
|---|
| 6075 | <label for="pref_sub_label_01">'.__('Yes','nex-forms').'</label> |
|---|
| 6076 | |
|---|
| 6077 | |
|---|
| 6078 | <input type="radio" class="with-gap" name="pref_sub_label" id="pref_sub_label_02" value="off" '.(($preferences['field_preferences']['pref_sub_label']=='off' || !$preferences['field_preferences']['pref_sub_label']) ? 'checked="checked"' : '').'> |
|---|
| 6079 | <label for="pref_sub_label_02">'.__('No','nex-forms').'</label> |
|---|
| 6080 | |
|---|
| 6081 | |
|---|
| 6082 | </div> |
|---|
| 6083 | </div> |
|---|
| 6084 | |
|---|
| 6085 | |
|---|
| 6086 | |
|---|
| 6087 | <h5>Field Inputs</h5> |
|---|
| 6088 | |
|---|
| 6089 | <div class="row"> |
|---|
| 6090 | <div class="col-sm-4">'.__('Input Text Alignment','nex-forms').'</div> |
|---|
| 6091 | <div class="col-sm-8"> |
|---|
| 6092 | |
|---|
| 6093 | |
|---|
| 6094 | |
|---|
| 6095 | <input type="radio" class="with-gap" name="pref_input_text_align" id="pref_input_text_align_left" value="align_left" '.((!$preferences['field_preferences']['pref_input_text_align'] || $preferences['field_preferences']['pref_input_text_align']=='align_left' || $preferences['field_preferences']['pref_input_text_align']=='aling_left') ? 'checked="checked"' : '').'> |
|---|
| 6096 | <label for="pref_input_text_align_left">'.__('Left','nex-forms').'</label> |
|---|
| 6097 | |
|---|
| 6098 | <input type="radio" class="with-gap" name="pref_input_text_align" id="pref_input_text_align_right" value="align_right" '.(($preferences['field_preferences']['pref_input_text_align']=='align_right') ? 'checked="checked"' : '').'> |
|---|
| 6099 | <label for="pref_input_text_align_right">'.__('Right','nex-forms').'</label> |
|---|
| 6100 | |
|---|
| 6101 | <input type="radio" class="with-gap" name="pref_input_text_align" id="pref_input_text_align_center" value="align_center" '.(($preferences['field_preferences']['pref_input_text_align']=='align_center') ? 'checked="checked"' : '').'> |
|---|
| 6102 | <label for="pref_input_text_align_center">'.__('Center','nex-forms').'</label> |
|---|
| 6103 | </div> |
|---|
| 6104 | </div> |
|---|
| 6105 | |
|---|
| 6106 | <div class="row"> |
|---|
| 6107 | <div class="col-sm-4">'.__('Input Size','nex-forms').'</div> |
|---|
| 6108 | <div class="col-sm-8"> |
|---|
| 6109 | |
|---|
| 6110 | <input type="radio" class="with-gap" name="pref_input_size" id="pref_input_size_sm" value="input-sm" '.(($preferences['field_preferences']['pref_input_size']=='input-sm') ? 'checked="checked"' : '').'> |
|---|
| 6111 | <label for="pref_input_size_sm">'.__('Small','nex-forms').'</label> |
|---|
| 6112 | |
|---|
| 6113 | <input type="radio" class="with-gap" name="pref_input_size" id="pref_input_size_normal" value="" '.((!$preferences['field_preferences']['pref_input_size'] || $preferences['field_preferences']['pref_input_size']=='') ? 'checked="checked"' : '').'> |
|---|
| 6114 | <label for="pref_input_size_normal">'.__('Normal','nex-forms').'</label> |
|---|
| 6115 | |
|---|
| 6116 | <input type="radio" class="with-gap" name="pref_input_size" id="pref_input_size_lg" value="input-lg" '.(($preferences['field_preferences']['pref_input_size']=='input-lg') ? 'checked="checked"' : '').'> |
|---|
| 6117 | <label for="pref_input_size_lg">'.__('Large','nex-forms').'</label> |
|---|
| 6118 | </div> |
|---|
| 6119 | </div> |
|---|
| 6120 | |
|---|
| 6121 | <div class="row"> |
|---|
| 6122 | <div class="col-sm-4">'.__('Date Picker Format','nex-forms').'</div> |
|---|
| 6123 | <div class="col-sm-8"> |
|---|
| 6124 | <input type="text" name="pref_date_picker_format" class="form-control" value="'.$date_picker_format.'"><small>See more about <a href="https://basixonline.net/nex-forms-docs/version-8/">date formatting syntax here</a></small> |
|---|
| 6125 | </div> |
|---|
| 6126 | </div> |
|---|
| 6127 | |
|---|
| 6128 | <div class="row"> |
|---|
| 6129 | <div class="col-sm-4">'.__('Date Picker Language','nex-forms').'</div> |
|---|
| 6130 | <div class="col-sm-8"> |
|---|
| 6131 | <select class="form-control pref_date_picker_lang" id="date-picker-lang-selector" name="pref_date_picker_lang" data-selected="'.$date_picker_lang.'"> |
|---|
| 6132 | <option value="en">en</option><option value="ar-ma">ar-ma</option><option value="ar-sa">ar-sa</option><option value="ar-tn">ar-tn</option><option value="ar">ar</option><option value="bg">bg</option><option value="ca">ca</option><option value="cs">cs</option><option value="da">da</option><option value="de-at">de-at</option><option value="de">de</option><option value="el">el</option><option value="en-au">en-au</option><option value="en-ca">en-ca</option><option value="en-gb">en-gb</option><option value="es">es</option><option value="fa">fa</option><option value="fi">fi</option><option value="fr-ca">fr-ca</option><option value="fr">fr</option><option value="he">he</option><option value="hi">hi</option><option value="hr">hr</option><option value="hu">hu</option><option value="id">id</option><option value="is">is</option><option value="it">it</option><option value="ja">ja</option><option value="ko">ko</option><option value="lt">lt</option><option value="lv">lv</option><option value="nb">nb</option><option value="nl">nl</option><option value="pl">pl</option><option value="pt-br">pt-br</option><option value="pt">pt</option><option value="ro">ro</option><option value="ru">ru</option><option value="sk">sk</option><option value="sl">sl</option><option value="sr-cyrl">sr-cyrl</option><option value="sr">sr</option><option value="sv">sv</option><option value="th">th</option><option value="tr">tr</option><option value="uk">uk</option><option value="vi">vi</option><option value="zh-cn">zh-cn</option><option value="zh-tw">zh-tw</option></select> |
|---|
| 6133 | </div> |
|---|
| 6134 | </div> |
|---|
| 6135 | |
|---|
| 6136 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save Field Preferences','nex-forms').' </button> |
|---|
| 6137 | <div style="clear:both"></div> |
|---|
| 6138 | </form> |
|---|
| 6139 | '; |
|---|
| 6140 | return $output; |
|---|
| 6141 | } |
|---|
| 6142 | |
|---|
| 6143 | |
|---|
| 6144 | public function print_validation_pref(){ |
|---|
| 6145 | $theme = wp_get_theme(); |
|---|
| 6146 | $preferences = get_option('nex-forms-preferences'); |
|---|
| 6147 | $output = ''; |
|---|
| 6148 | $output .= ' |
|---|
| 6149 | <form name="validation-pref" id="validation-pref" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 6150 | |
|---|
| 6151 | <div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div> |
|---|
| 6152 | |
|---|
| 6153 | <div class="row"> |
|---|
| 6154 | <div class="col-sm-4">'.__('Required Field','nex-forms').'</div> |
|---|
| 6155 | <div class="col-sm-8"> |
|---|
| 6156 | <input type="text" name="pref_requered_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_requered_msg']) ? $preferences['validation_preferences']['pref_requered_msg'] : 'Required').'"> |
|---|
| 6157 | </div> |
|---|
| 6158 | </div> |
|---|
| 6159 | |
|---|
| 6160 | <div class="row"> |
|---|
| 6161 | <div class="col-sm-4">'.__('Incorect Email','nex-forms').'</div> |
|---|
| 6162 | <div class="col-sm-8"> |
|---|
| 6163 | <input type="text" name="pref_email_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_email_format_msg']) ? $preferences['validation_preferences']['pref_email_format_msg'] : 'Invalid email address').'"> |
|---|
| 6164 | </div> |
|---|
| 6165 | </div> |
|---|
| 6166 | <div class="row"> |
|---|
| 6167 | <div class="col-sm-4">'.__('Incorect Phone Number','nex-forms').'</div> |
|---|
| 6168 | <div class="col-sm-8"> |
|---|
| 6169 | <input type="text" name="pref_phone_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_phone_format_msg']) ? $preferences['validation_preferences']['pref_phone_format_msg'] : 'Invalid phone number').'"> |
|---|
| 6170 | </div> |
|---|
| 6171 | </div> |
|---|
| 6172 | <div class="row"> |
|---|
| 6173 | <div class="col-sm-4">'.__('Incorect URL','nex-forms').'</div> |
|---|
| 6174 | <div class="col-sm-8"> |
|---|
| 6175 | <input type="text" name="pref_url_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_url_format_msg']) ? $preferences['validation_preferences']['pref_url_format_msg'] : 'Invalid URL').'"> |
|---|
| 6176 | </div> |
|---|
| 6177 | </div> |
|---|
| 6178 | |
|---|
| 6179 | <div class="row"> |
|---|
| 6180 | <div class="col-sm-4">'.__('Numerical','nex-forms').'</div> |
|---|
| 6181 | <div class="col-sm-8"> |
|---|
| 6182 | <input type="text" name="pref_numbers_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_numbers_format_msg']) ? $preferences['validation_preferences']['pref_numbers_format_msg'] : 'Only numbers are allowed').'"> |
|---|
| 6183 | </div> |
|---|
| 6184 | </div> |
|---|
| 6185 | |
|---|
| 6186 | <div class="row"> |
|---|
| 6187 | <div class="col-sm-4">'.__('Alphabetical','nex-forms').'</div> |
|---|
| 6188 | <div class="col-sm-8"> |
|---|
| 6189 | <input type="text" name="pref_char_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_char_format_msg']) ? $preferences['validation_preferences']['pref_char_format_msg'] : 'Only text are allowed').'"> |
|---|
| 6190 | </div> |
|---|
| 6191 | </div> |
|---|
| 6192 | |
|---|
| 6193 | <div class="row"> |
|---|
| 6194 | <div class="col-sm-4">'.__('Incorect File Extension','nex-forms').'</div> |
|---|
| 6195 | <div class="col-sm-8"> |
|---|
| 6196 | <input type="text" name="pref_invalid_file_ext_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_invalid_file_ext_msg']) ? $preferences['validation_preferences']['pref_invalid_file_ext_msg'] : 'Invalid file extension').'"> |
|---|
| 6197 | </div> |
|---|
| 6198 | </div> |
|---|
| 6199 | |
|---|
| 6200 | <div class="row"> |
|---|
| 6201 | <div class="col-sm-4">'.__('Maximum File Size Exceeded','nex-forms').'</div> |
|---|
| 6202 | <div class="col-sm-8"> |
|---|
| 6203 | <input type="text" name="pref_max_file_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_max_file_exceded']) ? $preferences['validation_preferences']['pref_max_file_exceded'] : 'Maximum File Size of {x}MB Exceeded').'"> |
|---|
| 6204 | </div> |
|---|
| 6205 | </div> |
|---|
| 6206 | <div class="row"> |
|---|
| 6207 | <div class="col-sm-4">'.__('Minimum File Size Required','nex-forms').'</div> |
|---|
| 6208 | <div class="col-sm-8"> |
|---|
| 6209 | <input type="text" name="pref_min_file_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_min_file_exceded']) ? $preferences['validation_preferences']['pref_min_file_exceded'] : 'Minimum File Size of {x}MB Required').'"> |
|---|
| 6210 | </div> |
|---|
| 6211 | </div> |
|---|
| 6212 | <div class="row"> |
|---|
| 6213 | <div class="col-sm-4">'.__('Maximum Size for All Files Exceeded','nex-forms').'</div> |
|---|
| 6214 | <div class="col-sm-8"> |
|---|
| 6215 | <input type="text" name="pref_max_file_af_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_max_file_af_exceded']) ? $preferences['validation_preferences']['pref_max_file_af_exceded'] : 'Maximum Size for all files can not exceed {x}MB').'"> |
|---|
| 6216 | </div> |
|---|
| 6217 | </div> |
|---|
| 6218 | <div class="row"> |
|---|
| 6219 | <div class="col-sm-4">'.__('Maximum File Upload Limit Exceeded','nex-forms').'</div> |
|---|
| 6220 | <div class="col-sm-8"> |
|---|
| 6221 | <input type="text" name="pref_max_file_ul_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_max_file_ul_exceded']) ? $preferences['validation_preferences']['pref_max_file_ul_exceded'] : 'Only a maximum of {x} files can be uploaded').'"> |
|---|
| 6222 | </div> |
|---|
| 6223 | </div> |
|---|
| 6224 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save Validation Preferences','nex-forms').' </button> |
|---|
| 6225 | <div style="clear:both"></div> |
|---|
| 6226 | </form> |
|---|
| 6227 | '; |
|---|
| 6228 | |
|---|
| 6229 | return $output; |
|---|
| 6230 | } |
|---|
| 6231 | |
|---|
| 6232 | public function print_email_pref(){ |
|---|
| 6233 | $preferences = get_option('nex-forms-preferences'); |
|---|
| 6234 | $output = ''; |
|---|
| 6235 | $theme = wp_get_theme(); |
|---|
| 6236 | $output .= ' |
|---|
| 6237 | <form name="emails-pref" id="emails-pref" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 6238 | |
|---|
| 6239 | <br /><div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div> |
|---|
| 6240 | |
|---|
| 6241 | <h5>'.__('Admin Email Presets','nex-forms').'</h5> |
|---|
| 6242 | |
|---|
| 6243 | <div class="row"> |
|---|
| 6244 | <div class="col-sm-4">'.__('From Address','nex-forms').'</div> |
|---|
| 6245 | <div class="col-sm-8"> |
|---|
| 6246 | <input type="text" name="pref_email_from_address" class="form-control" value="'.(($preferences['email_preferences']['pref_email_from_address']) ? $preferences['email_preferences']['pref_email_from_address'] : get_option('admin_email')).'"> |
|---|
| 6247 | </div> |
|---|
| 6248 | </div> |
|---|
| 6249 | |
|---|
| 6250 | <div class="row"> |
|---|
| 6251 | <div class="col-sm-4">'.__('From Name','nex-forms').'</div> |
|---|
| 6252 | <div class="col-sm-8"> |
|---|
| 6253 | <input type="text" name="pref_email_from_name" class="form-control" value="'.(($preferences['email_preferences']['pref_email_from_name']) ? $preferences['email_preferences']['pref_email_from_name'] : get_option('blogname')).'"> |
|---|
| 6254 | </div> |
|---|
| 6255 | </div> |
|---|
| 6256 | |
|---|
| 6257 | <div class="row"> |
|---|
| 6258 | <div class="col-sm-4">'.__('Recipients','nex-forms').'</div> |
|---|
| 6259 | <div class="col-sm-8"> |
|---|
| 6260 | <input type="text" name="pref_email_recipients" class="form-control" value="'.(($preferences['email_preferences']['pref_email_recipients']) ? $preferences['email_preferences']['pref_email_recipients'] : get_option('admin_email')).'"> |
|---|
| 6261 | </div> |
|---|
| 6262 | </div> |
|---|
| 6263 | |
|---|
| 6264 | <div class="row"> |
|---|
| 6265 | <div class="col-sm-4">'.__('Subject','nex-forms').'</div> |
|---|
| 6266 | <div class="col-sm-8"> |
|---|
| 6267 | <input type="text" name="pref_email_subject" class="form-control" value="'.(($preferences['email_preferences']['pref_email_subject']) ? $preferences['email_preferences']['pref_email_subject'] : get_option('blogname').' NEX-Forms submission').'"> |
|---|
| 6268 | </div> |
|---|
| 6269 | </div> |
|---|
| 6270 | |
|---|
| 6271 | <div class="row"> |
|---|
| 6272 | <div class="col-sm-4">'.__('Mail Body','nex-forms').'</div> |
|---|
| 6273 | <div class="col-sm-8"> |
|---|
| 6274 | <textarea name="pref_email_body" placeholder="'.__('Enter {{nf_form_data}} to display all submitted data from the form in a table','nex-forms').'" class="form-control">'.(($preferences['email_preferences']['pref_email_body']) ? $preferences['email_preferences']['pref_email_body'] : '{{nf_form_data}}').'</textarea> |
|---|
| 6275 | </div> |
|---|
| 6276 | </div> |
|---|
| 6277 | |
|---|
| 6278 | <h5>'.__('User Autoresponder Email Presets','nex-forms').'</h5> |
|---|
| 6279 | |
|---|
| 6280 | |
|---|
| 6281 | |
|---|
| 6282 | <div class="row"> |
|---|
| 6283 | <div class="col-sm-4">'.__('Subject','nex-forms').'</div> |
|---|
| 6284 | <div class="col-sm-8"> |
|---|
| 6285 | <input type="text" name="pref_user_email_subject" class="form-control" value="'.(($preferences['email_preferences']['pref_user_email_subject']) ? $preferences['email_preferences']['pref_user_email_subject'] : get_option('blogname').' NEX-Forms submission').'"> |
|---|
| 6286 | </div> |
|---|
| 6287 | </div> |
|---|
| 6288 | |
|---|
| 6289 | <div class="row"> |
|---|
| 6290 | <div class="col-sm-4">'.__('Mail Body','nex-forms').'</div> |
|---|
| 6291 | <div class="col-sm-8"> |
|---|
| 6292 | <textarea name="pref_user_email_body" placeholder="'.__('Enter {{nf_form_data}} to display all submitted data from the form in a table','nex-forms').'" class="form-control">'.(($preferences['email_preferences']['pref_user_email_body']) ? $preferences['email_preferences']['pref_user_email_body'] : 'Thank you for connecting with us. We will respond to you shortly.').'</textarea> |
|---|
| 6293 | </div> |
|---|
| 6294 | </div> |
|---|
| 6295 | |
|---|
| 6296 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save Email Preferences','nex-forms').' </button> |
|---|
| 6297 | <div style="clear:both"></div> |
|---|
| 6298 | </form> |
|---|
| 6299 | '; |
|---|
| 6300 | |
|---|
| 6301 | return $output; |
|---|
| 6302 | } |
|---|
| 6303 | |
|---|
| 6304 | public function print_other_pref(){ |
|---|
| 6305 | $preferences = get_option('nex-forms-preferences'); |
|---|
| 6306 | $output = ''; |
|---|
| 6307 | $theme = wp_get_theme(); |
|---|
| 6308 | $output .= ' |
|---|
| 6309 | <form name="other-pref" id="other-pref" action="'.admin_url('admin-ajax.php').'" method="post"> |
|---|
| 6310 | <div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div> |
|---|
| 6311 | |
|---|
| 6312 | <div class="row"> |
|---|
| 6313 | <div class="col-sm-4">'.__('Form Background','nex-forms').'</div> |
|---|
| 6314 | <div class="col-sm-8"> |
|---|
| 6315 | <input type="color" name="pref_form_bg" class="form-control" value="'.(($preferences['other_preferences']['pref_form_bg']) ? $preferences['other_preferences']['pref_form_bg'] : '#FFFFFF').'"> |
|---|
| 6316 | </div> |
|---|
| 6317 | </div> |
|---|
| 6318 | |
|---|
| 6319 | <div class="row"> |
|---|
| 6320 | <div class="col-sm-4">'.__('Form Shadow','nex-forms').'</div> |
|---|
| 6321 | <div class="col-sm-8"> |
|---|
| 6322 | |
|---|
| 6323 | <input type="radio" class="with-gap" name="pref_form_shadow" '.((!$preferences['other_preferences']['pref_form_shadow'] || $preferences['other_preferences']['pref_form_shadow']=='light') ? 'checked="checked"' : '').' id="pref_form_shadow_light" value="light"> |
|---|
| 6324 | <label for="pref_form_shadow_light">'.__('Light','nex-forms').'</label> |
|---|
| 6325 | |
|---|
| 6326 | <input type="radio" class="with-gap" name="pref_form_shadow" id="pref_form_shadow_dark" value="dark" '.(($preferences['other_preferences']['pref_form_shadow']=='dark') ? 'checked="checked"' : '').'> |
|---|
| 6327 | <label for="pref_form_shadow_dark">'.__('Dark','nex-forms').'</label> |
|---|
| 6328 | |
|---|
| 6329 | <input type="radio" class="with-gap" name="pref_form_shadow" id="pref_form_shadow_none" value="none" '.(($preferences['other_preferences']['pref_form_shadow']=='none') ? 'checked="checked"' : '').'> |
|---|
| 6330 | <label for="pref_form_shadow_none">'.__('None','nex-forms').'</label> |
|---|
| 6331 | |
|---|
| 6332 | </div> |
|---|
| 6333 | </div> |
|---|
| 6334 | |
|---|
| 6335 | <div class="row"> |
|---|
| 6336 | <div class="col-sm-4">'.__('Form Padding','nex-forms').'</div> |
|---|
| 6337 | <div class="col-sm-8"> |
|---|
| 6338 | <input type="number" name="pref_form_padding" class="form-control" value="'.(($preferences['other_preferences']['pref_form_padding']) ? $preferences['other_preferences']['pref_form_padding'] : '30').'"> |
|---|
| 6339 | </div> |
|---|
| 6340 | </div> |
|---|
| 6341 | |
|---|
| 6342 | <div class="row"> |
|---|
| 6343 | <div class="col-sm-4">'.__('Form Border Radius','nex-forms').'</div> |
|---|
| 6344 | <div class="col-sm-8"> |
|---|
| 6345 | <input type="number" name="pref_form_border_radius" class="form-control" value="'.(($preferences['other_preferences']['pref_form_border_radius']) ? $preferences['other_preferences']['pref_form_border_radius'] : '4').'"> |
|---|
| 6346 | </div> |
|---|
| 6347 | </div> |
|---|
| 6348 | |
|---|
| 6349 | <div class="row"> |
|---|
| 6350 | <div class="col-sm-4">'.__('On-screen confirmation message','nex-forms').'</div> |
|---|
| 6351 | <div class="col-sm-8"> |
|---|
| 6352 | <textarea name="pref_other_on_screen_message" class="form-control">'.(($preferences['other_preferences']['pref_other_on_screen_message']) ? $preferences['other_preferences']['pref_other_on_screen_message'] : 'Thank you for connecting with us. We will respond to you shortly.').'</textarea> |
|---|
| 6353 | </div> |
|---|
| 6354 | </div> |
|---|
| 6355 | |
|---|
| 6356 | <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'> '.__('Save Form Preferences','nex-forms').' </button> |
|---|
| 6357 | <div style="clear:both"></div> |
|---|
| 6358 | </form> |
|---|
| 6359 | '; |
|---|
| 6360 | |
|---|
| 6361 | return $output; |
|---|
| 6362 | } |
|---|
| 6363 | |
|---|
| 6364 | |
|---|
| 6365 | |
|---|
| 6366 | } |
|---|
| 6367 | } |
|---|
| 6368 | |
|---|
| 6369 | $get_nf_dashboard = new NEXForms_dashboard(); |
|---|
| 6370 | |
|---|
| 6371 | ?> |
|---|