Changeset 3338160
- Timestamp:
- 08/02/2025 09:23:51 AM (8 months ago)
- Location:
- chatterbug-forms
- Files:
-
- 2 edited
-
tags/1.0.2/chatterbug-forms.php (modified) (11 diffs)
-
trunk/chatterbug-forms.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chatterbug-forms/tags/1.0.2/chatterbug-forms.php
r3337927 r3338160 13 13 14 14 define('CBFORMS_PLUGIN_FILE_URL', __FILE__); 15 define('CBFORMS_SITE_URL', 'http://WP.ChatterbugForms.com');16 17 18 15 require_once __DIR__ . '/inc/cbforms-util.php'; 19 16 require_once __DIR__ . '/inc/cbforms-install.php'; … … 42 39 43 40 44 //function cbforms_load_scriptandstyle()45 //{46 47 //wp_register_script('cbforms-js', plugins_url("/assets/js/cbforms-admin.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer'));48 //wp_enqueue_script('cbforms-js');49 //wp_register_script('cbforms-formview-js', plugins_url("/assets/js/cbfformview.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer'));50 //wp_enqueue_script('cbforms-formview-js');51 52 //wp_enqueue_style('google-material-symbols', 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200', [], null);53 //wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js');54 //}41 function cbforms_load_scriptandstyle() 42 { 43 44 wp_register_script('cbforms-js', plugins_url("/assets/js/cbforms-admin.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer')); 45 wp_enqueue_script('cbforms-js'); 46 wp_register_script('cbforms-formview-js', plugins_url("/assets/js/cbfformview.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer')); 47 wp_enqueue_script('cbforms-formview-js'); 48 49 wp_enqueue_style('google-material-symbols', 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200', [], null); 50 wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js'); 51 } 55 52 // add_action('wp_enqueue_scripts', 'cbforms_load_scriptandstyle'); 56 53 … … 137 134 'cbforms_entries', 138 135 'cbforms_entries', 139 20140 );141 142 add_submenu_page(143 'cbforms-admin-dashboard',144 'Payment Setup',145 'Payment Setup',146 'manage_options',147 'cbforms_payments',148 'cbforms_payments',149 136 20 150 137 ); … … 239 226 } 240 227 241 function cbforms_payments()242 {243 if (!empty($_REQUEST['action']) && empty($_REQUEST['cbforms_nonce'])) {244 return false;245 }246 247 require_once __DIR__ . '/integrations/payments/payment-setup.php';248 }249 250 228 251 229 function cbforms_exports() … … 277 255 { 278 256 if (isset($atts['formid'])) { 279 //cbforms_load_scriptandstyle();257 cbforms_load_scriptandstyle(); 280 258 $formhtml = ''; 281 259 if ($GLOBALS['cbforms_msg'] != '' and $GLOBALS['cbforms_forrmid'] == $atts['formid']) { … … 324 302 $formmetaarray = array('formid' => $atts['formid'], 'postid' => $post->ID, 'posttitle' => $posttitle, 'ipaddress' => $remoteaddress); 325 303 $formmetastring = json_encode($formmetaarray); 326 $extracode ="formmetastring='" . $formmetastring . "'; " .304 $extracode="formmetastring='" . $formmetastring . "'; " . 327 305 'jQuery("form[id=' . $atts["formid"] . ']").' . "append('<input id=cbforms-formmeta-" . $atts["formid"] . " type=hidden name=cbforms-formmeta >'); " . 328 306 "jQuery('#cbforms-formmeta-" . $atts["formid"] . "').val(formmetastring); " . … … 333 311 "jQuery('#" . $atts["formid"] . "').submit(function(e) { jQuery(':disabled').each(function(e) { jQuery(this).removeAttr('disabled');}); }); "; 334 312 $formhtml = str_replace("/*<cbforms<extracodee>cbforms>*/", $extracode, $formhtml); 335 313 336 314 $querystatus = $wpdb->query($wpdb->prepare("update {$tablename} set form_views = case when form_views is null then 1 else form_views + 1 end where form_id = %s", $atts["formid"])); 337 315 … … 351 329 352 330 353 if ( isset($_REQUEST['cbforms-formtype']) && isset($_POST['cbforms-nonce']) && wp_verify_nonce(wp_kses_post(wp_unslash($_POST['cbforms-nonce'])), 'cbforms-submissionnonce')) {331 if (!isset($GLOBALS['chatterbugformsubmitted']) && isset($_REQUEST['cbforms-formtype']) && isset($_POST['cbforms-nonce']) && wp_verify_nonce(wp_kses_post(wp_unslash($_POST['cbforms-nonce'])), 'cbforms-submissionnonce')) { 354 332 if ($_REQUEST['cbforms-formtype'] == 'cbforms-submission') { 355 require_once __DIR__ . '/inc/mailchimp.php'; 356 357 333 $GLOBALS['chatterbugformsubmitted']='submitted'; 334 require_once __DIR__ . '/inc/mailchimp.php'; 335 336 358 337 array_walk_recursive($_POST, 'cbforms_sanitize_array'); 359 338 360 339 array_walk_recursive($_REQUEST, 'cbforms_sanitize_array'); 361 340 362 341 array_walk_recursive($_FILES, 'cbforms_sanitize_array'); 363 342 … … 381 360 unset($_REQUEST['cbforms-nonce']); 382 361 unset($_REQUEST['cbforms-formtype']); 383 unset($_REQUEST['cbformspot-' . $formmetaarray['formid']]); 362 unset($_REQUEST['cbformspot-' . $formmetaarray['formid']]); 384 363 385 364 $tablename = $table_prefix . 'cbforms_forms'; … … 428 407 } 429 408 } 430 } 409 } 431 410 if ($filecheckfailed) { 432 411 $GLOBALS['cbforms_msg'] = 'One or more of the files are larger than allowed or the wrong type. The system limit is ' . wp_kses_post(ini_get('upload_max_filesize')) . ' but this form might have lower limits, please check the form instructions. The form was submitted without the problem file(s)'; 412 433 413 } 434 414 … … 788 768 $cbformsuserid = cbforms_getoption('cbforms-userid', ''); 789 769 $cbformssitekey = cbforms_getoption('cbforms-sitekey', 'sign in to get the site key'); 770 define('CBFORMS_GETLIST_API_URL', 'https://wp.chatterbugforms.com/wp/getwpformlist.php'); 790 771 791 772 $data = array('userid' => $cbformsuserid, 'apikey' => $cbformssitekey, 'apitag' => esc_url(site_url())); 792 773 793 774 794 $results = cbforms_CallAPI('POST', CBFORMS_ SITE_URL.'/wp/getwpformlist.php', $data, $headerstr, $bodystr);775 $results = cbforms_CallAPI('POST', CBFORMS_GETLIST_API_URL, $data, $headerstr, $bodystr); 795 776 796 777 -
chatterbug-forms/trunk/chatterbug-forms.php
r3337928 r3338160 13 13 14 14 define('CBFORMS_PLUGIN_FILE_URL', __FILE__); 15 define('CBFORMS_SITE_URL', 'http://WP.ChatterbugForms.com');16 17 18 15 require_once __DIR__ . '/inc/cbforms-util.php'; 19 16 require_once __DIR__ . '/inc/cbforms-install.php'; … … 42 39 43 40 44 //function cbforms_load_scriptandstyle()45 //{46 47 //wp_register_script('cbforms-js', plugins_url("/assets/js/cbforms-admin.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer'));48 //wp_enqueue_script('cbforms-js');49 //wp_register_script('cbforms-formview-js', plugins_url("/assets/js/cbfformview.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer'));50 //wp_enqueue_script('cbforms-formview-js');51 52 //wp_enqueue_style('google-material-symbols', 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200', [], null);53 //wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js');54 //}41 function cbforms_load_scriptandstyle() 42 { 43 44 wp_register_script('cbforms-js', plugins_url("/assets/js/cbforms-admin.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer')); 45 wp_enqueue_script('cbforms-js'); 46 wp_register_script('cbforms-formview-js', plugins_url("/assets/js/cbfformview.js", __FILE__), array('jquery'), null, array('in_footer' => true, 'strategy' => 'defer')); 47 wp_enqueue_script('cbforms-formview-js'); 48 49 wp_enqueue_style('google-material-symbols', 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200', [], null); 50 wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js'); 51 } 55 52 // add_action('wp_enqueue_scripts', 'cbforms_load_scriptandstyle'); 56 53 … … 137 134 'cbforms_entries', 138 135 'cbforms_entries', 139 20140 );141 142 add_submenu_page(143 'cbforms-admin-dashboard',144 'Payment Setup',145 'Payment Setup',146 'manage_options',147 'cbforms_payments',148 'cbforms_payments',149 136 20 150 137 ); … … 239 226 } 240 227 241 function cbforms_payments()242 {243 if (!empty($_REQUEST['action']) && empty($_REQUEST['cbforms_nonce'])) {244 return false;245 }246 247 require_once __DIR__ . '/integrations/payments/payment-setup.php';248 }249 250 228 251 229 function cbforms_exports() … … 277 255 { 278 256 if (isset($atts['formid'])) { 279 //cbforms_load_scriptandstyle();257 cbforms_load_scriptandstyle(); 280 258 $formhtml = ''; 281 259 if ($GLOBALS['cbforms_msg'] != '' and $GLOBALS['cbforms_forrmid'] == $atts['formid']) { … … 324 302 $formmetaarray = array('formid' => $atts['formid'], 'postid' => $post->ID, 'posttitle' => $posttitle, 'ipaddress' => $remoteaddress); 325 303 $formmetastring = json_encode($formmetaarray); 326 $extracode ="formmetastring='" . $formmetastring . "'; " .304 $extracode="formmetastring='" . $formmetastring . "'; " . 327 305 'jQuery("form[id=' . $atts["formid"] . ']").' . "append('<input id=cbforms-formmeta-" . $atts["formid"] . " type=hidden name=cbforms-formmeta >'); " . 328 306 "jQuery('#cbforms-formmeta-" . $atts["formid"] . "').val(formmetastring); " . … … 333 311 "jQuery('#" . $atts["formid"] . "').submit(function(e) { jQuery(':disabled').each(function(e) { jQuery(this).removeAttr('disabled');}); }); "; 334 312 $formhtml = str_replace("/*<cbforms<extracodee>cbforms>*/", $extracode, $formhtml); 335 313 336 314 $querystatus = $wpdb->query($wpdb->prepare("update {$tablename} set form_views = case when form_views is null then 1 else form_views + 1 end where form_id = %s", $atts["formid"])); 337 315 … … 351 329 352 330 353 if ( isset($_REQUEST['cbforms-formtype']) && isset($_POST['cbforms-nonce']) && wp_verify_nonce(wp_kses_post(wp_unslash($_POST['cbforms-nonce'])), 'cbforms-submissionnonce')) {331 if (!isset($GLOBALS['chatterbugformsubmitted']) && isset($_REQUEST['cbforms-formtype']) && isset($_POST['cbforms-nonce']) && wp_verify_nonce(wp_kses_post(wp_unslash($_POST['cbforms-nonce'])), 'cbforms-submissionnonce')) { 354 332 if ($_REQUEST['cbforms-formtype'] == 'cbforms-submission') { 355 require_once __DIR__ . '/inc/mailchimp.php'; 356 357 333 $GLOBALS['chatterbugformsubmitted']='submitted'; 334 require_once __DIR__ . '/inc/mailchimp.php'; 335 336 358 337 array_walk_recursive($_POST, 'cbforms_sanitize_array'); 359 338 360 339 array_walk_recursive($_REQUEST, 'cbforms_sanitize_array'); 361 340 362 341 array_walk_recursive($_FILES, 'cbforms_sanitize_array'); 363 342 … … 381 360 unset($_REQUEST['cbforms-nonce']); 382 361 unset($_REQUEST['cbforms-formtype']); 383 unset($_REQUEST['cbformspot-' . $formmetaarray['formid']]); 362 unset($_REQUEST['cbformspot-' . $formmetaarray['formid']]); 384 363 385 364 $tablename = $table_prefix . 'cbforms_forms'; … … 428 407 } 429 408 } 430 } 409 } 431 410 if ($filecheckfailed) { 432 411 $GLOBALS['cbforms_msg'] = 'One or more of the files are larger than allowed or the wrong type. The system limit is ' . wp_kses_post(ini_get('upload_max_filesize')) . ' but this form might have lower limits, please check the form instructions. The form was submitted without the problem file(s)'; 412 433 413 } 434 414 … … 788 768 $cbformsuserid = cbforms_getoption('cbforms-userid', ''); 789 769 $cbformssitekey = cbforms_getoption('cbforms-sitekey', 'sign in to get the site key'); 770 define('CBFORMS_GETLIST_API_URL', 'https://wp.chatterbugforms.com/wp/getwpformlist.php'); 790 771 791 772 $data = array('userid' => $cbformsuserid, 'apikey' => $cbformssitekey, 'apitag' => esc_url(site_url())); 792 773 793 774 794 $results = cbforms_CallAPI('POST', CBFORMS_ SITE_URL.'/wp/getwpformlist.php', $data, $headerstr, $bodystr);775 $results = cbforms_CallAPI('POST', CBFORMS_GETLIST_API_URL, $data, $headerstr, $bodystr); 795 776 796 777
Note: See TracChangeset
for help on using the changeset viewer.