| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* Class FrmDeprecated |
| 8 |
* |
| 9 |
* @since 3.04.03 |
| 10 |
* @codeCoverageIgnore |
| 11 |
*/ |
| 12 |
class FrmDeprecated { |
| 13 |
|
| 14 |
/** |
| 15 |
* @deprecated 2.3 |
| 16 |
*/ |
| 17 |
public static function deprecated( $function, $version ) { |
| 18 |
_deprecated_function( $function, $version ); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* @deprecated 4.0 |
| 23 |
*/ |
| 24 |
public static function new_form( $values = array() ) { |
| 25 |
_deprecated_function( __FUNCTION__, '4.0', 'FrmFormsController::edit' ); |
| 26 |
|
| 27 |
FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 28 |
|
| 29 |
$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 30 |
$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
| 31 |
|
| 32 |
if ( $action === 'create' ) { |
| 33 |
FrmFormsController::update( $values ); |
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
$values = FrmFormsHelper::setup_new_vars( $values ); |
| 38 |
$id = FrmForm::create( $values ); |
| 39 |
$values['id'] = $id; |
| 40 |
|
| 41 |
FrmFormsController::edit( $values ); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @deprecated 4.0 |
| 46 |
*/ |
| 47 |
public static function update_order() { |
| 48 |
_deprecated_function( __FUNCTION__, '4.0' ); |
| 49 |
FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 50 |
check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 51 |
|
| 52 |
$fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
| 53 |
foreach ( (array) $fields as $position => $item ) { |
| 54 |
FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) ); |
| 55 |
} |
| 56 |
wp_die(); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* @deprecated 4.0 |
| 61 |
* @param array $values - The form array |
| 62 |
*/ |
| 63 |
public static function builder_submit_button( $values ) { |
| 64 |
_deprecated_function( __FUNCTION__, '4.0' ); |
| 65 |
$page_action = FrmAppHelper::get_param( 'frm_action' ); |
| 66 |
$label = ( $page_action == 'edit' || $page_action == 'update' ) ? __( 'Update', 'formidable' ) : __( 'Create', 'formidable' ); |
| 67 |
|
| 68 |
?> |
| 69 |
<div class="postbox"> |
| 70 |
<p class="inside"> |
| 71 |
<button class="frm_submit_<?php echo esc_attr( ( isset( $values['ajax_load'] ) && $values['ajax_load'] ) ? '' : 'no_' ); ?>ajax button-primary frm_button_submit" type="button"> |
| 72 |
<?php echo esc_html( $label ); ?> |
| 73 |
</button> |
| 74 |
</p> |
| 75 |
</div> |
| 76 |
<?php |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* @deprecated 3.04.03 |
| 81 |
*/ |
| 82 |
public static function get_licenses() { |
| 83 |
_deprecated_function( __FUNCTION__, '3.04.03' ); |
| 84 |
|
| 85 |
$allow_autofill = self::allow_autofill(); |
| 86 |
$required_role = $allow_autofill ? 'setup_network' : 'frm_change_settings'; |
| 87 |
FrmAppHelper::permission_check( $required_role ); |
| 88 |
check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 89 |
|
| 90 |
if ( is_multisite() && get_site_option( 'frmpro-wpmu-sitewide' ) ) { |
| 91 |
$license = get_site_option( 'frmpro-credentials' ); |
| 92 |
} else { |
| 93 |
$license = get_option( 'frmpro-credentials' ); |
| 94 |
} |
| 95 |
|
| 96 |
if ( $license && is_array( $license ) && isset( $license['license'] ) ) { |
| 97 |
$url = 'https://formidableforms.com/frm-edd-api/licenses?l=' . urlencode( base64_encode( $license['license'] ) ); |
| 98 |
$licenses = self::send_api_request( |
| 99 |
$url, |
| 100 |
array( |
| 101 |
'name' => 'frm_api_licence', |
| 102 |
'expires' => 60 * 60 * 5, |
| 103 |
) |
| 104 |
); |
| 105 |
echo json_encode( $licenses ); |
| 106 |
} |
| 107 |
|
| 108 |
wp_die(); |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
/** |
| 113 |
* Don't allow subsite addon licenses to be fetched |
| 114 |
* unless the current user has super admin permissions |
| 115 |
* |
| 116 |
* @since 2.03.10 |
| 117 |
* @deprecated 3.04.03 |
| 118 |
*/ |
| 119 |
private static function allow_autofill() { |
| 120 |
$allow_autofill = FrmAppHelper::pro_is_installed(); |
| 121 |
if ( $allow_autofill && is_multisite() ) { |
| 122 |
$sitewide_activated = get_site_option( 'frmpro-wpmu-sitewide' ); |
| 123 |
if ( $sitewide_activated ) { |
| 124 |
$allow_autofill = current_user_can( 'setup_network' ); |
| 125 |
} |
| 126 |
} |
| 127 |
return $allow_autofill; |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* @deprecated 3.04.03 |
| 132 |
*/ |
| 133 |
private static function send_api_request( $url, $transient = array() ) { |
| 134 |
$data = get_transient( $transient['name'] ); |
| 135 |
if ( $data !== false ) { |
| 136 |
return $data; |
| 137 |
} |
| 138 |
|
| 139 |
$arg_array = array( |
| 140 |
'body' => array( |
| 141 |
'url' => home_url(), |
| 142 |
), |
| 143 |
'timeout' => 15, |
| 144 |
'user-agent' => 'Formidable/' . FrmAppHelper::$plug_version . '; ' . home_url(), |
| 145 |
); |
| 146 |
|
| 147 |
$response = wp_remote_post( $url, $arg_array ); |
| 148 |
$body = wp_remote_retrieve_body( $response ); |
| 149 |
$data = false; |
| 150 |
if ( ! is_wp_error( $response ) && ! is_wp_error( $body ) ) { |
| 151 |
$data = json_decode( $body, true ); |
| 152 |
set_transient( $transient['name'], $data, $transient['expires'] ); |
| 153 |
} |
| 154 |
|
| 155 |
return $data; |
| 156 |
} |
| 157 |
|
| 158 |
/** |
| 159 |
* @since 3.04.03 |
| 160 |
* @deprecated 3.06 |
| 161 |
* @codeCoverageIgnore |
| 162 |
*/ |
| 163 |
public static function get_pro_updater() { |
| 164 |
_deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::get_pro_updater' ); |
| 165 |
$api = new FrmFormApi(); |
| 166 |
return $api->get_pro_updater(); |
| 167 |
} |
| 168 |
|
| 169 |
/** |
| 170 |
* @since 4.06.02 |
| 171 |
* @deprecated 4.09.01 |
| 172 |
* @codeCoverageIgnore |
| 173 |
*/ |
| 174 |
public static function ajax_multiple_addons() { |
| 175 |
_deprecated_function( __FUNCTION__, '4.09.01', 'FrmProAddonsController::' . __METHOD__ ); |
| 176 |
echo json_encode( __( 'Your plugin has been not been installed. Please update Formidable Pro to get downloads.', 'formidable' ) ); |
| 177 |
wp_die(); |
| 178 |
} |
| 179 |
|
| 180 |
/** |
| 181 |
* @since 3.04.03 |
| 182 |
* @deprecated 3.06 |
| 183 |
* @codeCoverageIgnore |
| 184 |
* @return array |
| 185 |
*/ |
| 186 |
public static function error_for_license( $license ) { |
| 187 |
_deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::error_for_license' ); |
| 188 |
$api = new FrmFormApi( $license ); |
| 189 |
return $api->error_for_license(); |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* @since 3.04.03 |
| 194 |
* @deprecated 3.06 |
| 195 |
*/ |
| 196 |
public static function reset_cached_addons( $license = '' ) { |
| 197 |
_deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::reset_cached' ); |
| 198 |
$api = new FrmFormApi( $license ); |
| 199 |
$api->reset_cached(); |
| 200 |
} |
| 201 |
|
| 202 |
/** |
| 203 |
* @since 3.04.03 |
| 204 |
* @deprecated 3.06 |
| 205 |
* @return string |
| 206 |
*/ |
| 207 |
public static function get_cache_key( $license ) { |
| 208 |
_deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::get_cache_key' ); |
| 209 |
$api = new FrmFormApi( $license ); |
| 210 |
return $api->get_cache_key(); |
| 211 |
} |
| 212 |
|
| 213 |
/** |
| 214 |
* @since 3.04.03 |
| 215 |
* @deprecated 3.06 |
| 216 |
* @codeCoverageIgnore |
| 217 |
* @return array |
| 218 |
*/ |
| 219 |
public static function get_addon_info( $license = '' ) { |
| 220 |
_deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::get_api_info' ); |
| 221 |
$api = new FrmFormApi( $license ); |
| 222 |
return $api->get_api_info(); |
| 223 |
} |
| 224 |
|
| 225 |
/** |
| 226 |
* Add a filter to shorten the EDD filename for Formidable plugin, and add-on, updates |
| 227 |
* |
| 228 |
* @since 2.03.08 |
| 229 |
* @deprecated 3.04.03 |
| 230 |
* |
| 231 |
* @param boolean $return |
| 232 |
* @param string $package |
| 233 |
* |
| 234 |
* @return boolean |
| 235 |
*/ |
| 236 |
public static function add_shorten_edd_filename_filter( $return, $package ) { |
| 237 |
_deprecated_function( __FUNCTION__, '3.04.03' ); |
| 238 |
|
| 239 |
if ( strpos( $package, '/edd-sl/package_download/' ) !== false && strpos( $package, 'formidableforms.com' ) !== false ) { |
| 240 |
add_filter( 'wp_unique_filename', 'FrmDeprecated::shorten_edd_filename', 10, 2 ); |
| 241 |
} |
| 242 |
|
| 243 |
return $return; |
| 244 |
} |
| 245 |
|
| 246 |
/** |
| 247 |
* Shorten the EDD filename for automatic updates |
| 248 |
* Decreases size of file path so file path limit is not hit on Windows servers |
| 249 |
* |
| 250 |
* @since 2.03.08 |
| 251 |
* @deprecated 3.04.03 |
| 252 |
* |
| 253 |
* @param string $filename |
| 254 |
* @param string $ext |
| 255 |
* |
| 256 |
* @return string |
| 257 |
*/ |
| 258 |
public static function shorten_edd_filename( $filename, $ext ) { |
| 259 |
_deprecated_function( __FUNCTION__, '3.04.03' ); |
| 260 |
|
| 261 |
$filename = substr( $filename, 0, 50 ) . $ext; |
| 262 |
remove_filter( 'wp_unique_filename', 'FrmDeprecated::shorten_edd_filename', 10 ); |
| 263 |
|
| 264 |
return $filename; |
| 265 |
} |
| 266 |
|
| 267 |
/** |
| 268 |
* Filter shortcodes in text widgets |
| 269 |
* |
| 270 |
* @deprecated 2.5.4 |
| 271 |
*/ |
| 272 |
public static function widget_text_filter( $content ) { |
| 273 |
_deprecated_function( __FUNCTION__, '2.5.4' ); |
| 274 |
$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
| 275 |
return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
| 276 |
} |
| 277 |
|
| 278 |
/** |
| 279 |
* Used to filter shortcode in text widgets |
| 280 |
* |
| 281 |
* @deprecated 2.5.4 |
| 282 |
*/ |
| 283 |
public static function widget_text_filter_callback( $matches ) { |
| 284 |
_deprecated_function( __FUNCTION__, '2.5.4' ); |
| 285 |
return do_shortcode( $matches[0] ); |
| 286 |
} |
| 287 |
|
| 288 |
/** |
| 289 |
* Deprecated in favor of wpmu_upgrade_site |
| 290 |
* |
| 291 |
* @deprecated 2.3 |
| 292 |
*/ |
| 293 |
public static function front_head() { |
| 294 |
_deprecated_function( __FUNCTION__, '2.3' ); |
| 295 |
if ( is_multisite() && FrmAppController::needs_update() ) { |
| 296 |
FrmAppController::install(); |
| 297 |
} |
| 298 |
} |
| 299 |
|
| 300 |
/** |
| 301 |
* @deprecated 3.0.04 |
| 302 |
*/ |
| 303 |
public static function activation_install() { |
| 304 |
_deprecated_function( __FUNCTION__, '3.0.04', 'FrmAppController::install' ); |
| 305 |
FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
| 306 |
FrmFormActionsController::actions_init(); |
| 307 |
FrmAppController::install(); |
| 308 |
} |
| 309 |
|
| 310 |
/** |
| 311 |
* Routes for wordpress pages -- we're just replacing content |
| 312 |
* |
| 313 |
* @deprecated 3.0 |
| 314 |
*/ |
| 315 |
public static function page_route( $content ) { |
| 316 |
_deprecated_function( __FUNCTION__, '3.0' ); |
| 317 |
global $post; |
| 318 |
|
| 319 |
if ( $post && isset( $_GET['form'] ) ) { |
| 320 |
$content = FrmFormsController::page_preview(); |
| 321 |
} |
| 322 |
|
| 323 |
return $content; |
| 324 |
} |
| 325 |
|
| 326 |
/** |
| 327 |
* @deprecated 1.07.05 |
| 328 |
*/ |
| 329 |
public static function get_form_shortcode( $atts ) { |
| 330 |
_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
| 331 |
return FrmFormsController::get_form_shortcode( $atts ); |
| 332 |
} |
| 333 |
|
| 334 |
/** |
| 335 |
* @deprecated 1.07.05 |
| 336 |
*/ |
| 337 |
public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
| 338 |
_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
| 339 |
return FrmFormsController::show_form( $id, $key, $title, $description ); |
| 340 |
} |
| 341 |
|
| 342 |
/** |
| 343 |
* @deprecated 1.07.05 |
| 344 |
*/ |
| 345 |
public static function get_form( $filename, $form, $title, $description ) { |
| 346 |
_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
| 347 |
return FrmFormsController::get_form( $form, $title, $description ); |
| 348 |
} |
| 349 |
|
| 350 |
/** |
| 351 |
* @deprecated 3.0 |
| 352 |
*/ |
| 353 |
public static function edit_name( $field = 'name', $id = '' ) { |
| 354 |
_deprecated_function( __FUNCTION__, '3.0' ); |
| 355 |
|
| 356 |
FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 357 |
check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 358 |
|
| 359 |
if ( empty( $field ) ) { |
| 360 |
$field = 'name'; |
| 361 |
} |
| 362 |
|
| 363 |
if ( empty( $id ) ) { |
| 364 |
$id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
| 365 |
$id = str_replace( 'field_label_', '', $id ); |
| 366 |
} |
| 367 |
|
| 368 |
$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
| 369 |
$value = trim( $value ); |
| 370 |
if ( trim( strip_tags( $value ) ) === '' ) { |
| 371 |
// set blank value if there is no content |
| 372 |
$value = ''; |
| 373 |
} |
| 374 |
|
| 375 |
FrmField::update( $id, array( $field => $value ) ); |
| 376 |
|
| 377 |
do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) ); |
| 378 |
|
| 379 |
echo stripslashes( wp_kses_post( $value ) ); |
| 380 |
wp_die(); |
| 381 |
} |
| 382 |
|
| 383 |
/** |
| 384 |
* Load a single field in the form builder along with all needed variables |
| 385 |
* |
| 386 |
* @deprecated 3.0 |
| 387 |
* |
| 388 |
* @param int $field_id |
| 389 |
* @param array $values |
| 390 |
* @param int $form_id |
| 391 |
* |
| 392 |
* @return array |
| 393 |
*/ |
| 394 |
public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
| 395 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldsController::load_single_field' ); |
| 396 |
|
| 397 |
$field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) ); |
| 398 |
FrmFieldsController::load_single_field( $field, $values, $form_id ); |
| 399 |
|
| 400 |
return $field; |
| 401 |
} |
| 402 |
|
| 403 |
/** |
| 404 |
* @deprecated 3.0 |
| 405 |
*/ |
| 406 |
public static function bulk_create_template( $ids ) { |
| 407 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmForm::duplicate( $id, true, true )' ); |
| 408 |
FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 409 |
|
| 410 |
foreach ( $ids as $id ) { |
| 411 |
FrmForm::duplicate( $id, true, true ); |
| 412 |
} |
| 413 |
|
| 414 |
return __( 'Form template was Successfully Created', 'formidable' ); |
| 415 |
} |
| 416 |
|
| 417 |
/** |
| 418 |
* @deprecated 2.03 |
| 419 |
*/ |
| 420 |
public static function register_pro_scripts() { |
| 421 |
_deprecated_function( __FUNCTION__, '2.03', 'FrmProEntriesController::register_scripts' ); |
| 422 |
if ( FrmAppHelper::pro_is_installed() ) { |
| 423 |
FrmProEntriesController::register_scripts(); |
| 424 |
} |
| 425 |
} |
| 426 |
|
| 427 |
/** |
| 428 |
* @deprecated 3.0 |
| 429 |
*/ |
| 430 |
public static function edit_key() { |
| 431 |
_deprecated_function( __FUNCTION__, '3.0' ); |
| 432 |
$values = self::edit_in_place_value( 'form_key' ); |
| 433 |
echo wp_kses( stripslashes( FrmForm::get_key_by_id( $values['form_id'] ) ), array() ); |
| 434 |
wp_die(); |
| 435 |
} |
| 436 |
|
| 437 |
/** |
| 438 |
* @deprecated 3.0 |
| 439 |
*/ |
| 440 |
public static function edit_description() { |
| 441 |
_deprecated_function( __FUNCTION__, '3.0' ); |
| 442 |
$values = self::edit_in_place_value( 'description' ); |
| 443 |
echo wp_kses_post( FrmAppHelper::use_wpautop( stripslashes( $values['description'] ) ) ); |
| 444 |
wp_die(); |
| 445 |
} |
| 446 |
|
| 447 |
/** |
| 448 |
* @deprecated 3.0 |
| 449 |
*/ |
| 450 |
private static function edit_in_place_value( $field ) { |
| 451 |
_deprecated_function( __FUNCTION__, '3.0' ); |
| 452 |
check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 453 |
FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
| 454 |
|
| 455 |
$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 456 |
$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' ); |
| 457 |
|
| 458 |
$values = array( $field => trim( $value ) ); |
| 459 |
FrmForm::update( $form_id, $values ); |
| 460 |
$values['form_id'] = $form_id; |
| 461 |
|
| 462 |
return $values; |
| 463 |
} |
| 464 |
|
| 465 |
/** |
| 466 |
* @deprecated 1.07.05 |
| 467 |
*/ |
| 468 |
public static function add_default_templates( $path, $default = true, $template = true ) { |
| 469 |
_deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
| 470 |
|
| 471 |
$path = untrailingslashit( trim( $path ) ); |
| 472 |
$templates = glob( $path . '/*.php' ); |
| 473 |
|
| 474 |
for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
| 475 |
$filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) ); |
| 476 |
$template_query = array( 'form_key' => $filename ); |
| 477 |
if ( $template ) { |
| 478 |
$template_query['is_template'] = 1; |
| 479 |
} |
| 480 |
if ( $default ) { |
| 481 |
$template_query['default_template'] = 1; |
| 482 |
} |
| 483 |
$form = FrmForm::getAll( $template_query, '', 1 ); |
| 484 |
|
| 485 |
$values = FrmFormsHelper::setup_new_vars(); |
| 486 |
$values['form_key'] = $filename; |
| 487 |
$values['is_template'] = $template; |
| 488 |
$values['status'] = 'published'; |
| 489 |
|
| 490 |
include( $templates[ $i ] ); |
| 491 |
|
| 492 |
//get updated form |
| 493 |
if ( isset( $form ) && ! empty( $form ) ) { |
| 494 |
$old_id = $form->id; |
| 495 |
$form = FrmForm::getOne( $form->id ); |
| 496 |
} else { |
| 497 |
$old_id = false; |
| 498 |
$form = FrmForm::getAll( $template_query, '', 1 ); |
| 499 |
} |
| 500 |
|
| 501 |
if ( $form ) { |
| 502 |
do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) ); |
| 503 |
} |
| 504 |
} |
| 505 |
} |
| 506 |
|
| 507 |
/** |
| 508 |
* @deprecated 3.01 |
| 509 |
*/ |
| 510 |
public static function sanitize_array( &$values ) { |
| 511 |
_deprecated_function( __FUNCTION__, '3.01', 'FrmAppHelper::sanitize_value' ); |
| 512 |
FrmAppHelper::sanitize_value( 'wp_kses_post', $values ); |
| 513 |
} |
| 514 |
|
| 515 |
/** |
| 516 |
* Prepare and save settings in styles and actions |
| 517 |
* |
| 518 |
* @param array $settings |
| 519 |
* @param string $group |
| 520 |
* |
| 521 |
* @since 2.0.6 |
| 522 |
* @deprecated 2.05.06 |
| 523 |
*/ |
| 524 |
public static function save_settings( $settings, $group ) { |
| 525 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 526 |
return FrmDb::save_settings( $settings, $group ); |
| 527 |
} |
| 528 |
|
| 529 |
/** |
| 530 |
* Since actions are JSON encoded, we don't want any filters messing with it. |
| 531 |
* Remove the filters and then add them back in case any posts or views are |
| 532 |
* also being imported. |
| 533 |
* |
| 534 |
* Used when saving form actions and styles |
| 535 |
* |
| 536 |
* @since 2.0.4 |
| 537 |
* @deprecated 2.05.06 |
| 538 |
*/ |
| 539 |
public static function save_json_post( $settings ) { |
| 540 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 541 |
return FrmDb::save_json_post( $settings ); |
| 542 |
} |
| 543 |
|
| 544 |
/** |
| 545 |
* Check cache before fetching values and saving to cache |
| 546 |
* |
| 547 |
* @since 2.0 |
| 548 |
* @deprecated 2.05.06 |
| 549 |
* |
| 550 |
* @param string $cache_key The unique name for this cache |
| 551 |
* @param string $group The name of the cache group |
| 552 |
* @param string $query If blank, don't run a db call |
| 553 |
* @param string $type The wpdb function to use with this query |
| 554 |
* @return mixed $results The cache or query results |
| 555 |
*/ |
| 556 |
public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) { |
| 557 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 558 |
return FrmDb::check_cache( $cache_key, $group, $query, $type, $time ); |
| 559 |
} |
| 560 |
|
| 561 |
/** |
| 562 |
* @deprecated 2.05.06 |
| 563 |
*/ |
| 564 |
public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) { |
| 565 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 566 |
FrmDb::set_cache( $cache_key, $results, $group, $time ); |
| 567 |
} |
| 568 |
|
| 569 |
/** |
| 570 |
* Keep track of the keys cached in each group so they can be deleted |
| 571 |
* in Redis and Memcache |
| 572 |
* @deprecated 2.05.06 |
| 573 |
*/ |
| 574 |
public static function add_key_to_group_cache( $key, $group ) { |
| 575 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 576 |
FrmDb::add_key_to_group_cache( $key, $group ); |
| 577 |
} |
| 578 |
|
| 579 |
/** |
| 580 |
* @deprecated 2.05.06 |
| 581 |
*/ |
| 582 |
public static function get_group_cached_keys( $group ) { |
| 583 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 584 |
return FrmDb::get_group_cached_keys( $group ); |
| 585 |
} |
| 586 |
|
| 587 |
/** |
| 588 |
* @since 2.0 |
| 589 |
* @deprecated 2.05.06 |
| 590 |
* @param string $cache_key |
| 591 |
*/ |
| 592 |
public static function delete_cache_and_transient( $cache_key, $group = 'default' ) { |
| 593 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 594 |
FrmDb::delete_cache_and_transient( $cache_key, $group ); |
| 595 |
} |
| 596 |
|
| 597 |
/** |
| 598 |
* @since 2.0 |
| 599 |
* @deprecated 2.05.06 |
| 600 |
* |
| 601 |
* @param string $group The name of the cache group |
| 602 |
*/ |
| 603 |
public static function cache_delete_group( $group ) { |
| 604 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 605 |
FrmDb::cache_delete_group( $group ); |
| 606 |
} |
| 607 |
|
| 608 |
/** |
| 609 |
* Added for < WP 4.0 compatability |
| 610 |
* |
| 611 |
* @since 1.07.10 |
| 612 |
* @deprecated 2.05.06 |
| 613 |
* |
| 614 |
* @param string $term The value to escape |
| 615 |
* @return string The escaped value |
| 616 |
*/ |
| 617 |
public static function esc_like( $term ) { |
| 618 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 619 |
return FrmDb::esc_like( $term ); |
| 620 |
} |
| 621 |
|
| 622 |
/** |
| 623 |
* @param string $order_query |
| 624 |
* @deprecated 2.05.06 |
| 625 |
*/ |
| 626 |
public static function esc_order( $order_query ) { |
| 627 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 628 |
return FrmDb::esc_order( $order_query ); |
| 629 |
} |
| 630 |
|
| 631 |
/** |
| 632 |
* Make sure this is ordering by either ASC or DESC |
| 633 |
* @deprecated 2.05.06 |
| 634 |
*/ |
| 635 |
public static function esc_order_by( &$order_by ) { |
| 636 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 637 |
FrmDb::esc_order_by( $order_by ); |
| 638 |
} |
| 639 |
|
| 640 |
/** |
| 641 |
* @param string $limit |
| 642 |
* @deprecated 2.05.06 |
| 643 |
*/ |
| 644 |
public static function esc_limit( $limit ) { |
| 645 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 646 |
return FrmDb::esc_limit( $limit ); |
| 647 |
} |
| 648 |
|
| 649 |
/** |
| 650 |
* Get an array of values ready to go through $wpdb->prepare |
| 651 |
* @since 2.0 |
| 652 |
* @deprecated 2.05.06 |
| 653 |
*/ |
| 654 |
public static function prepare_array_values( $array, $type = '%s' ) { |
| 655 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 656 |
return FrmDb::prepare_array_values( $array, $type ); |
| 657 |
} |
| 658 |
|
| 659 |
/** |
| 660 |
* @deprecated 2.05.06 |
| 661 |
*/ |
| 662 |
public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) { |
| 663 |
_deprecated_function( __FUNCTION__, '2.05.06', 'FrmDb::' . __FUNCTION__ ); |
| 664 |
return FrmDb::prepend_and_or_where( $starts_with, $where ); |
| 665 |
} |
| 666 |
|
| 667 |
/** |
| 668 |
* @deprecated 2.05.06 |
| 669 |
*/ |
| 670 |
public static function upgrade() { |
| 671 |
$db = new FrmDbDeprecated(); |
| 672 |
$db->upgrade(); |
| 673 |
} |
| 674 |
|
| 675 |
/** |
| 676 |
* @deprecated 2.05.06 |
| 677 |
*/ |
| 678 |
public static function collation() { |
| 679 |
$db = new FrmDbDeprecated(); |
| 680 |
return $db->collation(); |
| 681 |
} |
| 682 |
|
| 683 |
/** |
| 684 |
* @deprecated 2.05.06 |
| 685 |
*/ |
| 686 |
public static function uninstall() { |
| 687 |
$db = new FrmDbDeprecated(); |
| 688 |
$db->uninstall(); |
| 689 |
} |
| 690 |
|
| 691 |
/** |
| 692 |
* @deprecated 3.0 |
| 693 |
* |
| 694 |
* @param string $html |
| 695 |
* @param array $field |
| 696 |
* @param array $errors |
| 697 |
* @param object $form |
| 698 |
* @param array $args |
| 699 |
* |
| 700 |
* @return string |
| 701 |
*/ |
| 702 |
public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
| 703 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::prepare_field_html' ); |
| 704 |
$field_obj = FrmFieldFactory::get_field_type( $field['type'], $field ); |
| 705 |
return $field_obj->prepare_field_html( compact( 'errors', 'form' ) ); |
| 706 |
} |
| 707 |
|
| 708 |
/** |
| 709 |
* @deprecated 3.0 |
| 710 |
*/ |
| 711 |
public static function get_default_field_opts( $type, $field = null, $limit = false ) { |
| 712 |
if ( $limit ) { |
| 713 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field_options' ); |
| 714 |
$field_options = FrmFieldsHelper::get_default_field_options( $type ); |
| 715 |
} else { |
| 716 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field' ); |
| 717 |
$field_options = FrmFieldsHelper::get_default_field( $type ); |
| 718 |
} |
| 719 |
|
| 720 |
return $field_options; |
| 721 |
} |
| 722 |
|
| 723 |
/** |
| 724 |
* @deprecated 2.02.07 |
| 725 |
*/ |
| 726 |
public static function dropdown_categories( $args ) { |
| 727 |
_deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' ); |
| 728 |
|
| 729 |
if ( FrmAppHelper::pro_is_installed() ) { |
| 730 |
$args['location'] = 'front'; |
| 731 |
$dropdown = FrmProPost::get_category_dropdown( $args['field'], $args ); |
| 732 |
} else { |
| 733 |
$dropdown = ''; |
| 734 |
} |
| 735 |
|
| 736 |
return $dropdown; |
| 737 |
} |
| 738 |
|
| 739 |
/** |
| 740 |
* @deprecated 3.0 |
| 741 |
*/ |
| 742 |
public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
| 743 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::remove_inline_conditions' ); |
| 744 |
FrmShortcodeHelper::remove_inline_conditions( $no_vars, $code, $replace_with, $html ); |
| 745 |
} |
| 746 |
|
| 747 |
/** |
| 748 |
* @deprecated 3.0 |
| 749 |
*/ |
| 750 |
public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
| 751 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::get_shortcode_tag' ); |
| 752 |
return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
| 753 |
} |
| 754 |
|
| 755 |
/** |
| 756 |
* @deprecated 3.01 |
| 757 |
*/ |
| 758 |
public static function get_sigle_label_postitions() { |
| 759 |
_deprecated_function( __FUNCTION__, '3.01', 'FrmStylesHelper::get_single_label_positions' ); |
| 760 |
return FrmStylesHelper::get_single_label_positions(); |
| 761 |
} |
| 762 |
|
| 763 |
/** |
| 764 |
* @deprecated 3.02.03 |
| 765 |
*/ |
| 766 |
public static function jquery_themes() { |
| 767 |
_deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_themes' ); |
| 768 |
|
| 769 |
$themes = array( |
| 770 |
'ui-lightness' => 'UI Lightness', |
| 771 |
'ui-darkness' => 'UI Darkness', |
| 772 |
'smoothness' => 'Smoothness', |
| 773 |
'start' => 'Start', |
| 774 |
'redmond' => 'Redmond', |
| 775 |
'sunny' => 'Sunny', |
| 776 |
'overcast' => 'Overcast', |
| 777 |
'le-frog' => 'Le Frog', |
| 778 |
'flick' => 'Flick', |
| 779 |
'pepper-grinder' => 'Pepper Grinder', |
| 780 |
'eggplant' => 'Eggplant', |
| 781 |
'dark-hive' => 'Dark Hive', |
| 782 |
'cupertino' => 'Cupertino', |
| 783 |
'south-street' => 'South Street', |
| 784 |
'blitzer' => 'Blitzer', |
| 785 |
'humanity' => 'Humanity', |
| 786 |
'hot-sneaks' => 'Hot Sneaks', |
| 787 |
'excite-bike' => 'Excite Bike', |
| 788 |
'vader' => 'Vader', |
| 789 |
'dot-luv' => 'Dot Luv', |
| 790 |
'mint-choc' => 'Mint Choc', |
| 791 |
'black-tie' => 'Black Tie', |
| 792 |
'trontastic' => 'Trontastic', |
| 793 |
'swanky-purse' => 'Swanky Purse', |
| 794 |
); |
| 795 |
|
| 796 |
$themes = apply_filters( 'frm_jquery_themes', $themes ); |
| 797 |
return $themes; |
| 798 |
} |
| 799 |
|
| 800 |
/** |
| 801 |
* @deprecated 3.02.03 |
| 802 |
*/ |
| 803 |
public static function enqueue_jquery_css() { |
| 804 |
_deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::enqueue_jquery_css' ); |
| 805 |
|
| 806 |
$form = self::get_form_for_page(); |
| 807 |
$theme_css = FrmStylesController::get_style_val( 'theme_css', $form ); |
| 808 |
if ( $theme_css != -1 ) { |
| 809 |
wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() ); |
| 810 |
} |
| 811 |
} |
| 812 |
|
| 813 |
/** |
| 814 |
* @deprecated 3.02.03 |
| 815 |
*/ |
| 816 |
public static function jquery_css_url( $theme_css ) { |
| 817 |
_deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_css_url' ); |
| 818 |
|
| 819 |
if ( ! is_callable( 'FrmProStylesController::jquery_css_url' ) ) { |
| 820 |
return; |
| 821 |
} |
| 822 |
|
| 823 |
return FrmProStylesController::jquery_css_url( $theme_css ); |
| 824 |
} |
| 825 |
|
| 826 |
/** |
| 827 |
* @deprecated 3.02.03 |
| 828 |
*/ |
| 829 |
public static function get_form_for_page() { |
| 830 |
_deprecated_function( __FUNCTION__, '3.02.03' ); |
| 831 |
|
| 832 |
global $frm_vars; |
| 833 |
$form_id = 'default'; |
| 834 |
if ( ! empty( $frm_vars['forms_loaded'] ) ) { |
| 835 |
foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 836 |
if ( is_object( $form ) ) { |
| 837 |
$form_id = $form->id; |
| 838 |
break; |
| 839 |
} |
| 840 |
} |
| 841 |
} |
| 842 |
return $form_id; |
| 843 |
} |
| 844 |
|
| 845 |
/** |
| 846 |
* @deprecated 3.0 |
| 847 |
*/ |
| 848 |
public static function validate_url_field( &$errors, $field, $value, $args ) { |
| 849 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::validate' ); |
| 850 |
|
| 851 |
if ( $value == '' || ! in_array( $field->type, array( 'website', 'url' ) ) ) { |
| 852 |
return; |
| 853 |
} |
| 854 |
|
| 855 |
FrmEntryValidate::validate_field_types( $errors, $field, $value, $args ); |
| 856 |
} |
| 857 |
|
| 858 |
/** |
| 859 |
* @deprecated 3.0 |
| 860 |
*/ |
| 861 |
public static function validate_email_field( &$errors, $field, $value, $args ) { |
| 862 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::validate' ); |
| 863 |
|
| 864 |
if ( $field->type != 'email' ) { |
| 865 |
return; |
| 866 |
} |
| 867 |
|
| 868 |
FrmEntryValidate::validate_field_types( $errors, $field, $value, $args ); |
| 869 |
} |
| 870 |
|
| 871 |
/** |
| 872 |
* @deprecated 3.0 |
| 873 |
*/ |
| 874 |
public static function validate_number_field( &$errors, $field, $value, $args ) { |
| 875 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::validate' ); |
| 876 |
|
| 877 |
//validate the number format |
| 878 |
if ( $field->type != 'number' ) { |
| 879 |
return; |
| 880 |
} |
| 881 |
|
| 882 |
FrmEntryValidate::validate_field_types( $errors, $field, $value, $args ); |
| 883 |
} |
| 884 |
|
| 885 |
/** |
| 886 |
* @deprecated 3.0 |
| 887 |
*/ |
| 888 |
public static function validate_recaptcha( &$errors, $field, $args ) { |
| 889 |
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::validate' ); |
| 890 |
|
| 891 |
if ( $field->type != 'captcha' ) { |
| 892 |
return; |
| 893 |
} |
| 894 |
|
| 895 |
FrmEntryValidate::validate_field_types( $errors, $field, '', $args ); |
| 896 |
} |
| 897 |
} |
| 898 |
|