| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | if ( ! $this->tracking_allowed() ) { |
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - $ep = 'aHR0cHM6Ly91c2FnZTIuZm9ybWlkYWJsZWZvcm1zLmNvbS9zbmFwc2hvdA=='; | |
| 21 | + $ep = 'aHR0cHM6Ly91c2FnZS5mb3JtaWRhYmxlZm9ybXMuY29tL2FwcC9zbmFwc2hvdAo='; | |
| 22 | 22 | // $ep = base64_encode( 'http://localhost:4567/snapshot' ); // Uncomment for testing |
| 23 | 23 | $body = json_encode( $this->snapshot() ); |
| 24 | 24 | |
| 25 | 25 | // Setup variable for wp_remote_request. |
| @@ -30,17 +30,10 @@ | ||
| 30 | 30 | 'Content-Type' => 'application/json', |
| 31 | 31 | 'Content-Length' => strlen( $body ), |
| 32 | 32 | ), |
| 33 | 33 | 'body' => $body, |
| 34 | - // Without this, Debug Log catches the `http_request_failed` error. | |
| 35 | - 'timeout' => 45, | |
| 36 | 34 | ); |
| 37 | 35 | |
| 38 | - // Remove time limit to execute this function. | |
| 39 | - if ( function_exists( 'set_time_limit' ) ) { | |
| 40 | - set_time_limit( 0 ); | |
| 41 | - } | |
| 42 | - | |
| 43 | 36 | wp_remote_request( base64_decode( $ep ), $post ); |
| 44 | 37 | } |
| 45 | 38 | |
| 46 | 39 | /** |
| @@ -94,85 +87,15 @@ | ||
| 94 | 87 | 'forms' => $this->forms(), |
| 95 | 88 | 'fields' => $this->fields(), |
| 96 | 89 | 'actions' => $this->actions(), |
| 97 | 90 | |
| 98 | - 'onboarding-wizard' => $this->onboarding_wizard(), | |
| 99 | - 'flows' => FrmUsageController::get_flows_data(), | |
| 100 | - 'payments' => $this->payments(), | |
| 101 | - 'subscriptions' => $this->payments( 'frm_subscriptions' ), | |
| 91 | + 'onboarding-wizard' => FrmOnboardingWizardController::get_usage_data(), | |
| 102 | 92 | ); |
| 103 | 93 | |
| 104 | - if ( method_exists( 'FrmProAddonsController', 'get_readable_license_type' ) ) { | |
| 105 | - $snap['active_license'] = FrmProAddonsController::get_readable_license_type(); | |
| 106 | - } | |
| 107 | - | |
| 108 | 94 | return apply_filters( 'frm_usage_snapshot', $snap ); |
| 109 | 95 | } |
| 110 | 96 | |
| 111 | 97 | /** |
| 112 | - * Gets onboarding wizard data. | |
| 113 | - * | |
| 114 | - * @since 6.16.1 | |
| 115 | - * | |
| 116 | - * @return array | |
| 117 | - */ | |
| 118 | - private function onboarding_wizard() { | |
| 119 | - $data = FrmOnboardingWizardController::get_usage_data(); | |
| 120 | - $skipped_keys = array( | |
| 121 | - 'default_email', | |
| 122 | - 'is_subscribed', | |
| 123 | - 'allows_tracking', | |
| 124 | - 'summary_emails', | |
| 125 | - 'installed_addons', | |
| 126 | - ); | |
| 127 | - | |
| 128 | - foreach ( $skipped_keys as $skipped_key ) { | |
| 129 | - unset( $data[ $skipped_key ] ); | |
| 130 | - } | |
| 131 | - | |
| 132 | - return $data; | |
| 133 | - } | |
| 134 | - | |
| 135 | - /** | |
| 136 | - * Gets payments data. | |
| 137 | - * | |
| 138 | - * @since 6.16.1 | |
| 139 | - * | |
| 140 | - * @param string $table Database table name. | |
| 141 | - * @return array | |
| 142 | - */ | |
| 143 | - private function payments( $table = 'frm_payments' ) { | |
| 144 | - $allowed_tables = array( 'frm_payments', 'frm_subscriptions' ); | |
| 145 | - if ( ! in_array( $table, $allowed_tables, true ) ) { | |
| 146 | - return array(); | |
| 147 | - } | |
| 148 | - | |
| 149 | - if ( ! FrmTransLiteAppHelper::payments_table_exists() ) { | |
| 150 | - return array(); | |
| 151 | - } | |
| 152 | - | |
| 153 | - global $wpdb; | |
| 154 | - $rows = $wpdb->get_results( | |
| 155 | - $wpdb->prepare( | |
| 156 | - 'SELECT amount, status, paysys, created_at FROM %1$s', | |
| 157 | - $wpdb->prefix . $table | |
| 158 | - ) | |
| 159 | - ); | |
| 160 | - | |
| 161 | - $payments = array(); | |
| 162 | - foreach ( $rows as $row ) { | |
| 163 | - $payments[] = array( | |
| 164 | - 'amount' => (float) $row->amount, | |
| 165 | - 'status' => $row->status, | |
| 166 | - 'gateway' => $row->paysys, | |
| 167 | - 'created_at' => $row->created_at, | |
| 168 | - ); | |
| 169 | - } | |
| 170 | - | |
| 171 | - return $payments; | |
| 172 | - } | |
| 173 | - | |
| 174 | - /** | |
| 175 | 98 | * @since 3.06.04 |
| 176 | 99 | * @return array |
| 177 | 100 | */ |
| 178 | 101 | private function plugins() { |
| @@ -204,9 +127,11 @@ | ||
| 204 | 127 | 'permissions' => $this->permissions( $settings_list ), |
| 205 | 128 | ); |
| 206 | 129 | $pass_settings = array( |
| 207 | 130 | 'load_style', |
| 131 | + 'use_html', | |
| 208 | 132 | 'fade_form', |
| 133 | + 'jquery_css', | |
| 209 | 134 | 're_type', |
| 210 | 135 | 're_lang', |
| 211 | 136 | 're_multi', |
| 212 | 137 | 'menu', |
| @@ -211,20 +136,11 @@ | ||
| 211 | 136 | 're_multi', |
| 212 | 137 | 'menu', |
| 213 | 138 | 'mu_menu', |
| 214 | 139 | 'no_ips', |
| 215 | - 'custom_header_ip', | |
| 216 | - 'enable_gdpr', | |
| 217 | - 'no_gdpr_cookies', | |
| 218 | 140 | 'btsp_css', |
| 219 | - 'btsp_version', | |
| 141 | + 'btsp_errors', | |
| 220 | 142 | 'admin_bar', |
| 221 | - 'summary_emails', | |
| 222 | - 'active_captcha', | |
| 223 | - 'honeypot', | |
| 224 | - 'wp_spam_check', | |
| 225 | - 'denylist_check', | |
| 226 | - 'email_style', | |
| 227 | 143 | ); |
| 228 | 144 | |
| 229 | 145 | foreach ( $pass_settings as $setting ) { |
| 230 | 146 | if ( isset( $settings_list->$setting ) ) { |
| @@ -259,13 +175,11 @@ | ||
| 259 | 175 | 'login_msg', |
| 260 | 176 | 'admin_permission', |
| 261 | 177 | ); |
| 262 | 178 | |
| 263 | - $default = $settings_list->default_options(); | |
| 264 | - | |
| 265 | 179 | $message_settings = array(); |
| 266 | 180 | foreach ( $messages as $message ) { |
| 267 | - $message_settings[ 'changed-' . $message ] = $settings_list->$message === $default[ $message ] ? 0 : 1; | |
| 181 | + $message_settings[ $message ] = $settings_list->$message; | |
| 268 | 182 | } |
| 269 | 183 | |
| 270 | 184 | return $message_settings; |
| 271 | 185 | } |
| @@ -308,10 +222,10 @@ | ||
| 308 | 222 | $forms = array(); |
| 309 | 223 | $settings = array( |
| 310 | 224 | 'form_class', |
| 311 | 225 | 'akismet', |
| 226 | + 'honeypot', | |
| 312 | 227 | 'antispam', |
| 313 | - 'stopforumspam', | |
| 314 | 228 | 'custom_style', |
| 315 | 229 | 'success_action', |
| 316 | 230 | 'show_form', |
| 317 | 231 | 'no_save', |
| @@ -340,9 +254,8 @@ | ||
| 340 | 254 | 'prev_value', |
| 341 | 255 | 'submit_conditions', |
| 342 | 256 | ); |
| 343 | 257 | |
| 344 | - $style = new FrmStyle(); | |
| 345 | 258 | foreach ( $saved_forms as $form ) { |
| 346 | 259 | $new_form = array( |
| 347 | 260 | 'form_id' => $form->id, |
| 348 | 261 | 'description' => $form->description, |
| @@ -355,29 +268,14 @@ | ||
| 355 | 268 | ); |
| 356 | 269 | |
| 357 | 270 | foreach ( $settings as $setting ) { |
| 358 | 271 | if ( isset( $form->options[ $setting ] ) ) { |
| 359 | - if ( 'custom_style' === $setting ) { | |
| 360 | - $style->id = $form->options[ $setting ]; | |
| 361 | - | |
| 362 | - if ( ! $style->id ) { | |
| 363 | - $style_name = 0; | |
| 364 | - } elseif ( 1 === intval( $style->id ) ) { | |
| 365 | - $style_name = 'formidable-style'; | |
| 366 | - } else { | |
| 367 | - $style_post = $style->get_one(); | |
| 368 | - $style_name = $style_post ? $style_post->post_name : 'formidable-style'; | |
| 369 | - } | |
| 370 | - | |
| 371 | - $new_form[ $setting ] = $style_name; | |
| 372 | - } else { | |
| 373 | - $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] ); | |
| 374 | - } | |
| 272 | + $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] ); | |
| 375 | 273 | } |
| 376 | 274 | } |
| 377 | 275 | |
| 378 | 276 | $forms[] = apply_filters( 'frm_usage_form', $new_form, compact( 'form' ) ); |
| 379 | - }//end foreach | |
| 277 | + } | |
| 380 | 278 | |
| 381 | 279 | // If the array uses numeric keys, reset them. |
| 382 | 280 | return $forms; |
| 383 | 281 | } |
| @@ -388,9 +286,9 @@ | ||
| 388 | 286 | */ |
| 389 | 287 | private function form_field_count( $form_id ) { |
| 390 | 288 | global $wpdb; |
| 391 | 289 | |
| 392 | - $join = $wpdb->prefix . 'frm_fields fi JOIN ' . $wpdb->prefix . 'frm_forms fo ON (fi.form_id=fo.id)'; | |
| 290 | + $join = $wpdb->prefix . 'frm_fields fi LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fo ON (fi.form_id=fo.id)'; | |
| 393 | 291 | |
| 394 | 292 | $field_query = array( |
| 395 | 293 | 'or' => 1, |
| 396 | 294 | 'fi.form_id' => $form_id, |
| @@ -426,9 +324,9 @@ | ||
| 426 | 324 | 'limit' => 50, |
| 427 | 325 | 'order_by' => 'id DESC', |
| 428 | 326 | ); |
| 429 | 327 | |
| 430 | - $fields = FrmDb::get_results( 'frm_fields', array(), 'id, form_id, name, type, field_options', $args ); | |
| 328 | + $fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args ); | |
| 431 | 329 | foreach ( $fields as $k => $field ) { |
| 432 | 330 | FrmAppHelper::unserialize_or_decode( $field->field_options ); |
| 433 | 331 | $fields[ $k ]->field_options = json_encode( $field->field_options ); |
| 434 | 332 | } |
| @@ -464,9 +362,10 @@ | ||
| 464 | 362 | * @since 3.06.04 |
| 465 | 363 | * @return bool |
| 466 | 364 | */ |
| 467 | 365 | private function tracking_allowed() { |
| 468 | - return FrmUsageController::tracking_allowed(); | |
| 366 | + $settings = FrmAppHelper::get_settings(); | |
| 367 | + return $settings->tracking; | |
| 469 | 368 | } |
| 470 | 369 | |
| 471 | 370 | /** |
| 472 | 371 | * @since 3.06.04 |