| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if ( ! isset( $slug ) ) { |
| 30 | 30 | $slug = 'formidable-applications'; |
| 31 | - $callback = array( self::class, 'landing_page' ); | |
| 31 | + $callback = array( __CLASS__, 'landing_page' ); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | add_submenu_page( 'formidable', 'Formidable | ' . $label, $label, $cap, $slug, $callback ); |
| 35 | 35 | } |
| @@ -130,9 +130,9 @@ | ||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | FrmApplicationTemplate::init(); |
| 133 | 133 | |
| 134 | - return array_reduce( $applications, array( self::class, 'reduce_template' ), array() ); | |
| 134 | + return array_reduce( $applications, array( __CLASS__, 'reduce_template' ), array() ); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * @param array $total the accumulated array of reduced application data. |
| @@ -140,14 +140,9 @@ | ||
| 140 | 140 | * @return array<array> |
| 141 | 141 | */ |
| 142 | 142 | private static function reduce_template( $total, $current ) { |
| 143 | 143 | $template = new FrmApplicationTemplate( $current ); |
| 144 | - | |
| 145 | - $js_object = $template->as_js_object(); | |
| 146 | - if ( $js_object ) { | |
| 147 | - $total[] = $js_object; | |
| 148 | - } | |
| 149 | - | |
| 144 | + $total[] = $template->as_js_object(); | |
| 150 | 145 | return $total; |
| 151 | 146 | } |
| 152 | 147 | |
| 153 | 148 | /** |
| @@ -158,9 +153,9 @@ | ||
| 158 | 153 | */ |
| 159 | 154 | private static function sort_templates( $applications ) { |
| 160 | 155 | usort( |
| 161 | 156 | $applications, |
| 162 | - function ( $a, $b ) { | |
| 157 | + function( $a, $b ) { | |
| 163 | 158 | return strcmp( $a['name'], $b['name'] ); |
| 164 | 159 | } |
| 165 | 160 | ); |
| 166 | 161 | return $applications; |
| @@ -166,21 +161,10 @@ | ||
| 166 | 161 | return $applications; |
| 167 | 162 | } |
| 168 | 163 | |
| 169 | 164 | /** |
| 170 | - * @usedby FrmAppController::admin_init(). | |
| 171 | - * | |
| 172 | - * @since 6.8 | |
| 173 | - * | |
| 174 | 165 | * @return void |
| 175 | 166 | */ |
| 176 | - public static function load_page() { | |
| 177 | - self::load_assets(); | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * @return void | |
| 182 | - */ | |
| 183 | 167 | public static function load_assets() { |
| 184 | 168 | $plugin_url = FrmAppHelper::plugin_url(); |
| 185 | 169 | $version = FrmAppHelper::plugin_version(); |
| 186 | 170 | |
| @@ -188,10 +172,9 @@ | ||
| 188 | 172 | wp_enqueue_style( 'formidable-grids' ); |
| 189 | 173 | |
| 190 | 174 | $js_dependencies = array( |
| 191 | 175 | 'wp-i18n', |
| 192 | - // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7. | |
| 193 | - 'wp-hooks', | |
| 176 | + 'wp-hooks', // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7. | |
| 194 | 177 | 'formidable_dom', |
| 195 | 178 | ); |
| 196 | 179 | wp_register_script( 'formidable_applications', $plugin_url . '/js/admin/applications.js', $js_dependencies, $version, true ); |
| 197 | 180 | wp_register_style( 'formidable_applications', $plugin_url . '/css/admin/applications.css', array(), $version ); |
| @@ -201,9 +184,8 @@ | ||
| 201 | 184 | ); |
| 202 | 185 | wp_localize_script( 'formidable_applications', 'frmApplicationsVars', $js_vars ); |
| 203 | 186 | |
| 204 | 187 | wp_enqueue_script( 'formidable_applications' ); |
| 205 | - wp_set_script_translations( 'formidable_applications', 'formidable' ); | |
| 206 | 188 | wp_enqueue_style( 'formidable_applications' ); |
| 207 | 189 | |
| 208 | 190 | do_action( 'frm_applications_assets' ); |
| 209 | 191 | } |
| @@ -212,9 +194,11 @@ | ||
| 212 | 194 | * @return void |
| 213 | 195 | */ |
| 214 | 196 | public static function dequeue_scripts() { |
| 215 | 197 | if ( 'formidable-applications' === FrmAppHelper::simple_get( 'page', 'sanitize_title' ) ) { |
| 216 | - FrmAppHelper::dequeue_extra_global_scripts(); | |
| 198 | + // Avoid extra scripts loading on applications index that aren't needed. | |
| 199 | + wp_dequeue_script( 'frm-surveys-admin' ); | |
| 200 | + wp_dequeue_script( 'frm-quizzes-form-action' ); | |
| 217 | 201 | } |
| 218 | 202 | } |
| 219 | 203 | |
| 220 | 204 | /** |