d ); } else { $postarr['post_content'] = apply_filters( 'frm_create_page_with_' . $type . '_shortcode_content', '', $object_id ); } $name = FrmAppHelper::get_post_param( 'name', '', 'sanitize_text_field' ); if ( $name ) { $postarr['post_title'] = $name; } $success = wp_insert_post( $postarr ); if ( ! is_numeric( $success ) || ! $success ) { die( 0 ); } wp_send_json( array( 'redirect' => get_edit_post_link( $success, 'redirect' ), ) ); } /** * @since 5.3 * * @param string $content * @param int $form_id * @return string */ private static function get_page_shortcode_content_for_form( $form_id ) { $shortcode = '[formidable id="' . $form_id . '"]'; $html_comment_start = ''; $html_comment_end = ''; return $html_comment_start . '
' . $shortcode . '
' . $html_comment_end; } /** * Get page dropdown for AJAX request for embedding form in an existing page. * * @return never */ public static function get_page_dropdown() { if ( ! current_user_can( 'publish_posts' ) ) { die( 0 ); } check_ajax_referer( 'frm_ajax', 'nonce' ); $html = FrmAppHelper::clip( function() { FrmAppHelper::maybe_autocomplete_pages_options( array( 'field_name' => 'frm_page_dropdown', 'page_id' => '', 'placeholder' => __( 'Select a Page', 'formidable' ), ) ); } ); $post_type_object = get_post_type_object( 'page' ); wp_send_json( array( 'html' => $html, 'edit_page_url' => admin_url( sprintf( $post_type_object->_edit_link . '&action=edit', 0 ) ), ) ); } /** * @deprecated 4.0 */ public static function new_form( $values = array() ) { FrmDeprecated::new_form( $values ); } /** * @deprecated 4.0 */ public static function create( $values = array() ) { _deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' ); self::update( $values ); } /** * @deprecated 3.0 * @codeCoverageIgnore */ public static function bulk_create_template( $ids ) { return FrmDeprecated::bulk_create_template( $ids ); } /** * @deprecated 3.0 * @codeCoverageIgnore */ public static function edit_key() { FrmDeprecated::edit_key(); } /** * @deprecated 3.0 * @codeCoverageIgnore */ public static function edit_description() { FrmDeprecated::edit_description(); } /** * @deprecated 4.08 * @since 3.06 */ public static function add_new() { _deprecated_function( __FUNCTION__, '4.08' ); } }