'entry_id', 'class' ) );
return apply_filters( 'frm_main_feedback', $message, $form, $entry_id );
}
/**
* @return void
*/
public static function front_head() {
$version = FrmAppHelper::plugin_version();
$suffix = FrmAppHelper::js_suffix();
if ( ! empty( $suffix ) && self::has_combo_js_file() ) {
wp_register_script( 'formidable', FrmAppHelper::plugin_url() . '/js/frm.min.js', array( 'jquery' ), $version, true );
} else {
wp_register_script( 'formidable', FrmAppHelper::plugin_url() . "/js/formidable{$suffix}.js", array( 'jquery' ), $version, true );
}
add_filter( 'script_loader_tag', 'FrmFormsController::defer_script_loading', 10, 2 );
if ( FrmAppHelper::is_admin() ) {
// don't load this in back-end
return;
}
FrmAppHelper::localize_script( 'front' );
FrmStylesController::enqueue_css( 'register' );
}
/**
* @since 3.0
*/
public static function has_combo_js_file() {
return is_readable( FrmAppHelper::plugin_path() . '/js/frm.min.js' );
}
public static function maybe_load_css( $form, $this_load, $global_load ) {
$load_css = FrmForm::is_form_loaded( $form, $this_load, $global_load );
if ( ! $load_css ) {
return;
}
global $frm_vars;
self::footer_js( 'header' );
$frm_vars['css_loaded'] = true;
self::load_late_css();
}
/**
* If css is loaded only on applicable pages, include it before the form loads
* to prevent a flash of unstyled form.
*
* @since 4.01
*
* @return void
*/
private static function load_late_css() {
$frm_settings = FrmAppHelper::get_settings();
$late_css = $frm_settings->load_style === 'dynamic';
if ( ! $late_css || ! self::should_load_late() ) {
return;
}
global $wp_styles;
if ( is_array( $wp_styles->queue ) && in_array( 'formidable', $wp_styles->queue, true ) ) {
wp_print_styles( 'formidable' );
}
}
/**
* Avoid late load if All in One SEO is active because it prevents CSS from loading entirely.
*
* @since 5.2.03
*
* @return bool
*/
private static function should_load_late() {
return ! function_exists( 'aioseo' );
}
public static function defer_script_loading( $tag, $handle ) {
if ( 'captcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
}
return $tag;
}
public static function footer_js( $location = 'footer' ) {
global $frm_vars;
FrmStylesController::enqueue_css();
if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
// load formidable js
wp_enqueue_script( 'formidable' );
}
}
/**
* @since 2.0.8
*/
private static function maybe_minimize_form( $atts, &$content ) {
// check if minimizing is turned on
if ( self::is_minification_on( $atts ) ) {
$content = str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', $content );
}
}
/**
* @since 2.0.8
* @return bool
*/
private static function is_minification_on( $atts ) {
return ! empty( $atts['minimize'] );
}
/**
* @since 5.0.16
*
* @return void
*/
public static function landing_page_preview_option() {
$dir = apply_filters( 'frm_landing_page_preview_option', false );
if ( false === $dir || ! file_exists( $dir . 'landing-page-preview-option.php' ) ) {
$dir = self::get_form_views_path();
}
include $dir . 'landing-page-preview-option.php';
}
/**
* @since 5.0.16
*
* @return string
*/
private static function get_form_views_path() {
return FrmAppHelper::plugin_path() . '/classes/views/frm-forms/';
}
/**
* Create a page with an embedded formidable Gutenberg block.
*
* @since 5.2
*
* @return void
*/
public static function create_page_with_shortcode() {
if ( ! current_user_can( 'publish_posts' ) ) {
die( 0 );
}
check_ajax_referer( 'frm_ajax', 'nonce' );
$type = FrmAppHelper::get_post_param( 'type', '', 'sanitize_text_field' );
if ( ! $type || ! in_array( $type, array( 'form', 'view' ), true ) ) {
die( 0 );
}
$object_id = FrmAppHelper::get_post_param( 'object_id', '', 'absint' );
if ( ! $object_id ) {
die( 0 );
}
$postarr = array( 'post_type' => 'page' );
if ( 'form' === $type ) {
$postarr['post_content'] = self::get_page_shortcode_content_for_form( $object_id );
} 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 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 void
*/
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 create( $values = array() ) {
_deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' );
self::update( $values );
}
/**
* @deprecated 6.7
*
* @return bool
*/
public static function expired() {
_deprecated_function( __METHOD__, '6.7' );
return FrmAddonsController::is_license_expired();
}
}
Warning : call_user_func_array() expects parameter 1 to be a valid callback, class 'FrmFormsController' not found in /home/ecofinir/public_html/wp-includes/class-wp-hook.php on line 324
بایگانیها روابط عمومی - اکوفاین | مدیریتی ، مالی ، اقتصادی