PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4.5
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4.5
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmApplicationsController.php +12 -30 6.255.4.5 View file →
@@ -13,10 +13,11 @@
13 13 *
14 14 * @return void
15 15 */
16 16 public static function menu() {
17 - $label = __( 'Applications', 'formidable' );
18 - $cap = self::get_required_capability();
17 + $label = __( 'Applications', 'formidable' );
18 + $new_pill = '<span class="frm-new-pill">NEW</span>';
19 + $cap = self::get_required_capability();
19 20
20 21 if ( ! current_user_can( $cap ) && is_callable( 'FrmProApplicationsHelper::get_custom_applications_capability' ) ) {
21 22 $custom_applications_cap = FrmProApplicationsHelper::get_custom_applications_capability();
22 23 if ( current_user_can( $custom_applications_cap ) ) {
@@ -27,12 +28,12 @@
27 28 }
28 29
29 30 if ( ! isset( $slug ) ) {
30 31 $slug = 'formidable-applications';
31 - $callback = array( self::class, 'landing_page' );
32 + $callback = array( __CLASS__, 'landing_page' );
32 33 }
33 34
34 - add_submenu_page( 'formidable', 'Formidable | ' . $label, $label, $cap, $slug, $callback );
35 + add_submenu_page( 'formidable', 'Formidable | ' . $label, $label . $new_pill, $cap, $slug, $callback );
35 36 }
36 37
37 38 /**
38 39 * Get the required capability for accessing the Applications dashboard.
@@ -71,11 +72,8 @@
71 72 *
72 73 * @return void
73 74 */
74 75 public static function get_applications_data() {
75 - FrmAppHelper::permission_check( 'frm_view_forms' );
76 - check_ajax_referer( 'frm_ajax', 'nonce' );
77 -
78 76 $view = FrmAppHelper::get_param( 'view', '', 'get', 'sanitize_text_field' );
79 77 $data = array();
80 78
81 79 if ( 'applications' !== $view ) {
@@ -130,9 +128,9 @@
130 128 }
131 129
132 130 FrmApplicationTemplate::init();
133 131
134 - return array_reduce( $applications, array( self::class, 'reduce_template' ), array() );
132 + return array_reduce( $applications, array( __CLASS__, 'reduce_template' ), array() );
135 133 }
136 134
137 135 /**
138 136 * @param array $total the accumulated array of reduced application data.
@@ -140,14 +138,9 @@
140 138 * @return array<array>
141 139 */
142 140 private static function reduce_template( $total, $current ) {
143 141 $template = new FrmApplicationTemplate( $current );
144 -
145 - $js_object = $template->as_js_object();
146 - if ( $js_object ) {
147 - $total[] = $js_object;
148 - }
149 -
142 + $total[] = $template->as_js_object();
150 143 return $total;
151 144 }
152 145
153 146 /**
@@ -158,9 +151,9 @@
158 151 */
159 152 private static function sort_templates( $applications ) {
160 153 usort(
161 154 $applications,
162 - function ( $a, $b ) {
155 + function( $a, $b ) {
163 156 return strcmp( $a['name'], $b['name'] );
164 157 }
165 158 );
166 159 return $applications;
@@ -166,21 +159,10 @@
166 159 return $applications;
167 160 }
168 161
169 162 /**
170 - * @usedby FrmAppController::admin_init().
171 - *
172 - * @since 6.8
173 - *
174 163 * @return void
175 164 */
176 - public static function load_page() {
177 - self::load_assets();
178 - }
179 -
180 - /**
181 - * @return void
182 - */
183 165 public static function load_assets() {
184 166 $plugin_url = FrmAppHelper::plugin_url();
185 167 $version = FrmAppHelper::plugin_version();
186 168
@@ -188,10 +170,9 @@
188 170 wp_enqueue_style( 'formidable-grids' );
189 171
190 172 $js_dependencies = array(
191 173 'wp-i18n',
192 - // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7.
193 - 'wp-hooks',
174 + 'wp-hooks', // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7.
194 175 'formidable_dom',
195 176 );
196 177 wp_register_script( 'formidable_applications', $plugin_url . '/js/admin/applications.js', $js_dependencies, $version, true );
197 178 wp_register_style( 'formidable_applications', $plugin_url . '/css/admin/applications.css', array(), $version );
@@ -201,9 +182,8 @@
201 182 );
202 183 wp_localize_script( 'formidable_applications', 'frmApplicationsVars', $js_vars );
203 184
204 185 wp_enqueue_script( 'formidable_applications' );
205 - wp_set_script_translations( 'formidable_applications', 'formidable' );
206 186 wp_enqueue_style( 'formidable_applications' );
207 187
208 188 do_action( 'frm_applications_assets' );
209 189 }
@@ -212,9 +192,11 @@
212 192 * @return void
213 193 */
214 194 public static function dequeue_scripts() {
215 195 if ( 'formidable-applications' === FrmAppHelper::simple_get( 'page', 'sanitize_title' ) ) {
216 - FrmAppHelper::dequeue_extra_global_scripts();
196 + // Avoid extra scripts loading on applications index that aren't needed.
197 + wp_dequeue_script( 'frm-surveys-admin' );
198 + wp_dequeue_script( 'frm-quizzes-form-action' );
217 199 }
218 200 }
219 201
220 202 /**