FrmProApplication::add_form_to_application( $application_id, $object_id ); continue; } /* translators: %s: name of form. */ $shortcode_match['description'] = __( 'Page includes shortcode for form "%s".', 'formidable-pro' ); } elseif ( 'view' === $type ) { if ( ! is_int( $object_id ) ) { if ( ! class_exists( 'FrmViewsDisplay' ) ) { continue; } $object_id = FrmViewsDisplay::get_id_by_key( $object_id ); if ( ! $object_id ) { continue; } } if ( ! in_array( $object_id, $view_ids, true ) ) { if ( ! $page_was_assigned_to_application ) { continue; } global $wpdb; $where = array( 'ID' => $object_id ); $view_title = FrmDb::get_var( $wpdb->posts, $where, 'post_title' ); if ( ! $view_title ) { continue; } $shortcode_match['description'] = sprintf( /* translators: %s: name of page. */ __( 'View found in page "%s".', 'formidable-pro' ), $page_name ); $summary_by_view_id[ $object_id ] = array( 'name' => $view_title, 'matches' => array( $shortcode_match ), ); FrmProApplication::add_post_to_application( $application_id, $object_id, 'view' ); continue; } /* translators: %s: name of view. */ $shortcode_match['description'] = __( 'Page includes shortcode for view "%s".', 'formidable-pro' ); } else { continue; } if ( $page_was_assigned_to_application ) { continue; } if ( ! array_key_exists( $page_id, $summary_by_page_id ) ) { $summary_by_page_id[ $page_id ] = array( 'name' => $page_name, 'matches' => array(), ); FrmProApplication::add_post_to_application( $application_id, $page_id, 'page' ); } $summary_by_page_id[ $page_id ]['matches'][] = $shortcode_match; } return array( 'form' => $summary_by_form_id, 'view' => $summary_by_view_id, 'page' => $summary_by_page_id, ); } /** * @param int $application_id * @return array summary of each page added, indexed by page id with shortcode match details. */ private static function search_form_fields_for_source_forms( $application_id ) { $form_ids = FrmProApplication::get_forms_for_application( $application_id, true ); if ( ! $form_ids ) { return array(); } $fields = FrmField::getAll( array( 'form_id' => $form_ids, 'type' => array( 'data', 'lookup', 'form' ), ) ); if ( ! $fields ) { return array(); } $summary_by_form_id = array(); foreach ( $fields as $field ) { switch ( $field->type ) { case 'lookup': $form_id = absint( $field->field_options['get_values_form'] ); break; case 'data': $source_field_id = $field->field_options['form_select']; $form_id = absint( FrmDb::get_var( 'frm_fields', array( 'id' => $source_field_id ), 'form_id' ) ); break; case 'form': $form_id = absint( $field->field_options['form_select'] ); break; } if ( in_array( $form_id, $form_ids, true ) ) { // Form already added. continue; } if ( ! array_key_exists( $form_id, $summary_by_form_id ) ) { $form_name = FrmDb::get_var( 'frm_forms', array( 'id' => $form_id ), 'name' ); if ( ! $form_name ) { continue; } $summary_by_form_id[ $form_id ] = array( 'name' => $form_name, 'matches' => array(), ); FrmProApplication::add_form_to_application( $application_id, $form_id ); } $summary_by_form_id[ $form_id ]['matches'][] = array( 'type' => 'form', 'objectId' => absint( $field->form_id ), /* translators: %s: Name of form with source data. */ 'description' => __( 'Form includes options from "%s".', 'formidable-pro' ), ); } unset( $form_id ); return array( 'form' => $summary_by_form_id ); } /** * @param string $string * @param callable $callback for handling the shortcode results * @param array $tags * @return array */ public static function get_shortcode_matches_from_string( $string, $callback, $tags = array( 'formidable', 'display-frm-data' ) ) { $regex = '/' . get_shortcode_regex( $tags ) . '/'; preg_match_all( $regex, $string, $matches ); if ( empty( $matches[0] ) ) { return array(); } $result = array(); foreach ( $matches[0] as $index => $match ) { $id = self::parse_id_from_options( $matches[3][ $index ] ); if ( false === $id ) { continue; } $shortcode_found = $matches[2][ $index ]; // 'formidable', or 'display-frm-data'. $callback_response = $callback( $shortcode_found, $id ); if ( is_array( $callback_response ) ) { $result[] = $callback_response; } } return $result; } /** * @param string $options * @return int|string|false form or view id (or key) found in shortcode options. False when there is no match. */ private static function parse_id_from_options( $options ) { $split = explode( ' ', $options ); foreach ( $split as $current ) { if ( 0 === strpos( $current, 'id=' ) ) { $current = str_replace( '"', '', $current ); $current = str_replace( "'", '', $current ); $substr = substr( $current, 3 ); if ( is_numeric( $substr ) ) { return intval( $substr ); } return sanitize_key( $substr ); } } return false; } /** * @param string $shortcode_found * @param int $id_found * @return array|false */ public static function handle_shortcode( $shortcode_found, $id_found ) { switch ( $shortcode_found ) { case 'formidable': return array( 'type' => 'form', 'objectId' => $id_found ); case 'display-frm-data': return array( 'type' => 'view', 'objectId' => $id_found ); } return false; } /** * Get all applicatino ids for a single form. * * @param int $form_id * @return array */ public static function get_application_ids_for_form( $form_id ) { global $wpdb; return array_map( 'intval', FrmDb::get_col( $wpdb->termmeta, array( 'meta_key' => '_frm_form_id', 'meta_value' => $form_id, ), 'term_id' ) ); } /** * Get tag HTML for applications to use in forms and views tables. * * @since 5.3.1 * * @param array $application_ids * @return string */ public static function get_application_tags_html( $application_ids ) { $can_edit_applications = self::current_user_can_edit_applications(); return array_reduce( $application_ids, function( $total, $application_id ) use ( $can_edit_applications ) { $application = get_term( $application_id, 'frm_application' ); if ( ! ( $application instanceof WP_Term ) ) { return $total; } $href = FrmProApplicationsHelper::get_edit_url( $application_id ); if ( $can_edit_applications ) { $link = '' . esc_html( $application->name ) . ''; } else { $link = esc_html( $application->name ); } return $total . '
' . $link . '
'; }, '' ); } /** * Check Applications Templates permission and maybe die. * * @since 5.3.1 * * @return void */ public static function templates_permission_check() { FrmAppHelper::permission_check( self::get_required_templates_capability() ); } /** * Check Custom Applications permission and maybe die. * * @since 5.3.1 * * @return void */ public static function custom_application_permission_check() { FrmAppHelper::permission_check( self::get_custom_applications_capability() ); } /** * @since 5.3.1 * * @return string */ public static function get_required_templates_capability() { $cap = 'frm_application_dashboard'; if ( ! current_user_can( $cap ) && current_user_can( 'administrator' ) ) { // Make sure administrator can always access Applications. $cap = 'administrator'; } return $cap; } /** * @since 5.3.1 * * @return string */ public static function get_custom_applications_capability() { return 'frm_edit_applications'; } /** * @since 5.3.1 * * @return bool */ public static function current_user_can_edit_applications() { return current_user_can( self::get_custom_applications_capability() ) || current_user_can( 'administrator' ); } }
Fatal error: Uncaught Error: Class "FrmProApplicationsHelper" not found in /htdocs/wp-content/plugins/formidable-pro/classes/controllers/FrmProApplicationTaxonomyController.php:246 Stack trace: #0 /htdocs/wp-content/plugins/formidable-pro/classes/controllers/FrmProApplicationTaxonomyController.php(21): FrmProApplicationTaxonomyController::register_application_taxonomy() #1 /htdocs/wp-includes/class-wp-hook.php(310): FrmProApplicationTaxonomyController::init('') #2 /htdocs/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #3 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /htdocs/wp-settings.php(632): do_action('init') #5 /htdocs/wp-config.php(96): require_once('/htdocs/wp-sett...') #6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #8 /htdocs/index.php(17): require('/htdocs/wp-blog...') #9 {main} thrown in /htdocs/wp-content/plugins/formidable-pro/classes/controllers/FrmProApplicationTaxonomyController.php on line 246