| @@ -19,11 +19,8 @@ | ||
| 19 | 19 | * @var string|null |
| 20 | 20 | */ |
| 21 | 21 | private static $message; |
| 22 | 22 | |
| 23 | - /** | |
| 24 | - * @return void | |
| 25 | - */ | |
| 26 | 23 | public static function load_pro_hooks() { |
| 27 | 24 | if ( FrmAppHelper::pro_is_installed() ) { |
| 28 | 25 | FrmProStylesController::load_pro_hooks(); |
| 29 | 26 | } |
| @@ -28,11 +25,8 @@ | ||
| 28 | 25 | FrmProStylesController::load_pro_hooks(); |
| 29 | 26 | } |
| 30 | 27 | } |
| 31 | 28 | |
| 32 | - /** | |
| 33 | - * @return void | |
| 34 | - */ | |
| 35 | 29 | public static function register_post_types() { |
| 36 | 30 | register_post_type( |
| 37 | 31 | self::$post_type, |
| 38 | 32 | array( |
| @@ -73,10 +67,10 @@ | ||
| 73 | 67 | * |
| 74 | 68 | * @return void |
| 75 | 69 | */ |
| 76 | 70 | public static function menu() { |
| 77 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 78 | - add_submenu_page( 'themes.php', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_change_settings', 'formidable-styles2', 'FrmStylesController::route' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 71 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); | |
| 72 | + add_submenu_page( 'themes.php', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_change_settings', 'formidable-styles2', 'FrmStylesController::route' ); | |
| 79 | 73 | } |
| 80 | 74 | |
| 81 | 75 | /** |
| 82 | 76 | * Remove filters for the visual styler preview. |
| @@ -137,11 +131,10 @@ | ||
| 137 | 131 | |
| 138 | 132 | wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ), array(), $version ); |
| 139 | 133 | |
| 140 | 134 | $style = apply_filters( 'frm_style_head', false ); |
| 141 | - | |
| 142 | 135 | if ( $style ) { |
| 143 | - wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ), array(), $version ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 136 | + wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ), array(), $version ); | |
| 144 | 137 | } |
| 145 | 138 | } |
| 146 | 139 | |
| 147 | 140 | /** |
| @@ -168,9 +161,8 @@ | ||
| 168 | 161 | |
| 169 | 162 | /** |
| 170 | 163 | * @param string $register Either 'enqueue' or 'register'. |
| 171 | 164 | * @param bool $force True to enqueue/register the style if a form has not been loaded. |
| 172 | - * | |
| 173 | 165 | * @return void |
| 174 | 166 | */ |
| 175 | 167 | public static function enqueue_css( $register = 'enqueue', $force = false ) { |
| 176 | 168 | global $frm_vars; |
| @@ -182,9 +174,8 @@ | ||
| 182 | 174 | return; |
| 183 | 175 | } |
| 184 | 176 | |
| 185 | 177 | $frm_settings = FrmAppHelper::get_settings(); |
| 186 | - | |
| 187 | 178 | if ( $frm_settings->load_style === 'none' ) { |
| 188 | 179 | return; |
| 189 | 180 | } |
| 190 | 181 | |
| @@ -200,9 +191,8 @@ | ||
| 200 | 191 | wp_register_style( $css_key, $file, array(), $this_version ); |
| 201 | 192 | } |
| 202 | 193 | |
| 203 | 194 | $load_on_all = ! FrmAppHelper::is_admin() && 'all' === $frm_settings->load_style; |
| 204 | - | |
| 205 | 195 | if ( $load_on_all || $register !== 'register' ) { |
| 206 | 196 | wp_enqueue_style( $css_key ); |
| 207 | 197 | } |
| 208 | 198 | unset( $css_key, $file ); |
| @@ -233,20 +223,17 @@ | ||
| 233 | 223 | } |
| 234 | 224 | |
| 235 | 225 | /** |
| 236 | 226 | * @param array $stylesheet_urls |
| 237 | - * | |
| 238 | 227 | * @return void |
| 239 | 228 | */ |
| 240 | 229 | private static function get_url_to_custom_style( &$stylesheet_urls ) { |
| 241 | 230 | $file_name = '/css/' . self::get_file_name(); |
| 242 | - | |
| 243 | 231 | if ( is_readable( FrmAppHelper::plugin_path() . $file_name ) ) { |
| 244 | 232 | $url = FrmAppHelper::plugin_url() . $file_name; |
| 245 | 233 | } else { |
| 246 | 234 | $url = admin_url( 'admin-ajax.php?action=frmpro_css' ); |
| 247 | 235 | } |
| 248 | - | |
| 249 | 236 | $stylesheet_urls['formidable'] = $url; |
| 250 | 237 | } |
| 251 | 238 | |
| 252 | 239 | /** |
| @@ -252,45 +239,42 @@ | ||
| 252 | 239 | /** |
| 253 | 240 | * Use a different stylesheet per site in a multisite install |
| 254 | 241 | * |
| 255 | 242 | * @since 3.0.03 |
| 256 | - * | |
| 257 | - * @return string | |
| 258 | 243 | */ |
| 259 | 244 | public static function get_file_name() { |
| 260 | 245 | if ( is_multisite() ) { |
| 261 | 246 | $blog_id = get_current_blog_id(); |
| 262 | - return 'formidableforms' . absint( $blog_id ) . '.css'; | |
| 247 | + $name = 'formidableforms' . absint( $blog_id ) . '.css'; | |
| 248 | + } else { | |
| 249 | + $name = 'formidableforms.css'; | |
| 263 | 250 | } |
| 264 | 251 | |
| 265 | - return 'formidableforms.css'; | |
| 252 | + return $name; | |
| 266 | 253 | } |
| 267 | 254 | |
| 268 | - /** | |
| 269 | - * @param string $css_key | |
| 270 | - * @param string $version | |
| 271 | - * | |
| 272 | - * @return string | |
| 273 | - */ | |
| 274 | 255 | private static function get_css_version( $css_key, $version ) { |
| 275 | - if ( 'formidable' !== $css_key ) { | |
| 276 | - return $version; | |
| 256 | + if ( 'formidable' == $css_key ) { | |
| 257 | + $this_version = get_option( 'frm_last_style_update' ); | |
| 258 | + if ( ! $this_version ) { | |
| 259 | + $this_version = $version; | |
| 260 | + } | |
| 261 | + } else { | |
| 262 | + $this_version = $version; | |
| 277 | 263 | } |
| 278 | 264 | |
| 279 | - $this_version = get_option( 'frm_last_style_update' ); | |
| 280 | - | |
| 281 | - return $this_version ? $this_version : $version; | |
| 265 | + return $this_version; | |
| 282 | 266 | } |
| 283 | 267 | |
| 284 | 268 | /** |
| 285 | 269 | * @param string $tag |
| 286 | 270 | * @param string $handle |
| 287 | - * | |
| 288 | 271 | * @return string |
| 289 | 272 | */ |
| 290 | 273 | public static function add_tags_to_css( $tag, $handle ) { |
| 291 | - if ( ( 'formidable' === $handle || 'jquery-theme' === $handle ) && ! str_contains( $tag, ' property=' ) ) { | |
| 292 | - return str_replace( ' type="', ' property="stylesheet" type="', $tag ); | |
| 274 | + if ( ( 'formidable' === $handle || 'jquery-theme' === $handle ) && strpos( $tag, ' property=' ) === false ) { | |
| 275 | + $frm_settings = FrmAppHelper::get_settings(); | |
| 276 | + $tag = str_replace( ' type="', ' property="stylesheet" type="', $tag ); | |
| 293 | 277 | } |
| 294 | 278 | |
| 295 | 279 | return $tag; |
| 296 | 280 | } |
| @@ -338,11 +322,10 @@ | ||
| 338 | 322 | |
| 339 | 323 | self::setup_styles_and_scripts_for_styler(); |
| 340 | 324 | |
| 341 | 325 | $style_id = self::get_style_id_for_styler(); |
| 342 | - | |
| 343 | 326 | if ( ! $style_id ) { |
| 344 | - $error_args = array( | |
| 327 | + $error_args = array( | |
| 345 | 328 | 'title' => __( 'No styles', 'formidable' ), |
| 346 | 329 | 'body' => __( 'You must have a style to use the Visual Styler.', 'formidable' ), |
| 347 | 330 | 'cancel_url' => admin_url( 'admin.php?page=formidable' ), |
| 348 | 331 | ); |
| @@ -350,9 +333,8 @@ | ||
| 350 | 333 | return; |
| 351 | 334 | } |
| 352 | 335 | |
| 353 | 336 | $form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 ); |
| 354 | - | |
| 355 | 337 | if ( ! $form_id ) { |
| 356 | 338 | $form_id = self::get_form_id_for_style( $style_id ); |
| 357 | 339 | } |
| 358 | 340 | |
| @@ -358,9 +340,9 @@ | ||
| 358 | 340 | |
| 359 | 341 | $form = FrmForm::getOne( $form_id ); |
| 360 | 342 | |
| 361 | 343 | if ( ! is_object( $form ) ) { |
| 362 | - $error_args = array( | |
| 344 | + $error_args = array( | |
| 363 | 345 | 'title' => __( 'No forms', 'formidable' ), |
| 364 | 346 | 'body' => __( 'You must have a form to use the Visual Styler.', 'formidable' ), |
| 365 | 347 | 'cancel_url' => admin_url( 'admin.php?page=formidable' ), |
| 366 | 348 | ); |
| @@ -390,9 +372,8 @@ | ||
| 390 | 372 | * @return int |
| 391 | 373 | */ |
| 392 | 374 | private static function get_style_id_for_styler() { |
| 393 | 375 | $action = FrmAppHelper::simple_get( 'frm_action' ); |
| 394 | - | |
| 395 | 376 | if ( 'duplicate' === $action ) { |
| 396 | 377 | // The duplicate action uses style_id instead of id for better backward compatibility. |
| 397 | 378 | return FrmAppHelper::simple_get( 'style_id', 'absint', 0 ); |
| 398 | 379 | } |
| @@ -397,9 +378,8 @@ | ||
| 397 | 378 | return FrmAppHelper::simple_get( 'style_id', 'absint', 0 ); |
| 398 | 379 | } |
| 399 | 380 | |
| 400 | 381 | $style_id = FrmAppHelper::simple_get( 'id', 'absint', 0 ); |
| 401 | - | |
| 402 | 382 | if ( $style_id ) { |
| 403 | 383 | // Always use the style ID from the URL if one is specified. |
| 404 | 384 | return $style_id; |
| 405 | 385 | } |
| @@ -404,9 +384,8 @@ | ||
| 404 | 384 | return $style_id; |
| 405 | 385 | } |
| 406 | 386 | |
| 407 | 387 | $request_form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 ); |
| 408 | - | |
| 409 | 388 | if ( $request_form_id && is_callable( 'FrmProStylesController::get_active_style_for_form' ) ) { |
| 410 | 389 | return FrmProStylesController::get_active_style_for_form( $request_form_id )->ID; |
| 411 | 390 | } |
| 412 | 391 | |
| @@ -418,9 +397,8 @@ | ||
| 418 | 397 | * |
| 419 | 398 | * @since 6.0 |
| 420 | 399 | * |
| 421 | 400 | * @param int $style_id |
| 422 | - * | |
| 423 | 401 | * @return int |
| 424 | 402 | */ |
| 425 | 403 | private static function get_form_id_for_style( $style_id ) { |
| 426 | 404 | $check = serialize( array( 'custom_style' => (string) $style_id ) ); |
| @@ -433,8 +411,9 @@ | ||
| 433 | 411 | ) |
| 434 | 412 | ); |
| 435 | 413 | |
| 436 | 414 | if ( ! $form_id ) { |
| 415 | + // TODO: Show a message why a random form is being shown (because no form is assigned to the style). | |
| 437 | 416 | // Fallback to any form. |
| 438 | 417 | $where = array( |
| 439 | 418 | 'status' => 'published', |
| 440 | 419 | // Make sure it's not a repeater. |
| @@ -466,10 +445,11 @@ | ||
| 466 | 445 | * |
| 467 | 446 | * @return WP_Post |
| 468 | 447 | */ |
| 469 | 448 | private static function get_default_style() { |
| 470 | - $frm_style = new FrmStyle( 'default' ); | |
| 471 | - return $frm_style->get_one(); | |
| 449 | + $frm_style = new FrmStyle( 'default' ); | |
| 450 | + $default_style = $frm_style->get_one(); | |
| 451 | + return $default_style; | |
| 472 | 452 | } |
| 473 | 453 | |
| 474 | 454 | /** |
| 475 | 455 | * Save style for form (from Styler list page) via a POST action. |
| @@ -479,15 +459,13 @@ | ||
| 479 | 459 | * @return void |
| 480 | 460 | */ |
| 481 | 461 | private static function save_form_style() { |
| 482 | 462 | $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form_style', 'frm_save_form_style_nonce' ); |
| 483 | - | |
| 484 | 463 | if ( $permission_error !== false ) { |
| 485 | 464 | wp_die( 'Unable to save form', '', 403 ); |
| 486 | 465 | } |
| 487 | 466 | |
| 488 | 467 | $style_id = FrmAppHelper::get_post_param( 'style_id', 0, 'absint' ); |
| 489 | - | |
| 490 | 468 | if ( $style_id && ! self::confirm_style_exists_before_setting( $style_id ) ) { |
| 491 | 469 | wp_die( esc_html__( 'Invalid target style', 'formidable' ), esc_html__( 'Invalid target style', 'formidable' ), 400 ); |
| 492 | 470 | return; |
| 493 | 471 | } |
| @@ -507,9 +485,8 @@ | ||
| 507 | 485 | return; |
| 508 | 486 | } |
| 509 | 487 | |
| 510 | 488 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 511 | - | |
| 512 | 489 | if ( ! $form_id ) { |
| 513 | 490 | wp_die( esc_html__( 'No form specified', 'formidable' ), esc_html__( 'No form specified', 'formidable' ), 400 ); |
| 514 | 491 | return; |
| 515 | 492 | } |
| @@ -514,21 +491,17 @@ | ||
| 514 | 491 | return; |
| 515 | 492 | } |
| 516 | 493 | |
| 517 | 494 | $form = FrmForm::getOne( $form_id ); |
| 518 | - | |
| 519 | 495 | if ( ! $form ) { |
| 520 | 496 | wp_die( esc_html__( 'Form does not exist', 'formidable' ), esc_html__( 'Form does not exist', 'formidable' ), 400 ); |
| 521 | 497 | return; |
| 522 | 498 | } |
| 523 | 499 | |
| 524 | - $previous_style_id = $form->options['custom_style']; | |
| 525 | - | |
| 526 | 500 | // If the default style is selected, use the "Always use default" legacy option instead of the default style. |
| 527 | 501 | // There's also a check here for conversational forms. |
| 528 | 502 | // Without the check it isn't possible to select "Default" because "Always use default" will convert to "Lines" dynamically. |
| 529 | 503 | $default_style = self::get_default_style(); |
| 530 | - | |
| 531 | 504 | if ( $style_id === $default_style->ID && empty( $form->options['chat'] ) ) { |
| 532 | 505 | $style_id = 1; |
| 533 | 506 | } |
| 534 | 507 | |
| @@ -534,27 +507,13 @@ | ||
| 534 | 507 | |
| 535 | 508 | // We want to save a string for consistency. FrmStylesHelper::get_form_count_for_style expects the custom style ID is a string. |
| 536 | 509 | $form->options['custom_style'] = (string) $style_id; |
| 537 | 510 | |
| 538 | - if ( $previous_style_id === $form->options['custom_style'] ) { | |
| 539 | - // Exit early before updating DB if nothing actually changed. | |
| 540 | - self::$message = __( 'Successfully updated style.', 'formidable' ); | |
| 541 | - return; | |
| 542 | - } | |
| 543 | - | |
| 544 | 511 | global $wpdb; |
| 545 | 512 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 546 | 513 | |
| 547 | 514 | FrmForm::clear_form_cache(); |
| 548 | 515 | |
| 549 | - /** | |
| 550 | - * @since 6.25.1 | |
| 551 | - * | |
| 552 | - * @param int $form_id | |
| 553 | - * @param int $style_id | |
| 554 | - */ | |
| 555 | - do_action( 'frm_after_changed_form_style', absint( $form_id ), absint( $style_id ) ); | |
| 556 | - | |
| 557 | 516 | self::$message = __( 'Successfully updated style.', 'formidable' ); |
| 558 | 517 | } |
| 559 | 518 | |
| 560 | 519 | /** |
| @@ -560,9 +519,8 @@ | ||
| 560 | 519 | /** |
| 561 | 520 | * Validate that we're assigning a form to a style that actually exists before assigning it to a form. |
| 562 | 521 | * |
| 563 | 522 | * @param int $style_id |
| 564 | - * | |
| 565 | 523 | * @return bool True if the style actually exists. |
| 566 | 524 | */ |
| 567 | 525 | private static function confirm_style_exists_before_setting( $style_id ) { |
| 568 | 526 | global $wpdb; |
| @@ -602,9 +560,8 @@ | ||
| 602 | 560 | * |
| 603 | 561 | * @param stdClass|WP_Post $active_style |
| 604 | 562 | * @param stdClass $form |
| 605 | 563 | * @param WP_Post $default_style |
| 606 | - * | |
| 607 | 564 | * @return void |
| 608 | 565 | */ |
| 609 | 566 | private static function render_style_page( $active_style, $form, $default_style ) { |
| 610 | 567 | $style_views_path = self::get_views_path(); |
| @@ -679,9 +636,8 @@ | ||
| 679 | 636 | * |
| 680 | 637 | * @since 6.0 |
| 681 | 638 | * |
| 682 | 639 | * @param stdClass|WP_Post $style A new style is not a WP_Post object. |
| 683 | - * | |
| 684 | 640 | * @return void |
| 685 | 641 | */ |
| 686 | 642 | private static function force_form_style( $style ) { |
| 687 | 643 | add_filter( |
| @@ -692,9 +648,9 @@ | ||
| 692 | 648 | /** |
| 693 | 649 | * @param string $class |
| 694 | 650 | */ |
| 695 | 651 | function ( $class ) { |
| 696 | - return $class && ! str_starts_with( $class, 'frm_style_' ); | |
| 652 | + return $class && 0 !== strpos( $class, 'frm_style_' ); | |
| 697 | 653 | } |
| 698 | 654 | ); |
| 699 | 655 | $split[] = 'frm_style_' . $style->post_name; |
| 700 | 656 | return implode( ' ', $split ); |
| @@ -720,9 +676,8 @@ | ||
| 720 | 676 | return; |
| 721 | 677 | } |
| 722 | 678 | |
| 723 | 679 | $id = $frm_style->update( $post_id ); |
| 724 | - | |
| 725 | 680 | if ( ! $post_id && $id ) { |
| 726 | 681 | self::maybe_redirect_after_save( $id ); |
| 727 | 682 | // Set the post id to the new style so it will be loaded for editing. |
| 728 | 683 | $post_id = reset( $id ); |
| @@ -727,15 +682,8 @@ | ||
| 727 | 682 | // Set the post id to the new style so it will be loaded for editing. |
| 728 | 683 | $post_id = reset( $id ); |
| 729 | 684 | } |
| 730 | 685 | |
| 731 | - /** | |
| 732 | - * @since 6.25.1 | |
| 733 | - * | |
| 734 | - * @param int $post_id | |
| 735 | - */ | |
| 736 | - do_action( 'frm_after_saved_style', absint( $post_id ) ); | |
| 737 | - | |
| 738 | 686 | self::$message = __( 'Your styling settings have been saved.', 'formidable' ); |
| 739 | 687 | } |
| 740 | 688 | |
| 741 | 689 | /** |
| @@ -754,20 +702,19 @@ | ||
| 754 | 702 | * |
| 755 | 703 | * @since 6.0 |
| 756 | 704 | * |
| 757 | 705 | * @param array $ids |
| 758 | - * | |
| 759 | 706 | * @return void |
| 760 | 707 | */ |
| 761 | 708 | private static function maybe_redirect_after_save( $ids ) { |
| 762 | - $referer = FrmAppHelper::get_server_value( 'HTTP_REFERER' ); | |
| 763 | - $parsed = parse_url( $referer ); | |
| 764 | - $query = $parsed['query']; | |
| 709 | + $referer = FrmAppHelper::get_server_value( 'HTTP_REFERER' ); | |
| 710 | + $parsed = parse_url( $referer ); | |
| 711 | + $query = $parsed['query']; | |
| 712 | + | |
| 765 | 713 | $current_action = false; |
| 766 | 714 | $actions_to_redirect = array( 'duplicate', 'new_style' ); |
| 767 | - | |
| 768 | 715 | foreach ( $actions_to_redirect as $action ) { |
| 769 | - if ( str_contains( $query, 'frm_action=' . $action ) ) { | |
| 716 | + if ( false !== strpos( $query, 'frm_action=' . $action ) ) { | |
| 770 | 717 | $current_action = $action; |
| 771 | 718 | break; |
| 772 | 719 | } |
| 773 | 720 | } |
| @@ -777,9 +724,10 @@ | ||
| 777 | 724 | return; |
| 778 | 725 | } |
| 779 | 726 | |
| 780 | 727 | parse_str( $query, $parsed_query ); |
| 781 | - $form_id = ! empty( $parsed_query['form'] ) ? absint( $parsed_query['form'] ) : 0; | |
| 728 | + $form_id = ! empty( $parsed_query['form'] ) ? absint( $parsed_query['form'] ) : 0; | |
| 729 | + | |
| 782 | 730 | $style = new stdClass(); |
| 783 | 731 | $style->ID = end( $ids ); |
| 784 | 732 | wp_safe_redirect( esc_url_raw( FrmStylesHelper::get_edit_url( $style, $form_id ) ) ); |
| 785 | 733 | die(); |
| @@ -789,9 +737,8 @@ | ||
| 789 | 737 | * @since 6.0 |
| 790 | 738 | * |
| 791 | 739 | * @param string $message |
| 792 | 740 | * @param array|object $forms |
| 793 | - * | |
| 794 | 741 | * @return void |
| 795 | 742 | */ |
| 796 | 743 | public static function manage( $message = '', $forms = array() ) { |
| 797 | 744 | $frm_style = new FrmStyle(); |
| @@ -815,9 +762,8 @@ | ||
| 815 | 762 | private static function manage_styles() { |
| 816 | 763 | global $wpdb; |
| 817 | 764 | |
| 818 | 765 | $forms = FrmForm::get_published_forms(); |
| 819 | - | |
| 820 | 766 | foreach ( $forms as $form ) { |
| 821 | 767 | if ( ! isset( $_POST['style'] ) || ! isset( $_POST['style'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 822 | 768 | continue; |
| 823 | 769 | } |
| @@ -833,28 +779,15 @@ | ||
| 833 | 779 | /** |
| 834 | 780 | * Echo content for the Custom CSS page. |
| 835 | 781 | * |
| 836 | 782 | * @param string $message |
| 837 | - * @param array $extra_args An array of extra arguments. | |
| 838 | - * | |
| 839 | 783 | * @return void |
| 840 | 784 | */ |
| 841 | - public static function custom_css( $message = '', $extra_args = array() ) { | |
| 842 | - $id = $extra_args['id'] ?? 'frm_codemirror_box'; | |
| 843 | - $settings = self::enqueue_codemirror( $id, $extra_args['placeholder'] ?? '' ); | |
| 844 | - $id = $settings ? $id : 'frm_custom_css_box'; | |
| 845 | - $show_errors = $extra_args['show_errors'] ?? true; | |
| 846 | - $custom_css = $extra_args['custom_css'] ?? self::get_custom_css(); | |
| 847 | - $heading = $extra_args['heading'] ?? __( 'You can add custom css here or in your theme style.css. Any CSS added here will be used anywhere the Formidable CSS is loaded.', 'formidable' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 848 | - $textarea_params = ! empty( $extra_args['textarea_params'] ) ? $extra_args['textarea_params'] : array( | |
| 849 | - 'name' => 'frm_custom_css', | |
| 850 | - 'id' => $id, | |
| 851 | - ); | |
| 785 | + public static function custom_css( $message = '' ) { | |
| 786 | + $settings = self::enqueue_codemirror(); | |
| 787 | + $id = $settings ? 'frm_codemirror_box' : 'frm_custom_css_box'; | |
| 788 | + $custom_css = self::get_custom_css(); | |
| 852 | 789 | |
| 853 | - if ( $settings ) { | |
| 854 | - $textarea_params['class'] = 'hide-if-js'; | |
| 855 | - } | |
| 856 | - | |
| 857 | 790 | include FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php'; |
| 858 | 791 | } |
| 859 | 792 | |
| 860 | 793 | /** |
| @@ -861,33 +794,22 @@ | ||
| 861 | 794 | * Get custom CSS code entered in the Custom CSS page. |
| 862 | 795 | * |
| 863 | 796 | * @since 6.0 |
| 864 | 797 | * |
| 865 | - * @param array|null $single_style_settings The single style settings. | |
| 866 | - * | |
| 867 | 798 | * @return string |
| 868 | 799 | */ |
| 869 | - public static function get_custom_css( $single_style_settings = null ) { | |
| 870 | - if ( $single_style_settings ) { | |
| 871 | - // If the single style settings are passed, return the custom CSS from the single style settings. | |
| 872 | - if ( ! empty( $single_style_settings['single_style_custom_css'] ) && ! empty( $single_style_settings['enable_style_custom_css'] ) ) { | |
| 873 | - return $single_style_settings['single_style_custom_css']; | |
| 874 | - } | |
| 875 | - | |
| 876 | - return ''; | |
| 877 | - } | |
| 878 | - | |
| 800 | + public static function get_custom_css() { | |
| 879 | 801 | $settings = FrmAppHelper::get_settings(); |
| 880 | - | |
| 881 | 802 | if ( is_string( $settings->custom_css ) ) { |
| 882 | 803 | return $settings->custom_css; |
| 883 | 804 | } |
| 884 | 805 | |
| 885 | 806 | // If it does not exist, check the default style as a fallback. |
| 886 | - $frm_style = new FrmStyle(); | |
| 887 | - $style = $frm_style->get_default_style(); | |
| 807 | + $frm_style = new FrmStyle(); | |
| 808 | + $style = $frm_style->get_default_style(); | |
| 809 | + $custom_css = $style->post_content['custom_css']; | |
| 888 | 810 | |
| 889 | - return $style->post_content['custom_css']; | |
| 811 | + return $custom_css; | |
| 890 | 812 | } |
| 891 | 813 | |
| 892 | 814 | /** |
| 893 | 815 | * Enqueue assets for codemirror, built into WordPress since 4.9. |
| @@ -894,14 +816,11 @@ | ||
| 894 | 816 | * The Custom CSS page uses codemirror. |
| 895 | 817 | * |
| 896 | 818 | * @since 6.0 Previously this code was embedded in self::custom_css. |
| 897 | 819 | * |
| 898 | - * @param string $id The ID of the codemirror box. | |
| 899 | - * @param string $placeholder The placeholder text for the codemirror box. | |
| 900 | - * | |
| 901 | 820 | * @return array|false |
| 902 | 821 | */ |
| 903 | - private static function enqueue_codemirror( $id = 'frm_codemirror_box', $placeholder = '' ) { | |
| 822 | + private static function enqueue_codemirror() { | |
| 904 | 823 | if ( ! function_exists( 'wp_enqueue_code_editor' ) ) { |
| 905 | 824 | // The WordPress version is likely older than 4.9. |
| 906 | 825 | return false; |
| 907 | 826 | } |
| @@ -914,9 +833,8 @@ | ||
| 914 | 833 | 'tabSize' => 2, |
| 915 | 834 | // As the codemirror box only appears once you click into the Custom CSS tab, we need to auto-refresh. |
| 916 | 835 | // Otherwise the line numbers all end up with a 1px width causing overlap issues with the text in the content. |
| 917 | 836 | 'autoRefresh' => true, |
| 918 | - 'placeholder' => $placeholder, | |
| 919 | 837 | ), |
| 920 | 838 | ) |
| 921 | 839 | ); |
| 922 | 840 | |
| @@ -923,11 +841,9 @@ | ||
| 923 | 841 | if ( $settings ) { |
| 924 | 842 | wp_add_inline_script( |
| 925 | 843 | 'code-editor', |
| 926 | 844 | sprintf( |
| 927 | - 'jQuery( function() { window.%s_wp_editor = wp.codeEditor.initialize( \'%s\', %s ); } );', | |
| 928 | - $id, | |
| 929 | - $id, | |
| 845 | + 'jQuery( function() { wp.codeEditor.initialize( \'frm_codemirror_box\', %s ); } );', | |
| 930 | 846 | wp_json_encode( $settings ) |
| 931 | 847 | ) |
| 932 | 848 | ); |
| 933 | 849 | } |
| @@ -979,9 +895,8 @@ | ||
| 979 | 895 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 980 | 896 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 981 | 897 | |
| 982 | 898 | $style_id = FrmAppHelper::get_post_param( 'style_id', '', 'absint' ); |
| 983 | - | |
| 984 | 899 | if ( ! $style_id ) { |
| 985 | 900 | // A style ID is not sent when resetting on the edit page. |
| 986 | 901 | // Instead of resetting the style, send the defaults back so the inputs can be updated with JavaScript. |
| 987 | 902 | $frm_style = new FrmStyle(); |
| @@ -1040,9 +955,9 @@ | ||
| 1040 | 955 | /** |
| 1041 | 956 | * @return void |
| 1042 | 957 | */ |
| 1043 | 958 | public static function add_meta_boxes() { |
| 1044 | - // Setup meta boxes | |
| 959 | + // setup meta boxes | |
| 1045 | 960 | $meta_boxes = array( |
| 1046 | 961 | 'general' => __( 'General', 'formidable' ), |
| 1047 | 962 | 'form-title' => __( 'Form Title', 'formidable' ), |
| 1048 | 963 | 'form-description' => __( 'Form Description', 'formidable' ), |
| @@ -1072,9 +987,8 @@ | ||
| 1072 | 987 | |
| 1073 | 988 | /** |
| 1074 | 989 | * @param array $atts |
| 1075 | 990 | * @param array $sec |
| 1076 | - * | |
| 1077 | 991 | * @return void |
| 1078 | 992 | */ |
| 1079 | 993 | public static function include_style_section( $atts, $sec ) { |
| 1080 | 994 | extract( $atts ); // phpcs:ignore WordPress.PHP.DontExtract |
| @@ -1145,10 +1059,9 @@ | ||
| 1145 | 1059 | * @return void |
| 1146 | 1060 | */ |
| 1147 | 1061 | public static function maybe_hide_sample_form_error_message() { |
| 1148 | 1062 | $referer = FrmAppHelper::get_server_value( 'HTTP_REFERER' ); |
| 1149 | - | |
| 1150 | - if ( str_contains( $referer, 'admin.php?page=formidable-styles' ) ) { | |
| 1063 | + if ( false !== strpos( $referer, 'admin.php?page=formidable-styles' ) ) { | |
| 1151 | 1064 | echo '#frm_broken_styles_warning { display: none; }'; |
| 1152 | 1065 | } |
| 1153 | 1066 | } |
| 1154 | 1067 | |
| @@ -1157,9 +1070,8 @@ | ||
| 1157 | 1070 | * |
| 1158 | 1071 | * @since 4.11.03 |
| 1159 | 1072 | * |
| 1160 | 1073 | * @param string $css CSS content. |
| 1161 | - * | |
| 1162 | 1074 | * @return string |
| 1163 | 1075 | */ |
| 1164 | 1076 | public static function replace_relative_url( $css ) { |
| 1165 | 1077 | $plugin_url = trailingslashit( FrmAppHelper::plugin_url() ); |
| @@ -1182,27 +1094,22 @@ | ||
| 1182 | 1094 | * Check if the Formidable styling should be loaded, |
| 1183 | 1095 | * then enqueue it for the footer |
| 1184 | 1096 | * |
| 1185 | 1097 | * @since 2.0 |
| 1186 | - * | |
| 1187 | - * @return void | |
| 1188 | 1098 | */ |
| 1189 | 1099 | public static function enqueue_style() { |
| 1190 | 1100 | global $frm_vars; |
| 1191 | 1101 | |
| 1192 | - if ( ! empty( $frm_vars['css_loaded'] ) ) { | |
| 1102 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { | |
| 1193 | 1103 | // The CSS has already been loaded. |
| 1194 | 1104 | return; |
| 1195 | 1105 | } |
| 1196 | 1106 | |
| 1197 | 1107 | $frm_settings = FrmAppHelper::get_settings(); |
| 1198 | - | |
| 1199 | - if ( $frm_settings->load_style === 'none' ) { | |
| 1200 | - return; | |
| 1108 | + if ( $frm_settings->load_style !== 'none' ) { | |
| 1109 | + wp_enqueue_style( 'formidable' ); | |
| 1110 | + $frm_vars['css_loaded'] = true; | |
| 1201 | 1111 | } |
| 1202 | - | |
| 1203 | - wp_enqueue_style( 'formidable' ); | |
| 1204 | - $frm_vars['css_loaded'] = true; | |
| 1205 | 1112 | } |
| 1206 | 1113 | |
| 1207 | 1114 | /** |
| 1208 | 1115 | * Get the stylesheets for the form settings page |
| @@ -1210,9 +1117,11 @@ | ||
| 1210 | 1117 | * @return array<WP_Post> |
| 1211 | 1118 | */ |
| 1212 | 1119 | public static function get_style_opts() { |
| 1213 | 1120 | $frm_style = new FrmStyle(); |
| 1214 | - return $frm_style->get_all(); | |
| 1121 | + $styles = $frm_style->get_all(); | |
| 1122 | + | |
| 1123 | + return $styles; | |
| 1215 | 1124 | } |
| 1216 | 1125 | |
| 1217 | 1126 | /** |
| 1218 | 1127 | * Get the style post object for a target form. |
| @@ -1217,16 +1126,14 @@ | ||
| 1217 | 1126 | /** |
| 1218 | 1127 | * Get the style post object for a target form. |
| 1219 | 1128 | * |
| 1220 | 1129 | * @param bool|object|string $form |
| 1221 | - * | |
| 1222 | 1130 | * @return WP_Post|null |
| 1223 | 1131 | */ |
| 1224 | 1132 | public static function get_form_style( $form = 'default' ) { |
| 1225 | 1133 | $style = FrmFormsHelper::get_form_style( $form ); |
| 1226 | 1134 | |
| 1227 | - // phpcs:ignore Universal.Operators.StrictComparisons | |
| 1228 | - if ( ! $style || 1 == $style ) { | |
| 1135 | + if ( empty( $style ) || 1 == $style ) { | |
| 1229 | 1136 | $style = 'default'; |
| 1230 | 1137 | } |
| 1231 | 1138 | |
| 1232 | 1139 | $frm_style = new FrmStyle( $style ); |
| @@ -1235,13 +1142,10 @@ | ||
| 1235 | 1142 | |
| 1236 | 1143 | /** |
| 1237 | 1144 | * @param string $class |
| 1238 | 1145 | * @param string $style |
| 1239 | - * | |
| 1240 | - * @return string | |
| 1241 | 1146 | */ |
| 1242 | 1147 | public static function get_form_style_class( $class, $style ) { |
| 1243 | - // phpcs:ignore Universal.Operators.StrictComparisons | |
| 1244 | 1148 | if ( 1 == $style ) { |
| 1245 | 1149 | $style = 'default'; |
| 1246 | 1150 | } |
| 1247 | 1151 | |
| @@ -1257,17 +1161,13 @@ | ||
| 1257 | 1161 | } |
| 1258 | 1162 | |
| 1259 | 1163 | /** |
| 1260 | 1164 | * @since 3.0 |
| 1261 | - * | |
| 1262 | 1165 | * @param object $style |
| 1263 | 1166 | * @param string $class |
| 1264 | - * | |
| 1265 | - * @return void | |
| 1266 | 1167 | */ |
| 1267 | 1168 | private static function maybe_add_rtl_class( $style, &$class ) { |
| 1268 | 1169 | $is_rtl = isset( $style->post_content['direction'] ) && 'rtl' === $style->post_content['direction']; |
| 1269 | - | |
| 1270 | 1170 | if ( $is_rtl ) { |
| 1271 | 1171 | $class .= ' frm_rtl'; |
| 1272 | 1172 | } |
| 1273 | 1173 | } |
| @@ -1272,28 +1172,17 @@ | ||
| 1272 | 1172 | } |
| 1273 | 1173 | } |
| 1274 | 1174 | |
| 1275 | 1175 | /** |
| 1276 | - * @param string $val Style setting key. | |
| 1277 | - * @param int|string $form Form ID or 'default'. | |
| 1278 | - * | |
| 1279 | - * @return mixed | |
| 1176 | + * @param string $val | |
| 1280 | 1177 | */ |
| 1281 | 1178 | public static function get_style_val( $val, $form = 'default' ) { |
| 1282 | 1179 | $style = self::get_form_style( $form ); |
| 1283 | - | |
| 1284 | 1180 | if ( $style && isset( $style->post_content[ $val ] ) ) { |
| 1285 | 1181 | return $style->post_content[ $val ]; |
| 1286 | 1182 | } |
| 1287 | - | |
| 1288 | - return null; | |
| 1289 | 1183 | } |
| 1290 | 1184 | |
| 1291 | - /** | |
| 1292 | - * @param array $default_styles | |
| 1293 | - * | |
| 1294 | - * @return array | |
| 1295 | - */ | |
| 1296 | 1185 | public static function show_entry_styles( $default_styles ) { |
| 1297 | 1186 | $frm_style = new FrmStyle( 'default' ); |
| 1298 | 1187 | $style = $frm_style->get_one(); |
| 1299 | 1188 | |
| @@ -1302,15 +1191,13 @@ | ||
| 1302 | 1191 | } |
| 1303 | 1192 | |
| 1304 | 1193 | foreach ( $default_styles as $name => $val ) { |
| 1305 | 1194 | $setting = $name; |
| 1306 | - | |
| 1307 | - if ( 'border_width' === $name ) { | |
| 1195 | + if ( 'border_width' == $name ) { | |
| 1308 | 1196 | $setting = 'field_border_width'; |
| 1309 | - } elseif ( 'alt_bg_color' === $name ) { | |
| 1197 | + } elseif ( 'alt_bg_color' == $name ) { | |
| 1310 | 1198 | $setting = 'bg_color_active'; |
| 1311 | 1199 | } |
| 1312 | - | |
| 1313 | 1200 | $default_styles[ $name ] = $style->post_content[ $setting ]; |
| 1314 | 1201 | unset( $name, $val ); |
| 1315 | 1202 | } |
| 1316 | 1203 | |
| @@ -1316,16 +1203,12 @@ | ||
| 1316 | 1203 | |
| 1317 | 1204 | return $default_styles; |
| 1318 | 1205 | } |
| 1319 | 1206 | |
| 1320 | - /** | |
| 1321 | - * @param string $important | |
| 1322 | - * @param array $field | |
| 1323 | - * | |
| 1324 | - * @return string | |
| 1325 | - */ | |
| 1326 | - public static function important_style( $important, $field ) { | |
| 1327 | - return self::get_style_val( 'important_style', $field['form_id'] ); | |
| 1207 | + public static function &important_style( $important, $field ) { | |
| 1208 | + $important = self::get_style_val( 'important_style', $field['form_id'] ); | |
| 1209 | + | |
| 1210 | + return $important; | |
| 1328 | 1211 | } |
| 1329 | 1212 | |
| 1330 | 1213 | /** |
| 1331 | 1214 | * Duplicate of WordPress do_accordion_section function, it adds an additional svg icon support. |
| @@ -1331,18 +1214,14 @@ | ||
| 1331 | 1214 | * Duplicate of WordPress do_accordion_section function, it adds an additional svg icon support. |
| 1332 | 1215 | * |
| 1333 | 1216 | * @since 6.8.3 |
| 1334 | 1217 | * |
| 1335 | - * @param string|WP_Screen $screen Screen ID or screen object. | |
| 1336 | - * @param string $context Meta box context. | |
| 1337 | - * @param mixed $data_object Data object passed to callbacks. | |
| 1338 | - * | |
| 1339 | 1218 | * @return int |
| 1340 | 1219 | */ |
| 1341 | - public static function do_accordion_sections( $screen, $context, $data_object ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh | |
| 1220 | + public static function do_accordion_sections( $screen, $context, $data_object ) { | |
| 1342 | 1221 | global $wp_meta_boxes; |
| 1343 | 1222 | |
| 1344 | - // The symbol id from icons.svg | |
| 1223 | + // the symbol id from icons.svg | |
| 1345 | 1224 | $icon_ids = array( |
| 1346 | 1225 | 'ranking-fields-style' => 'frm_chart_bar_icon', |
| 1347 | 1226 | 'section-fields-style' => 'frm-form-title-style', |
| 1348 | 1227 | ); |
| @@ -1348,9 +1227,9 @@ | ||
| 1348 | 1227 | ); |
| 1349 | 1228 | |
| 1350 | 1229 | wp_enqueue_script( 'accordion' ); |
| 1351 | 1230 | |
| 1352 | - if ( ! $screen ) { | |
| 1231 | + if ( empty( $screen ) ) { | |
| 1353 | 1232 | $screen = get_current_screen(); |
| 1354 | 1233 | } elseif ( is_string( $screen ) ) { |
| 1355 | 1234 | $screen = convert_to_screen( $screen ); |
| 1356 | 1235 | } |
| @@ -1356,9 +1235,8 @@ | ||
| 1356 | 1235 | } |
| 1357 | 1236 | |
| 1358 | 1237 | $page = $screen->id; |
| 1359 | 1238 | |
| 1360 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 1361 | 1239 | ?> |
| 1362 | 1240 | <div id="side-sortables" class="accordion-container"> |
| 1363 | 1241 | <ul class="outer-border"> |
| 1364 | 1242 | <?php |
| @@ -1366,46 +1244,46 @@ | ||
| 1366 | 1244 | $first_open = false; |
| 1367 | 1245 | |
| 1368 | 1246 | if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
| 1369 | 1247 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
| 1370 | - if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { | |
| 1371 | - continue; | |
| 1372 | - } | |
| 1248 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { | |
| 1249 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { | |
| 1250 | + if ( false === $box || ! $box['title'] ) { | |
| 1251 | + continue; | |
| 1252 | + } | |
| 1373 | 1253 | |
| 1374 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { | |
| 1375 | - if ( false === $box || ! $box['title'] ) { | |
| 1376 | - continue; | |
| 1377 | - } | |
| 1254 | + ++$i; | |
| 1255 | + $icon_id = array_key_exists( $box['id'], $icon_ids ) ? $icon_ids[ $box['id'] ] : 'frm-' . $box['id']; | |
| 1378 | 1256 | |
| 1379 | - ++$i; | |
| 1380 | - $icon_id = array_key_exists( $box['id'], $icon_ids ) ? $icon_ids[ $box['id'] ] : 'frm-' . $box['id']; | |
| 1381 | - $open_class = ''; | |
| 1257 | + $open_class = ''; | |
| 1258 | + if ( ! $first_open ) { | |
| 1259 | + $first_open = true; | |
| 1260 | + $open_class = 'open'; | |
| 1261 | + } | |
| 1382 | 1262 | |
| 1383 | - if ( ! $first_open ) { | |
| 1384 | - $first_open = true; | |
| 1385 | - $open_class = 'open'; | |
| 1386 | - } | |
| 1387 | - | |
| 1388 | - $accordion_content_id = 'frm_style_section_' . $box['id']; | |
| 1389 | - ?> | |
| 1390 | - <li class="control-section accordion-section <?php echo esc_attr( $open_class ); ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 1391 | - <h3 class="accordion-section-title hndle"> | |
| 1392 | - <?php | |
| 1393 | - FrmAppHelper::icon_by_class( 'frmfont ' . $icon_id . ' frm_svg24' ); | |
| 1394 | - echo esc_html( $box['title'] ); | |
| 1395 | - ?> | |
| 1396 | - <button type="button" aria-expanded="<?php echo esc_attr( 'open' === $open_class ? 'true' : 'false' ); ?>" aria-controls="<?php echo esc_attr( $accordion_content_id ); ?>" aria-label="<?php echo esc_attr( $box['title'] ); ?>"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 1397 | - <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon' ); ?> | |
| 1398 | - </button> | |
| 1399 | - </h3> | |
| 1400 | - <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>" id="<?php echo esc_attr( $accordion_content_id ); ?>"> | |
| 1401 | - <div class="inside"> | |
| 1402 | - <?php call_user_func( $box['callback'], $data_object, $box ); ?> | |
| 1403 | - </div><!-- .inside --> | |
| 1404 | - </div><!-- .accordion-section-content --> | |
| 1405 | - </li><!-- .accordion-section --> | |
| 1406 | - <?php | |
| 1407 | - }//end foreach | |
| 1263 | + $accordion_content_id = 'frm_style_section_' . $box['id']; | |
| 1264 | + ?> | |
| 1265 | + <li class="control-section accordion-section <?php echo esc_attr( $open_class ); ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>"> | |
| 1266 | + <h3 class="accordion-section-title hndle"> | |
| 1267 | + <?php | |
| 1268 | + FrmAppHelper::icon_by_class( 'frmfont ' . $icon_id ); | |
| 1269 | + echo esc_html( $box['title'] ); | |
| 1270 | + ?> | |
| 1271 | + <button type="button" aria-expanded="<?php echo esc_attr( 'open' === $open_class ? 'true' : 'false' ); ?>" aria-controls="<?php echo esc_attr( $accordion_content_id ); ?>" aria-label="<?php echo esc_attr( $box['title'] ); ?>"> | |
| 1272 | + <?php | |
| 1273 | + FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon' ); | |
| 1274 | + ?> | |
| 1275 | + </button> | |
| 1276 | + </h3> | |
| 1277 | + <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>" id="<?php echo esc_attr( $accordion_content_id ); ?>"> | |
| 1278 | + <div class="inside"> | |
| 1279 | + <?php call_user_func( $box['callback'], $data_object, $box ); ?> | |
| 1280 | + </div><!-- .inside --> | |
| 1281 | + </div><!-- .accordion-section-content --> | |
| 1282 | + </li><!-- .accordion-section --> | |
| 1283 | + <?php | |
| 1284 | + }//end foreach | |
| 1285 | + }//end if | |
| 1408 | 1286 | }//end foreach |
| 1409 | 1287 | }//end if |
| 1410 | 1288 | ?> |
| 1411 | 1289 | </ul><!-- .outer-border --> |
| @@ -1410,9 +1288,8 @@ | ||
| 1410 | 1288 | ?> |
| 1411 | 1289 | </ul><!-- .outer-border --> |
| 1412 | 1290 | </div><!-- .accordion-container --> |
| 1413 | 1291 | <?php |
| 1414 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 1415 | 1292 | return $i; |
| 1416 | 1293 | } |
| 1417 | 1294 | |
| 1418 | 1295 | /** |
| @@ -1423,9 +1300,8 @@ | ||
| 1423 | 1300 | * @return void |
| 1424 | 1301 | */ |
| 1425 | 1302 | public static function rename_style() { |
| 1426 | 1303 | $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'nonce', 'frm_ajax' ); |
| 1427 | - | |
| 1428 | 1304 | if ( $permission_error !== false ) { |
| 1429 | 1305 | $data = array( |
| 1430 | 1306 | 'message' => __( 'Unable to rename style', 'formidable' ), |
| 1431 | 1307 | ); |
| @@ -1444,9 +1320,8 @@ | ||
| 1444 | 1320 | die(); |
| 1445 | 1321 | } |
| 1446 | 1322 | |
| 1447 | 1323 | $post = get_post( $style_id ); |
| 1448 | - | |
| 1449 | 1324 | if ( ! $post || $post->post_type !== self::$post_type ) { |
| 1450 | 1325 | $data = array( |
| 1451 | 1326 | 'message' => __( 'The style you are renaming either does not exist or it is not a style', 'formidable' ), |
| 1452 | 1327 | ); |
| @@ -1467,9 +1342,8 @@ | ||
| 1467 | 1342 | * |
| 1468 | 1343 | * @since 6.0 |
| 1469 | 1344 | * |
| 1470 | 1345 | * @param WP_Styles $styles |
| 1471 | - * | |
| 1472 | 1346 | * @return void |
| 1473 | 1347 | */ |
| 1474 | 1348 | public static function disable_conflicting_wp_admin_css( $styles ) { |
| 1475 | 1349 | if ( ! FrmAppHelper::is_style_editor_page() ) { |