| @@ -47,8 +47,15 @@ | ||
| 47 | 47 | add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
| 48 | 48 | add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** | |
| 52 | + * Runs on admin head of the formidable forms page. | |
| 53 | + * | |
| 54 | + * @since 6.32 This adds screen options. | |
| 55 | + * | |
| 56 | + * @return void | |
| 57 | + */ | |
| 51 | 58 | public static function head() { |
| 52 | 59 | if ( wp_is_mobile() ) { |
| 53 | 60 | wp_enqueue_script( 'jquery-touch-punch' ); |
| 54 | 61 | } |
| @@ -266,9 +273,9 @@ | ||
| 266 | 273 | } |
| 267 | 274 | |
| 268 | 275 | do_action( 'frm_before_update_form_settings', $id ); |
| 269 | 276 | |
| 270 | - $antispam_was_on = self::antispam_was_on( $id ); | |
| 277 | + $antispam_was_on = self::antispam_was_on( $id ); // phpcs:ignore Formidable.CodeAnalysis.InlineSingleUseVariable | |
| 271 | 278 | |
| 272 | 279 | FrmForm::update( $id, $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 273 | 280 | |
| 274 | 281 | $antispam_is_on = ! empty( $_POST['options']['antispam'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| @@ -276,8 +283,12 @@ | ||
| 276 | 283 | if ( $antispam_is_on !== $antispam_was_on ) { |
| 277 | 284 | FrmAntiSpam::clear_caches(); |
| 278 | 285 | } |
| 279 | 286 | |
| 287 | + // Handle captcha field inclusion | |
| 288 | + $include_captcha = isset( $_POST['frm_include_captcha'] ) && '1' === $_POST['frm_include_captcha']; // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 289 | + self::handle_captcha_field( $id, $include_captcha ); | |
| 290 | + | |
| 280 | 291 | $message = __( 'Settings Successfully Updated', 'formidable' ); |
| 281 | 292 | |
| 282 | 293 | self::get_settings_vars( $id, array(), compact( 'message', 'warnings' ) ); |
| 283 | 294 | } |
| @@ -292,8 +303,46 @@ | ||
| 292 | 303 | return ! empty( $form->options['antispam'] ); |
| 293 | 304 | } |
| 294 | 305 | |
| 295 | 306 | /** |
| 307 | + * Handle captcha field inclusion in form | |
| 308 | + * | |
| 309 | + * @since 6.33 | |
| 310 | + * | |
| 311 | + * @param int $form_id Form ID. | |
| 312 | + * @param bool $include_captcha Whether to include captcha field. | |
| 313 | + * | |
| 314 | + * @return void | |
| 315 | + */ | |
| 316 | + private static function handle_captcha_field( $form_id, $include_captcha ) { | |
| 317 | + $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude' ); | |
| 318 | + $captcha_field_id = 0; | |
| 319 | + $submit_field_order = 0; | |
| 320 | + | |
| 321 | + foreach ( $form_fields as $field ) { | |
| 322 | + if ( 'captcha' === $field->type ) { | |
| 323 | + $captcha_field_id = $field->id; | |
| 324 | + break; | |
| 325 | + } | |
| 326 | + | |
| 327 | + if ( 'submit' === $field->type ) { | |
| 328 | + $submit_field_order = $field->field_order; | |
| 329 | + } | |
| 330 | + } | |
| 331 | + | |
| 332 | + if ( $include_captcha && ! $captcha_field_id ) { | |
| 333 | + // Create captcha field just before submit button | |
| 334 | + $field_values = FrmFieldsHelper::setup_new_vars( 'captcha', $form_id ); | |
| 335 | + $field_values['name'] = __( 'Captcha', 'formidable' ); | |
| 336 | + $field_values['field_order'] = $submit_field_order > 0 ? $submit_field_order - 1 : 0; | |
| 337 | + FrmField::create( $field_values ); | |
| 338 | + } elseif ( ! $include_captcha && $captcha_field_id ) { | |
| 339 | + // Delete captcha field | |
| 340 | + FrmField::destroy( $captcha_field_id ); | |
| 341 | + } | |
| 342 | + } | |
| 343 | + | |
| 344 | + /** | |
| 296 | 345 | * @param array $values |
| 297 | 346 | * |
| 298 | 347 | * @return void |
| 299 | 348 | */ |
| @@ -1072,11 +1121,10 @@ | ||
| 1072 | 1121 | // Button is inserted once per HTML field. |
| 1073 | 1122 | // In a form with 66 HTML fields, this saves 0.5 seconds on page load time, tested locally. |
| 1074 | 1123 | if ( ! isset( self::$formidable_tinymce_button ) ) { |
| 1075 | 1124 | FrmAppHelper::load_admin_wide_js(); |
| 1076 | - $menu_name = FrmAppHelper::get_menu_name(); | |
| 1077 | 1125 | $icon = apply_filters( 'frm_media_icon', FrmAppHelper::svg_logo() ); |
| 1078 | - self::$formidable_tinymce_button = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '">' . FrmAppHelper::kses( $icon, 'all' ) . ' ' . esc_html( $menu_name ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 1126 | + self::$formidable_tinymce_button = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '">' . FrmAppHelper::kses( $icon, 'all' ) . ' ' . esc_html( FrmAppHelper::get_menu_name() ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 1079 | 1127 | } |
| 1080 | 1128 | echo self::$formidable_tinymce_button; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1081 | 1129 | } |
| 1082 | 1130 | |
| @@ -1233,17 +1281,27 @@ | ||
| 1233 | 1281 | public static function get_columns( $columns ) { |
| 1234 | 1282 | $columns['cb'] = '<input type="checkbox" />'; |
| 1235 | 1283 | $columns['name'] = esc_html__( 'Form Title', 'formidable' ); |
| 1236 | 1284 | $columns['entries'] = esc_html__( 'Entries', 'formidable' ); |
| 1285 | + $columns['views'] = esc_html__( 'Views', 'formidable' ); | |
| 1237 | 1286 | $columns['id'] = 'ID'; |
| 1238 | 1287 | $columns['form_key'] = esc_html__( 'Key', 'formidable' ); |
| 1239 | 1288 | |
| 1240 | - if ( 'trash' !== FrmAppHelper::simple_get( 'form_type' ) ) { | |
| 1289 | + if ( 'trash' !== FrmAppHelper::simple_get( 'form_type' ) && has_filter( 'frm_form_list_actions' ) ) { | |
| 1290 | + // If there is any filters added, keep this column. | |
| 1241 | 1291 | $columns['shortcode'] = esc_html__( 'Actions', 'formidable' ); |
| 1242 | 1292 | } |
| 1243 | 1293 | |
| 1244 | 1294 | $columns['created_at'] = esc_html__( 'Date', 'formidable' ); |
| 1245 | 1295 | |
| 1296 | + if ( 'trash' !== FrmAppHelper::simple_get( 'form_type' ) ) { | |
| 1297 | + $columns['embeds'] = esc_html__( 'Embeds', 'formidable' ); | |
| 1298 | + $columns['settings'] = '<div class="frm-forms-list-settings-btn-wrapper"><a href="#" class="frm-forms-list-settings-btn">'; | |
| 1299 | + $columns['settings'] .= FrmAppHelper::icon_by_class( 'frmfont frm_settings_icon', array( 'echo' => false ) ); | |
| 1300 | + $columns['settings'] .= '<span class="screen-reader-text">' . esc_html__( 'List settings', 'formidable' ) . '</span>'; | |
| 1301 | + $columns['settings'] .= '</a></div>'; | |
| 1302 | + } | |
| 1303 | + | |
| 1246 | 1304 | add_screen_option( |
| 1247 | 1305 | 'per_page', |
| 1248 | 1306 | array( |
| 1249 | 1307 | 'label' => __( 'Forms', 'formidable' ), |
| @@ -1521,19 +1579,24 @@ | ||
| 1521 | 1579 | 'advanced' => array( |
| 1522 | 1580 | 'name' => __( 'General', 'formidable' ), |
| 1523 | 1581 | 'title' => __( 'General Form Settings', 'formidable' ), |
| 1524 | 1582 | 'function' => array( self::class, 'advanced_settings' ), |
| 1525 | - 'icon' => 'frmfont frm_settings_icon', | |
| 1583 | + 'icon' => 'frmfont frm_small_settings_icon', | |
| 1526 | 1584 | ), |
| 1527 | 1585 | 'email' => array( |
| 1528 | 1586 | 'name' => __( 'Actions & Notifications', 'formidable' ), |
| 1529 | 1587 | 'function' => array( 'FrmFormActionsController', 'email_settings' ), |
| 1530 | 1588 | 'id' => 'frm_notification_settings', |
| 1531 | - 'icon' => 'frmfont frm_mail_bulk_icon', | |
| 1589 | + 'icon' => 'frmfont frm_notification_check_icon', | |
| 1532 | 1590 | ), |
| 1591 | + 'spam' => array( | |
| 1592 | + 'name' => __( 'Spam', 'formidable' ), | |
| 1593 | + 'function' => array( self::class, 'spam_settings' ), | |
| 1594 | + 'icon' => 'frmfont frm_shield_check2_icon', | |
| 1595 | + ), | |
| 1533 | 1596 | 'permissions' => array( |
| 1534 | 1597 | 'name' => __( 'Form Permissions', 'formidable' ), |
| 1535 | - 'icon' => 'frmfont frm_lock_closed_icon', | |
| 1598 | + 'icon' => 'frmfont frm_lock_closed2_icon', | |
| 1536 | 1599 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 1537 | 1600 | 'data' => array( |
| 1538 | 1601 | 'medium' => 'permissions', |
| 1539 | 1602 | 'upgrade' => __( 'Form Permissions', 'formidable' ), |
| @@ -1543,9 +1606,9 @@ | ||
| 1543 | 1606 | ), |
| 1544 | 1607 | ), |
| 1545 | 1608 | 'scheduling' => array( |
| 1546 | 1609 | 'name' => __( 'Form Scheduling', 'formidable' ), |
| 1547 | - 'icon' => 'frmfont frm_calendar_icon', | |
| 1610 | + 'icon' => 'frmfont frm_schedule_icon', | |
| 1548 | 1611 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 1549 | 1612 | 'data' => array( |
| 1550 | 1613 | 'medium' => 'scheduling', |
| 1551 | 1614 | 'upgrade' => __( 'Form scheduling settings', 'formidable' ), |
| @@ -1556,19 +1619,19 @@ | ||
| 1556 | 1619 | 'buttons' => array( |
| 1557 | 1620 | 'name' => __( 'Buttons', 'formidable' ), |
| 1558 | 1621 | 'class' => self::class, |
| 1559 | 1622 | 'function' => 'buttons_settings', |
| 1560 | - 'icon' => 'frmfont frm_button_icon', | |
| 1623 | + 'icon' => 'frmfont frm-buttons-style', | |
| 1561 | 1624 | ), |
| 1562 | 1625 | 'landing' => array( |
| 1563 | 1626 | 'name' => __( 'Form Landing Page', 'formidable' ), |
| 1564 | - 'icon' => 'frmfont frm_file_text_icon', | |
| 1627 | + 'icon' => 'frmfont frm_cross_device_icon', | |
| 1565 | 1628 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 1566 | 1629 | 'data' => FrmAppHelper::get_landing_page_upgrade_data_params(), |
| 1567 | 1630 | ), |
| 1568 | 1631 | 'chat' => array( |
| 1569 | 1632 | 'name' => __( 'Conversational Forms', 'formidable' ), |
| 1570 | - 'icon' => 'frmfont frm_chat_forms_icon', | |
| 1633 | + 'icon' => 'frmfont frm_chat_bubbles_icon', | |
| 1571 | 1634 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 1572 | 1635 | 'data' => FrmAppHelper::get_upgrade_data_params( |
| 1573 | 1636 | 'chat', |
| 1574 | 1637 | array( |
| @@ -1596,9 +1659,9 @@ | ||
| 1596 | 1659 | 'html' => array( |
| 1597 | 1660 | 'name' => __( 'Customize HTML', 'formidable' ), |
| 1598 | 1661 | 'class' => self::class, |
| 1599 | 1662 | 'function' => 'html_settings', |
| 1600 | - 'icon' => 'frmfont frm_code_icon', | |
| 1663 | + 'icon' => 'frmfont frm_code2_icon', | |
| 1601 | 1664 | ), |
| 1602 | 1665 | ); |
| 1603 | 1666 | |
| 1604 | 1667 | if ( ! has_action( 'frm_add_form_style_tab_options' ) && ! has_action( 'frm_add_form_button_options' ) ) { |
| @@ -1648,18 +1711,16 @@ | ||
| 1648 | 1711 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-advanced.php'; |
| 1649 | 1712 | } |
| 1650 | 1713 | |
| 1651 | 1714 | /** |
| 1715 | + * @since 6.33 | |
| 1716 | + * | |
| 1652 | 1717 | * @param array $values |
| 1653 | 1718 | * |
| 1654 | 1719 | * @return void |
| 1655 | 1720 | */ |
| 1656 | - public static function render_spam_settings( $values ) { | |
| 1657 | - if ( function_exists( 'akismet_http_post' ) ) { | |
| 1658 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php'; | |
| 1659 | - } | |
| 1660 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/stopforumspam.php'; | |
| 1661 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php'; | |
| 1721 | + public static function spam_settings( $values ) { | |
| 1722 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings.php'; | |
| 1662 | 1723 | } |
| 1663 | 1724 | |
| 1664 | 1725 | /** |
| 1665 | 1726 | * @since 4.0 |
| @@ -1737,9 +1798,9 @@ | ||
| 1737 | 1798 | $linked_forms = array(); |
| 1738 | 1799 | $col = 'one'; |
| 1739 | 1800 | $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ); |
| 1740 | 1801 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
| 1741 | - $entry_shortcodes = self::get_shortcode_helpers( $settings_tab ); | |
| 1802 | + $entry_shortcodes = self::get_shortcode_helpers( $settings_tab, $form_id ); | |
| 1742 | 1803 | $advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) ); |
| 1743 | 1804 | |
| 1744 | 1805 | if ( 'default' === $template_path || ! file_exists( $template_path ) ) { |
| 1745 | 1806 | include FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php'; |
| @@ -1790,8 +1851,126 @@ | ||
| 1790 | 1851 | return apply_filters( 'frm_advanced_helpers', $advanced_helpers, $atts ); |
| 1791 | 1852 | } |
| 1792 | 1853 | |
| 1793 | 1854 | /** |
| 1855 | + * Adds a shortcode for each part of a multi-part field to the field shortcode list, | |
| 1856 | + * so a single part can be used on its own, like [25 show=first] for a Name field. | |
| 1857 | + * | |
| 1858 | + * @since 6.35 | |
| 1859 | + * | |
| 1860 | + * @param array $atts Includes 'field'. | |
| 1861 | + * | |
| 1862 | + * @return void | |
| 1863 | + */ | |
| 1864 | + public static function field_part_shortcodes( $atts ) { | |
| 1865 | + $field = $atts['field']; | |
| 1866 | + | |
| 1867 | + foreach ( self::get_field_parts( $field ) as $part => $label ) { | |
| 1868 | + FrmFormsHelper::insert_opt_html( | |
| 1869 | + array( | |
| 1870 | + 'id' => $field->id . ' show=' . $part, | |
| 1871 | + 'key' => $field->field_key . ' show=' . $part, | |
| 1872 | + // Keep the part label and the option out of the truncated text so they stay readable. | |
| 1873 | + 'key_label' => $field->field_key, | |
| 1874 | + 'key_suffix' => ' show=' . $part, | |
| 1875 | + 'name' => $field->name, | |
| 1876 | + 'name_suffix' => ' (' . $label . ')', | |
| 1877 | + 'type' => $field->type, | |
| 1878 | + 'class' => 'frm-customize-list dropdown-item', | |
| 1879 | + ) | |
| 1880 | + ); | |
| 1881 | + unset( $part, $label ); | |
| 1882 | + } | |
| 1883 | + } | |
| 1884 | + | |
| 1885 | + /** | |
| 1886 | + * Gets the parts of a multi-part field that can be shown on their own with a show= shortcode option. | |
| 1887 | + * | |
| 1888 | + * @since 6.35 | |
| 1889 | + * | |
| 1890 | + * @param stdClass $field | |
| 1891 | + * | |
| 1892 | + * @return array Part labels keyed by the show= option value. | |
| 1893 | + */ | |
| 1894 | + private static function get_field_parts( $field ) { | |
| 1895 | + $parts = array(); | |
| 1896 | + | |
| 1897 | + if ( 'name' === $field->type ) { | |
| 1898 | + $parts = self::get_name_field_parts( $field ); | |
| 1899 | + } elseif ( 'address' === $field->type ) { | |
| 1900 | + $parts = self::get_address_field_parts( $field ); | |
| 1901 | + } | |
| 1902 | + | |
| 1903 | + /** | |
| 1904 | + * Allows add-ons to add the parts of their own multi-part fields. | |
| 1905 | + * | |
| 1906 | + * @since 6.35 | |
| 1907 | + * | |
| 1908 | + * @param array $parts Part labels keyed by the show= option value. | |
| 1909 | + * @param stdClass $field The field the parts belong to. | |
| 1910 | + */ | |
| 1911 | + return apply_filters( 'frm_field_parts_for_shortcodes', $parts, $field ); | |
| 1912 | + } | |
| 1913 | + | |
| 1914 | + /** | |
| 1915 | + * Gets the parts of a Name field that are in use. Only the parts included in the | |
| 1916 | + * selected name layout hold a value, so the rest would always show as blank. | |
| 1917 | + * | |
| 1918 | + * @since 6.35 | |
| 1919 | + * | |
| 1920 | + * @param stdClass $field | |
| 1921 | + * | |
| 1922 | + * @return array Part labels keyed by the show= option value, in layout order. | |
| 1923 | + */ | |
| 1924 | + private static function get_name_field_parts( $field ) { | |
| 1925 | + $labels = array( | |
| 1926 | + 'first' => __( 'First', 'formidable' ), | |
| 1927 | + 'middle' => __( 'Middle', 'formidable' ), | |
| 1928 | + 'last' => __( 'Last', 'formidable' ), | |
| 1929 | + ); | |
| 1930 | + $layout = FrmField::get_option( $field, 'name_layout' ); | |
| 1931 | + | |
| 1932 | + if ( ! $layout ) { | |
| 1933 | + $layout = 'first_last'; | |
| 1934 | + } | |
| 1935 | + | |
| 1936 | + // The layout option names the parts in use, in display order, like first_middle_last. | |
| 1937 | + $parts = array(); | |
| 1938 | + | |
| 1939 | + foreach ( explode( '_', $layout ) as $part ) { | |
| 1940 | + if ( isset( $labels[ $part ] ) ) { | |
| 1941 | + $parts[ $part ] = $labels[ $part ]; | |
| 1942 | + } | |
| 1943 | + unset( $part ); | |
| 1944 | + } | |
| 1945 | + | |
| 1946 | + return $parts; | |
| 1947 | + } | |
| 1948 | + | |
| 1949 | + /** | |
| 1950 | + * Gets the parts of an Address field that are in use. The address type decides which | |
| 1951 | + * parts are on the form, so the rest would always show as blank. | |
| 1952 | + * | |
| 1953 | + * @since 6.35 | |
| 1954 | + * | |
| 1955 | + * @param stdClass $field | |
| 1956 | + * | |
| 1957 | + * @return array Part labels keyed by the show= option value. | |
| 1958 | + */ | |
| 1959 | + private static function get_address_field_parts( $field ) { | |
| 1960 | + $parts = FrmFieldAddress::get_part_labels(); | |
| 1961 | + $address_type = FrmField::get_option( $field, 'address_type' ); | |
| 1962 | + | |
| 1963 | + if ( in_array( $address_type, array( 'us', 'generic' ), true ) ) { | |
| 1964 | + unset( $parts['country'] ); | |
| 1965 | + } elseif ( 'europe' === $address_type ) { | |
| 1966 | + unset( $parts['state'] ); | |
| 1967 | + } | |
| 1968 | + | |
| 1969 | + return $parts; | |
| 1970 | + } | |
| 1971 | + | |
| 1972 | + /** | |
| 1794 | 1973 | * Get an array of the options to display in the advanced tab |
| 1795 | 1974 | * of the customization panel |
| 1796 | 1975 | * |
| 1797 | 1976 | * @since 2.0.6 |
| @@ -1846,12 +2025,13 @@ | ||
| 1846 | 2025 | * |
| 1847 | 2026 | * @since 2.0.6 |
| 1848 | 2027 | * |
| 1849 | 2028 | * @param bool $settings_tab |
| 2029 | + * @param int $form_id | |
| 1850 | 2030 | * |
| 1851 | 2031 | * @return array |
| 1852 | 2032 | */ |
| 1853 | - private static function get_shortcode_helpers( $settings_tab ) { | |
| 2033 | + private static function get_shortcode_helpers( $settings_tab, $form_id = 0 ) { | |
| 1854 | 2034 | $entry_shortcodes = array( |
| 1855 | 2035 | 'id' => __( 'Entry ID', 'formidable' ), |
| 1856 | 2036 | 'key' => __( 'Entry Key', 'formidable' ), |
| 1857 | 2037 | 'post_id' => __( 'Post ID', 'formidable' ), |
| @@ -1877,10 +2057,11 @@ | ||
| 1877 | 2057 | * @since 2.0.6 |
| 1878 | 2058 | * |
| 1879 | 2059 | * @param array $entry_shortcodes |
| 1880 | 2060 | * @param bool $settings_tab |
| 2061 | + * @param int $form_id | |
| 1881 | 2062 | */ |
| 1882 | - return apply_filters( 'frm_helper_shortcodes', $entry_shortcodes, $settings_tab ); | |
| 2063 | + return apply_filters( 'frm_helper_shortcodes', $entry_shortcodes, $settings_tab, $form_id ); | |
| 1883 | 2064 | } |
| 1884 | 2065 | |
| 1885 | 2066 | /** |
| 1886 | 2067 | * Insert the form class setting into the form. |
| @@ -2216,9 +2397,10 @@ | ||
| 2216 | 2397 | } |
| 2217 | 2398 | |
| 2218 | 2399 | if ( $name === $form->name ) { |
| 2219 | 2400 | // Nothing to change so exit early. |
| 2220 | - wp_send_json_success(); | |
| 2401 | + $form_key = $form->form_key; | |
| 2402 | + wp_send_json_success( compact( 'form_key' ) ); | |
| 2221 | 2403 | } |
| 2222 | 2404 | |
| 2223 | 2405 | $to_update = array( |
| 2224 | 2406 | 'name' => $name, |
| @@ -2297,11 +2479,9 @@ | ||
| 2297 | 2479 | /** |
| 2298 | 2480 | * @since 4.05.02 |
| 2299 | 2481 | */ |
| 2300 | 2482 | private static function move_menu_to_footer() { |
| 2301 | - $settings = FrmAppHelper::get_settings(); | |
| 2302 | - | |
| 2303 | - if ( empty( $settings->admin_bar ) ) { | |
| 2483 | + if ( empty( FrmAppHelper::get_settings()->admin_bar ) ) { | |
| 2304 | 2484 | remove_action( 'wp_body_open', 'wp_admin_bar_render', 0 ); |
| 2305 | 2485 | } |
| 2306 | 2486 | } |
| 2307 | 2487 | |
| @@ -3542,8 +3722,13 @@ | ||
| 3542 | 3722 | // Load formidable js |
| 3543 | 3723 | wp_enqueue_script( 'formidable' ); |
| 3544 | 3724 | |
| 3545 | 3725 | FrmHoneypot::maybe_print_honeypot_js(); |
| 3726 | + | |
| 3727 | + if ( ! method_exists( 'FrmProFormsHelper', 'load_currency_js' ) ) { | |
| 3728 | + // Load currency JS if Pro is not installed. | |
| 3729 | + FrmFormsHelper::load_currency_js(); | |
| 3730 | + } | |
| 3546 | 3731 | } |
| 3547 | 3732 | |
| 3548 | 3733 | /** |
| 3549 | 3734 | * @since 2.0.8 |
| @@ -3673,9 +3858,9 @@ | ||
| 3673 | 3858 | } |
| 3674 | 3859 | |
| 3675 | 3860 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 3676 | 3861 | |
| 3677 | - $html = FrmAppHelper::clip( | |
| 3862 | + $html = FrmAppHelper::clip( | |
| 3678 | 3863 | function () { |
| 3679 | 3864 | FrmAppHelper::maybe_autocomplete_pages_options( |
| 3680 | 3865 | array( |
| 3681 | 3866 | 'field_name' => 'frm_page_dropdown', |
| @@ -3684,18 +3869,48 @@ | ||
| 3684 | 3869 | ) |
| 3685 | 3870 | ); |
| 3686 | 3871 | } |
| 3687 | 3872 | ); |
| 3688 | - $post_type_object = get_post_type_object( 'page' ); | |
| 3689 | 3873 | wp_send_json( |
| 3690 | 3874 | array( |
| 3691 | 3875 | 'html' => $html, |
| 3692 | - 'edit_page_url' => admin_url( sprintf( $post_type_object->_edit_link . '&action=edit', 0 ) ), | |
| 3876 | + 'edit_page_url' => admin_url( sprintf( get_post_type_object( 'page' )->_edit_link . '&action=edit', 0 ) ), | |
| 3693 | 3877 | ) |
| 3694 | 3878 | ); |
| 3695 | 3879 | } |
| 3696 | 3880 | |
| 3697 | 3881 | /** |
| 3882 | + * Prints necessary templates for the forms list page. | |
| 3883 | + * | |
| 3884 | + * @since 6.32 | |
| 3885 | + * | |
| 3886 | + * @return void | |
| 3887 | + */ | |
| 3888 | + public static function print_forms_list_templates() { | |
| 3889 | + if ( ! FrmAppHelper::on_form_listing_page() ) { | |
| 3890 | + return; | |
| 3891 | + } | |
| 3892 | + | |
| 3893 | + $screen = get_current_screen(); | |
| 3894 | + | |
| 3895 | + if ( ! $screen ) { | |
| 3896 | + return; | |
| 3897 | + } | |
| 3898 | + | |
| 3899 | + $columns = get_column_headers( $screen ); | |
| 3900 | + $hidden = get_hidden_columns( $screen ); | |
| 3901 | + $skip_cols = array( 'cb', 'name', 'settings' ); | |
| 3902 | + $per_page = get_user_option( 'formidable_page_formidable_per_page' ); | |
| 3903 | + $show_screen_options = $screen->show_screen_options(); | |
| 3904 | + | |
| 3905 | + if ( $per_page < 1 ) { | |
| 3906 | + $per_page = 20; | |
| 3907 | + } | |
| 3908 | + | |
| 3909 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/forms-list-settings.php'; | |
| 3910 | + } | |
| 3911 | + | |
| 3912 | + /** | |
| 3698 | 3913 | * @deprecated 4.0 |
| 3699 | 3914 | * |
| 3700 | 3915 | * @param array $values |
| 3701 | 3916 | * |
| @@ -3703,6 +3918,17 @@ | ||
| 3703 | 3918 | */ |
| 3704 | 3919 | public static function create( $values = array() ) { |
| 3705 | 3920 | _deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' ); |
| 3706 | 3921 | self::update( $values ); |
| 3922 | + } | |
| 3923 | + | |
| 3924 | + /** | |
| 3925 | + * @deprecated 6.33 | |
| 3926 | + * | |
| 3927 | + * @param array $values | |
| 3928 | + * | |
| 3929 | + * @return void | |
| 3930 | + */ | |
| 3931 | + public static function render_spam_settings( $values ) { | |
| 3932 | + _deprecated_function( __METHOD__, '6.33' ); | |
| 3707 | 3933 | } |
| 3708 | 3934 | } |